[{"data":1,"prerenderedAt":11948},["ShallowReactive",2],{"$f0kvBnnDHIzDLZEYMj0bX-xwEmr-gLLxPg_R8Q1Pofn4":3,"footer-learning-topics":1249,"learning":2290,"$fckgavYb0AcZK2OLpoJka5dPkPYWwprpnBwh6X_TGsA8":2741,"\u002Flearning\u002Fprogramming-languages\u002F-solutions":2839,"\u002Flearning\u002Fprogramming-languages\u002F-tutorials":2963},{"data":4,"meta":1248},{"id":5,"createdAt":6,"updatedAt":7,"publishedAt":8,"stateful_cta":9,"documentId":43,"seo":44,"nav":86,"footer_developers":146,"footer_products":189,"api_tool_buckets":207},1,"2024-07-31T19:55:31.750Z","2026-07-13T21:19:43.933Z","2024-10-02T18:31:05.316Z",{"pro":10,"default":20,"premium":27,"starter":31,"enterprise":39},{"links":11,"title":18,"description":19},[12,15],{"to":13,"label":14},"\u002Fapilab\u002F","Experiment with API Lab",{"to":16,"label":17},"\u002Fpricing\u002F","Compare Plans","New Tools and Solutions!","We strive to bring you new and improved solutions to your most pressing PDF problems.  Let us know how we can help, and check back often to see what our latest updates can do for you.",{"links":21,"title":25,"description":26},[22],{"label":23,"action":24},"Get Started","signup","Generate a self-service API Key now!","Create your FREE API Key to start processing PDFs in seconds, only possible with pdfRest.",{"links":28,"title":18,"description":19},[29,30],{"to":13,"label":14},{"to":16,"label":17},{"links":32,"title":37,"description":38},[33,36],{"to":34,"label":35},"\u002Fselectplan\u002F","Upgrade Your Plan",{"to":16,"label":17},"Get ready to launch!","Your Starter plan is perfect for testing and prototyping.  When you're ready to launch PDF processing in your website, application, or workflow, remember to upgrade your plan for unlimited access.",{"links":40,"title":18,"description":19},[41,42],{"to":13,"label":14},{"to":16,"label":17},"r04g5q4cjgbscjtve160zt7q",{"id":45,"metaTitle":46,"metaDescription":47,"canonicalUrl":48,"structured_data":49},720,"pdfRest | Powerful PDF API for Developers, Programmatic PDF Processing","pdfRest is a REST API toolkit for developers to programmatically integrate powerful PDF processing solutions into any application or workflow, quickly and easily.",null,{"@graph":50,"@context":85},[51,75,79],{"@id":52,"url":53,"logo":54,"name":57,"@type":58,"sameAs":59,"knowsAbout":63,"description":71,"parentOrganization":72},"https:\u002F\u002Fpdfrest.com\u002F#organization","https:\u002F\u002Fpdfrest.com\u002F",{"url":55,"@type":56},"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fpdf_Rest_logo_1500_500_dark_bg_b7059b68fc.png","ImageObject","pdfRest","Organization",[60,61,62],"https:\u002F\u002Fgithub.com\u002Fpdfrest","https:\u002F\u002Fhub.docker.com\u002Fr\u002Fpdfrest\u002Fpdf-api-toolkit","https:\u002F\u002Fpypi.org\u002Fproject\u002Fpdfrest\u002F",[64,65,66,67,68,69,70],"PDF processing","PDF conversion API","OCR","Document automation","REST API","PDF\u002FA","PDF\u002FX","pdfRest is a REST API toolkit that lets developers convert, merge, split, compress, OCR, and secure PDF files through simple API calls. Powered by Adobe PDF Library.",{"url":73,"name":74,"@type":58},"https:\u002F\u002Fwww.datalogics.com\u002F","Datalogics, Inc.",{"@id":76,"url":53,"name":57,"@type":77,"publisher":78},"https:\u002F\u002Fpdfrest.com\u002F#website","WebSite",{"@id":52},{"@id":80,"url":53,"name":46,"@type":81,"about":82,"isPartOf":83,"description":84},"https:\u002F\u002Fpdfrest.com\u002F#webpage","WebPage",{"@id":52},{"@id":76},"Integrate powerful PDF processing into any application. Deploy pdfRest in the cloud, self-host in a Docker container, or run on AWS Marketplace.","https:\u002F\u002Fschema.org",[87,91,95,99,126,138,142],{"id":88,"label":89,"description":48,"to":13,"icon":48,"external":48,"target":48,"children":48,"__component":90},133,"API Lab","header.link",{"id":92,"label":93,"description":48,"to":94,"icon":48,"external":48,"target":48,"children":48,"__component":90},134,"API Tools","\u002Fapitools\u002F",{"id":96,"label":97,"description":48,"to":98,"icon":48,"external":48,"target":48,"children":48,"__component":90},135,"Learning","\u002Flearning\u002F",{"id":100,"label":101,"description":48,"to":102,"icon":48,"external":48,"target":48,"children":103,"__component":90},136,"Products","\u002Fapi-toolkit\u002F",[104,120],{"to":102,"label":105,"children":106,"description":119},"pdfRest API Toolkit",[107,111,115],{"to":108,"label":109,"description":110},"\u002Fproducts\u002Fpdfrest-api-toolkit-cloud\u002F","Cloud","Get started fast with easy, reliable, secure integration",{"to":112,"label":113,"description":114},"\u002Fproducts\u002Fpdfrest-api-toolkit-container\u002F","Container","Achieve secure, reliable, and seamless on-premises hosting integration",{"to":116,"label":117,"description":118},"\u002Fproducts\u002Fpdfrest-api-toolkit-on-aws\u002F","On AWS","Take full control with configurable, private backend","Full-featured PDF processing power",{"to":121,"label":122,"target":123,"external":124,"description":125},"https:\u002F\u002Fpdfassistant.ai\u002F","pdfAssistant.ai","_blank",true,"No-Code PDF Automation",{"id":127,"label":128,"description":48,"to":16,"icon":48,"external":48,"target":48,"children":129,"__component":90},137,"Pricing",[130],{"to":16,"label":105,"children":131,"description":119},[132,134,136],{"to":133,"label":109,"exactHash":124,"description":110},"\u002Fpricing\u002F#cloud",{"to":135,"label":113,"exactHash":124,"description":118},"\u002Fpricing\u002F#container",{"to":137,"label":117,"exactHash":124,"description":118},"\u002Fpricing\u002F#on-aws",{"id":139,"label":140,"description":48,"to":141,"icon":48,"external":48,"target":123,"children":48,"__component":90},138,"Documentation","https:\u002F\u002Fdocs.pdfrest.com\u002F",{"id":143,"label":144,"description":48,"to":145,"icon":48,"external":48,"target":123,"children":48,"__component":90},139,"Support","\u002Fsupport\u002F",[147,157,167,184],{"id":148,"label":149,"description":48,"to":48,"icon":48,"external":48,"target":48,"children":150,"__component":90},140,"API Reference Guides",[151,154],{"to":152,"label":153,"target":123,"external":124},"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F","Cloud API",{"to":155,"label":156,"target":123,"external":124},"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-container\u002Fapi-reference-guide\u002F","Self-Hosted API",{"id":158,"label":159,"description":48,"to":48,"icon":48,"external":48,"target":48,"children":160,"__component":90},141,"Getting Started Guides",[161,163,165],{"to":162,"label":109,"target":123,"external":124},"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fgetting-started\u002F",{"to":164,"label":117,"target":123,"external":124},"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-on-aws\u002Fgetting-started\u002F",{"to":166,"label":113,"target":123,"external":124},"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-container\u002Fgetting-started\u002F",{"id":168,"label":169,"description":48,"to":48,"icon":48,"external":48,"target":48,"children":170,"__component":90},142,"Resources",[171,172,175,178,181],{"to":13,"label":89},{"to":173,"label":174,"target":123,"external":124},"https:\u002F\u002Fgithub.com\u002Fdatalogics\u002Fpdf-rest-api-samples","GitHub",{"to":176,"label":177,"target":123,"external":124},"https:\u002F\u002Fwww.postman.com\u002Fpdfrest\u002F","Postman",{"to":179,"label":180,"target":123,"external":124},"https:\u002F\u002Fstatus.pdfrest.com\u002F","Status",{"to":182,"label":183,"target":123,"external":124},"https:\u002F\u002Ftrust.datalogics.com\u002F","Trust Center",{"id":185,"label":144,"description":48,"to":48,"icon":48,"external":48,"target":48,"children":186,"__component":90},143,[187],{"to":145,"label":188,"target":123,"external":124},"Contact Us",[190,197],{"id":191,"label":105,"description":48,"to":48,"icon":48,"external":48,"target":48,"children":192,"__component":90},144,[193,194,195,196],{"to":108,"label":109},{"to":116,"label":117},{"to":112,"label":113},{"to":16,"label":128},{"id":198,"label":122,"description":48,"to":48,"icon":48,"external":48,"target":48,"children":199,"__component":90},166,[200,202,205],{"to":121,"label":201,"target":123,"external":124},"AI Assistant",{"to":203,"label":204,"target":123,"external":124},"https:\u002F\u002Fpdfassistant.ai\u002Fproducts\u002Fexternal-plugins-and-integrations\u002F","Plugins & Integrations",{"to":206,"label":128,"target":123,"external":124},"https:\u002F\u002Fpdfassistant.ai\u002Fpricing\u002F",[208,272,503,664,810,933,1054,1152],{"id":209,"name":210,"description":211,"createdAt":212,"updatedAt":213,"publishedAt":214,"rank":215,"documentId":216,"api_tools":217},8,"Analyze","Leverage advanced AI to evaluate, interpret, and transform document content, performing complex enhancements and analysis.","2025-09-29T19:12:05.140Z","2025-09-29T20:54:02.065Z","2025-09-29T20:54:02.056Z",0,"d1wcx0ovi8arijsk579giafy",[218,248],{"id":219,"name":220,"tool_page_desc":221,"new_tool":124,"pro_tool":124,"header_blurb":222,"tool_card_desc":223,"youtube_url":48,"why_section_title":224,"why_section_desc":225,"slug":226,"createdAt":227,"updatedAt":228,"publishedAt":229,"publish_date":230,"rank":48,"cloud_only":124,"documentId":231,"icon":232},71,"Summarize PDF","Summarize PDF is an AI-powered REST API Tool that leverages OpenAI technology to intelligently process and condense the text content of any PDF, Markdown, or Plain Text file. Designed for speed and accuracy, this tool extracts key information and generates high-quality summaries based on your precise specifications, instantly transforming large documents into actionable insights.\n## Key Benefits of Summarize PDF API\n- Instantly extract and process all text from a PDF, enabling OpenAI's models to intelligently identify and summarize the most critical information.\n- Precisely control the output by specifying a target word count and selecting from a variety of summary formats.\n- Limit the scope of the summarization by using the pages parameter to process only a specific page or a range of pages from the document.\n- Choose to receive the summarized content directly in the JSON response or as a separate downloadable file for easy integration into your application workflows.\n- Quickly transform lengthy reports, legal documents, or research papers into concise, readable summaries to accelerate comprehension and improve workflow efficiency.\n- Select markdown as the output format to ensure the summary is clean, structured, and ready for immediate use in web content, documentation, or publishing systems.","Generate concise summaries using AI","Generate concise summaries from PDF text using AI, with customizable length and format options.","Why is pdfRest the best API to summarize PDF text?","pdfRest offers the best solution for PDF text summarization because it delivers customizable AI-driven insights, guarantees precise content extraction, and offers developer-focused output controls.","summarize-pdf","2025-09-29T19:13:30.538Z","2026-07-10T19:39:18.978Z","2025-09-29T20:55:10.696Z","2024-08-29T05:00:00.000Z","r3chcd686h0x5q8dmope5h08",{"id":233,"name":234,"alternativeText":235,"caption":48,"width":236,"height":237,"formats":48,"hash":238,"ext":239,"mime":240,"size":241,"url":242,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":244,"updatedAt":245,"documentId":246,"publishedAt":247,"focalPoint":48},617,"summarize-pdf.svg","Summarize PDF API Tool",122,75,"summarize_pdf_d37a1a2a11",".svg","image\u002Fsvg+xml",11.41,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fsummarize_pdf_d37a1a2a11.svg","strapi-provider-upload-strapi-cloud","2025-09-29T20:19:27.277Z","2025-09-29T20:19:40.581Z","lxlqtu0w9bikyvr6rim6mb4r","2026-09-02T14:52:18.710Z",{"id":249,"name":250,"tool_page_desc":251,"new_tool":124,"pro_tool":124,"header_blurb":252,"tool_card_desc":253,"youtube_url":48,"why_section_title":254,"why_section_desc":255,"slug":256,"createdAt":257,"updatedAt":258,"publishedAt":259,"publish_date":260,"rank":48,"cloud_only":124,"documentId":261,"icon":262},72,"Translate PDF","Translate PDF is an AI-powered REST API Tool that leverages OpenAI technology to intelligently translate the language of the text found within any PDF, Markdown, or Plain Text file. Designed to maintain accuracy and context across languages, this tool extracts content and translates the text into your specified target language.\n\n## Key Benefits of Translate PDF API\n\n- Instantly convert technical documents, legal contracts, and reports into virtually any language supported by OpenAI's advanced models, enabling global accessibility.\n- Automatically detect and translate the entire text content of a PDF, ensuring minimal loss of context and preserving the document's original structure.\n- Restrict translation to a specific page or range of pages for efficient processing of very large or multi-section documents.\n- Easily process PDF, Markdown, or Plain Text files and receive the translated content as structured Markdown or raw Plain Text output.\n- Choose to receive the translated content directly within the JSON response or as a separate downloadable file for flexible, high-volume application workflows.","Translate language of PDF text with AI","Translate text content extracted from PDFs into any language using AI.","Why is pdfRest the best API to translate PDF text?","pdfRest offers the best solution for PDF text translation because it delivers fast, contextual language conversion, ensures reliable content extraction from complex documents, and offers seamless integration into global workflows.","translate-pdf","2025-10-22T03:17:29.590Z","2026-07-10T19:40:04.170Z","2025-10-22T21:59:58.416Z","2025-10-21T05:00:00.000Z","ym3uvqo78jjwcceqjnrtobgv",{"id":263,"name":264,"alternativeText":265,"caption":48,"width":236,"height":237,"formats":48,"hash":266,"ext":239,"mime":240,"size":267,"url":268,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":269,"updatedAt":270,"documentId":271,"publishedAt":247,"focalPoint":48},652,"translate-pdf.svg","Translate PDF API Tool","translate_pdf_680f9c11ea",12.18,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Ftranslate_pdf_680f9c11ea.svg","2025-10-13T17:10:25.435Z","2025-10-22T02:46:53.879Z","hfaygimansou8gyewfqxt8dv",{"id":5,"name":273,"description":274,"createdAt":275,"updatedAt":276,"publishedAt":277,"rank":5,"documentId":278,"api_tools":279},"Convert","Convert files between formats and conform to specialized PDF standards","2024-08-13T18:39:14.954Z","2025-09-29T20:41:30.711Z","2024-08-13T18:39:16.447Z","tmnonktl8nl6p539bmwocdd7",[280,307,332,357,382,407,431,454,478],{"id":281,"name":282,"tool_page_desc":283,"new_tool":284,"pro_tool":124,"header_blurb":285,"tool_card_desc":286,"youtube_url":287,"why_section_title":288,"why_section_desc":289,"slug":290,"createdAt":291,"updatedAt":292,"publishedAt":293,"publish_date":294,"rank":295,"cloud_only":48,"documentId":296,"icon":297},130,"PDF to Word","PDF to Word is a REST API tool designed to seamlessly convert PDF documents into Microsoft Word format, facilitating easy editing and collaboration. As a reliable PDF to Word converter, it gives developers a fast, accurate way to automate the transformation of PDFs into editable Word documents at scale.\n## Key Benefits of PDF to Word API\n- Simplify document editing by converting PDFs to Word (.docx), allowing for easy text modifications, comments, and change tracking.\n- Preserve original formatting and layout to maintain the integrity of your documents during conversion.\n- Enhance collaboration by enabling multiple users to work on the same document in Word format, ideal for legal, marketing, and project management teams.\n- Integrate effortlessly into existing workflows with a flexible and intuitive REST API interface.\n- Achieve reliable and accurate conversion results with advanced technology, minimizing common issues like formatting errors and data loss.",false,"Convert PDF to editable Word doc","Convert PDF documents to Microsoft Word documents for easy editing","https:\u002F\u002Fwww.youtube.com\u002Fembed\u002F0Mx5rEtVSrg","Why is pdfRest the best API to convert PDF to Word?","pdfRest offers the best solution for converting PDF files to Word documents, because it supports easy document editing, reliable results, and simple integration.","pdf-to-word","2024-08-13T19:32:36.780Z","2026-09-18T21:52:33.924Z","2026-09-18T21:52:36.076Z","2024-09-03T05:00:00.000Z",2,"a4f0zj0w5po6sdzy5jb71usx",{"id":298,"name":299,"alternativeText":300,"caption":48,"width":236,"height":237,"formats":48,"hash":301,"ext":239,"mime":240,"size":302,"url":303,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":304,"updatedAt":305,"documentId":306,"publishedAt":247,"focalPoint":48},59,"pdf-to-word.svg","PDF file getting converted to a Microsoft Word file","pdf_to_word_78b075de3f",9.49,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fpdf_to_word_78b075de3f.svg","2024-08-13T19:23:27.864Z","2024-08-15T14:52:17.742Z","slo9j8s6cts7dw3ogm09o9z7",{"id":308,"name":309,"tool_page_desc":310,"new_tool":284,"pro_tool":124,"header_blurb":311,"tool_card_desc":312,"youtube_url":313,"why_section_title":314,"why_section_desc":315,"slug":316,"createdAt":317,"updatedAt":318,"publishedAt":319,"publish_date":294,"rank":320,"cloud_only":48,"documentId":321,"icon":322},131,"PDF to Excel","PDF to Excel is a REST API tool that converts PDF documents to Microsoft Excel spreadsheets to support advanced data analysis. This Pro Tool empowers developers to reliably extract tabular data from PDFs and transform it into editable Excel formats, facilitating powerful data manipulation, reporting, and visualization.\n\n## Key Benefits of PDF to Excel API\n- Streamline data analysis by extracting valuable tabular data from PDF documents directly into Excel spreadsheets, ready for formulas, macros, and charting.\n- Ensure high-quality conversion, maintaining accurate formatting and data integrity from the original PDF document to avoid common problems like data loss or compatibility issues.\n- Facilitate easy integration through a flexible and intuitive REST API, allowing you to seamlessly embed programmatic PDF to Excel conversions into any development project or workflow.\n- Automate the extraction of critical business data from invoices, reports, or scanned documents, eliminating manual data entry and reducing errors.\n- Support sophisticated business intelligence by converting static PDF data into dynamic Excel formats, enabling deeper insights and robust reporting.\n- Leverage a powerful Pro Tool to handle complex PDF structures and deliver reliable Excel output, crucial for enterprise-level data processing.","Convert PDF to Excel spreadsheet","Convert PDF documents to Microsoft Excel spreadsheets to edit and analyze data","https:\u002F\u002Fwww.youtube.com\u002Fembed\u002F60ydHSfzufM","Why is pdfRest the best API to convert PDF to Excel?","pdfRest offers the best solution for converting PDF documents to Excel spreadsheets, because it supports streamlined data analysis, high-quality conversion, and easy integration.","pdf-to-excel","2024-08-15T14:47:44.255Z","2026-09-18T21:52:48.323Z","2026-09-18T21:52:50.535Z",3,"wlr9iee95rhr5batrx3i4si0",{"id":323,"name":324,"alternativeText":325,"caption":48,"width":236,"height":237,"formats":48,"hash":326,"ext":239,"mime":240,"size":327,"url":328,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":329,"updatedAt":330,"documentId":331,"publishedAt":247,"focalPoint":48},60,"pdf-to-excel.svg","PDF file getting converted to a Microsoft Excel file","pdf_to_excel_a9a75e407e",8.98,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fpdf_to_excel_a9a75e407e.svg","2024-08-15T14:43:38.388Z","2024-08-15T14:51:01.713Z","eowt7jvwvyr946wgo8e4kp7o",{"id":333,"name":334,"tool_page_desc":335,"new_tool":284,"pro_tool":124,"header_blurb":336,"tool_card_desc":337,"youtube_url":338,"why_section_title":339,"why_section_desc":340,"slug":341,"createdAt":342,"updatedAt":343,"publishedAt":344,"publish_date":294,"rank":345,"cloud_only":48,"documentId":346,"icon":347},132,"PDF to PowerPoint","PDF to PowerPoint is a REST API tool that converts PDF documents into Microsoft PowerPoint files, enabling the creation of fully editable presentations. As a reliable PDF to PowerPoint converter, it transforms static PDF content into dynamic slides — making it ideal for enhancing presentation capabilities and streamlining document workflows. Developers looking for a fast PDF to PPT converter can automate the entire process with a single API call.\n\n## Key Benefits of PDF to PowerPoint API\n- Convert PDFs into editable PowerPoint presentations (.pptx) for easy modification of text, layouts, and multimedia integration.\n- Preserve original formatting and content, ensuring professional quality in converted slides.\n- Automate the PDF to PPT conversion process to seamlessly integrate into existing workflows, saving time and resources.\n- Utilize advanced conversion technology to ensure accurate and reliable transformation of PDFs into PowerPoint slides.\n- Empower users to create compelling presentations from existing PDFs, improving communication and engagement.\n- Reliably handle high-volume PDF to PPTX document conversion, supporting the needs of growing businesses and enterprises.","Convert PDF to PowerPoint","Convert PDF documents to adjustable Microsoft PowerPoint presentations","https:\u002F\u002Fwww.youtube.com\u002Fembed\u002F-EBpzsWki_Q","Why is pdfRest the best API to convert PDF to PowerPoint?","pdfRest offers the best solution for converting PDF documents to PowerPoint presentations, because it supports streamlined presentation creation, simple integration, and accurate results.","pdf-to-powerpoint","2024-08-15T14:56:52.093Z","2026-09-18T21:53:06.219Z","2026-09-18T21:53:07.824Z",4,"sscxdrv60vjwg8r290iihszl",{"id":348,"name":349,"alternativeText":350,"caption":48,"width":236,"height":237,"formats":48,"hash":351,"ext":239,"mime":240,"size":352,"url":353,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":354,"updatedAt":355,"documentId":356,"publishedAt":247,"focalPoint":48},61,"pdf-to-ppt.svg","PDF file getting converted to a Microsoft PowerPoint file","pdf_to_ppt_9a564fb6ab",9.3,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fpdf_to_ppt_9a564fb6ab.svg","2024-08-15T14:54:07.383Z","2024-08-15T14:54:15.261Z","c2c8b9r6pdfnvvjfm2dwnljx",{"id":88,"name":358,"tool_page_desc":359,"new_tool":284,"pro_tool":284,"header_blurb":360,"tool_card_desc":361,"youtube_url":362,"why_section_title":363,"why_section_desc":364,"slug":365,"createdAt":366,"updatedAt":367,"publishedAt":368,"publish_date":294,"rank":369,"cloud_only":48,"documentId":370,"icon":371},"Convert to PDF","Convert to PDF is a REST API tool that accepts a wide range of file types as input and reliably converts each into a standardized PDF document. It's designed to provide developers with robust, high-quality document conversion capabilities, ensuring seamless integration and consistent, compliant PDF output for diverse applications.\n## Key Benefits of Convert to PDF API\n- Support robust format conversion for Word, Excel, PowerPoint, images (JPEG, TIF, BMP, PNG), Email (.eml), PostScript, HTML, Markdown, plain text, JSON, XML, and CSV.\n- Generate standardized PDF documents optimized with high-quality Adobe® PDF Library™ technology, ensuring consistent and reliable compliance with PDF ISO 32000 specifications.\n- Create tagged PDF output from supported Office and structured-text input to support accessible document workflows and downstream processing.\n- Fine-tune file size, image quality, and page presentation with controls for compression, downsampling, page size, margins, orientation, HTML web layouts, and Adobe PDF settings files for PostScript conversion.\n- Generate styled PDFs from structured text with format-specific options for fonts, colors, headings, tables, JSON and XML views, and Markdown images.\n- Streamline content-standardization workflows by converting diverse source files into a consistent PDF format for sharing, review, and downstream processing.","Convert from many file formats to PDF","Easily convert Word, Excel, PowerPoint, BMP, TIF, PNG, JPG, Email, HTML, PostScript, Markdown, plain text, JSON, XML, and CSV files into PDF documents.","https:\u002F\u002Fwww.youtube.com\u002Fembed\u002FL3s-VTvI6vs","Why is pdfRest the best API to convert files to PDF?","pdfRest's Convert to PDF API combines broad format support, reliable PDF output, and granular control over conversion results in a single REST API tool. It supports both traditional document conversion and PDF generation from structured content.","convert-to-pdf","2024-08-15T15:06:40.139Z","2026-09-18T21:53:40.811Z","2026-09-18T21:53:42.711Z",5,"huiyfjb1a34wtm4nlbivt0wb",{"id":372,"name":373,"alternativeText":374,"caption":48,"width":185,"height":375,"formats":48,"hash":376,"ext":239,"mime":240,"size":377,"url":378,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":379,"updatedAt":380,"documentId":381,"publishedAt":247,"focalPoint":48},62,"convert-to-pdf.svg","A file being converted to PDF",76,"convert_to_pdf_9b2c4de719",7.11,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fconvert_to_pdf_9b2c4de719.svg","2024-08-15T14:59:14.354Z","2024-08-15T14:59:34.643Z","ye3tiireuqsonvexan0kojen",{"id":92,"name":383,"tool_page_desc":384,"new_tool":284,"pro_tool":284,"header_blurb":385,"tool_card_desc":386,"youtube_url":387,"why_section_title":388,"why_section_desc":389,"slug":390,"createdAt":391,"updatedAt":392,"publishedAt":393,"publish_date":294,"rank":394,"cloud_only":48,"documentId":395,"icon":396},"Convert to PDF\u002FX","Convert to PDF\u002FX is a REST API tool designed to create print-ready PDFs using trusted Adobe technology. By converting to PDF\u002FX, developers can optimize PDFs for high-quality printing, ensuring compatibility with prepress print requirements.  \n## Key Benefits of Convert to PDF\u002FX API\n- Automate preflight workflows, eliminating the need for manual processing in Acrobat, Illustrator, or other software.\n- Standardize color profiles and embed fonts to ensure accurate color reproduction and prevent font substitution issues.\n- Guarantee consistent and reliable print quality compatible with any prepress pipeline.\n- Leverage PDF\u002FX-4 and PDF\u002FX-6 for advanced features tailored to modern printing requirements.\n- Ensure compatibility with older printing systems by flattening transparencies and adhering to PDF\u002FX-1a or PDF\u002FX-3.\n","Convert PDF to PDF\u002FX for print","Convert standard PDF files to several PDF\u002FX formats to meet prepress print requirements.","https:\u002F\u002Fwww.youtube.com\u002Fembed\u002FpP01klfXVd4","Why is pdfRest the best API to convert PDF to PDF\u002FX?","pdfRest offers the best solution for converting PDF documents to PDF\u002FX specifications, because it uses the most reliable conversion technology, supports robust versions, and offers preflight conditional processing.","convert-to-pdfx","2024-08-15T15:13:57.477Z","2026-09-18T21:53:55.656Z","2026-09-18T21:53:57.440Z",6,"gxytllvknnromirdpb1uuy1o",{"id":397,"name":398,"alternativeText":383,"caption":48,"width":399,"height":400,"formats":48,"hash":401,"ext":239,"mime":240,"size":402,"url":403,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":404,"updatedAt":405,"documentId":406,"publishedAt":247,"focalPoint":48},63,"convert-to-pdfx.svg",69,84,"convert_to_pdfx_8c2592340a",5.89,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fconvert_to_pdfx_8c2592340a.svg","2024-08-15T15:08:51.316Z","2024-08-15T15:09:07.442Z","ashigwsibqd0okq1un5m2b6s",{"id":96,"name":408,"tool_page_desc":409,"new_tool":284,"pro_tool":284,"header_blurb":410,"tool_card_desc":411,"youtube_url":412,"why_section_title":413,"why_section_desc":414,"slug":415,"createdAt":416,"updatedAt":417,"publishedAt":418,"publish_date":294,"rank":419,"cloud_only":48,"documentId":420,"icon":421},"Convert to PDF\u002FA","Convert to PDF\u002FA is a REST API tool designed to transform standard PDF files into PDF\u002FA formats, ensuring long-term preservation and regulatory compliance with archival standards. This is essential for businesses and developers looking to optimize PDF files for archive, maintaining document integrity and accessibility over time.\n## Key Benefits of Convert to PDF\u002FA API\n- Convert PDFs to PDF\u002FA to meet stringent archival compliance requirements, ensuring your documents adhere to international standards for long-term preservation.\n- Preserve document integrity by embedding fonts and standardizing colors, preventing data loss and maintaining the original appearance of your files for effective archiving.\n- Ensure long-term accessibility by converting documents into a format specifically designed for digital archiving, ideal for legal, financial, and governmental records.\n- Automate the conversion process to enhance efficiency and reduce manual intervention, perfect for high-volume document management and archival workflows.\n- Leverage high-quality Adobe conversion technology that reliably conforms to the ISO 19005-2 specification for PDF\u002FA.\n- Choose from PDF\u002FA-1b, PDF\u002FA-2b, PDF\u002FA-2u, PDF\u002FA-3b, and PDF\u002FA-3u to match your specific compliance requirements.\n","Convert PDF to PDF\u002FA for archival","Convert PDFs to standard PDF\u002FA formats to ensure compliance and support long-term preservation of documents.","https:\u002F\u002Fwww.youtube.com\u002Fembed\u002FiY6lrUe_F_E","Why is pdfRest the best API to convert PDF to PDF\u002FA?","pdfRest offers the best solution for converting PDF documents to PDF\u002FA specifications, because it supports top PDF\u002FA conformance, robust versions, and problemetic input files.","convert-to-pdfa","2024-08-15T15:23:18.767Z","2026-09-18T21:54:11.170Z","2026-09-18T21:54:12.958Z",7,"mgm5ociawaoqbymsete4ji84",{"id":422,"name":423,"alternativeText":408,"caption":48,"width":424,"height":400,"formats":48,"hash":425,"ext":239,"mime":240,"size":426,"url":427,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":428,"updatedAt":429,"documentId":430,"publishedAt":247,"focalPoint":48},64,"convert-to-pdfa.svg",70,"convert_to_pdfa_5dd041ead2",5.3,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fconvert_to_pdfa_5dd041ead2.svg","2024-08-15T15:16:54.979Z","2024-08-15T15:17:11.841Z","xm01vgrbliqyhegmbc64rgat",{"id":100,"name":432,"tool_page_desc":433,"new_tool":284,"pro_tool":284,"header_blurb":434,"tool_card_desc":435,"youtube_url":436,"why_section_title":437,"why_section_desc":438,"slug":439,"createdAt":440,"updatedAt":441,"publishedAt":442,"publish_date":294,"rank":209,"cloud_only":48,"documentId":443,"icon":444},"PDF to Images","PDF to Images is a REST API tool that accurately renders each page of a PDF document into a high-quality graphic image. Leveraging Adobe PDF rendering technology for unrivaled color management, this API empowers developers to automate the conversion process, making PDF content easily accessible for web display, digital previews, and streamlined publishing workflows.\n\n### Key Benefits of PDF to Images API\n\n- Convert PDF pages to images with pixel-perfect accuracy, preserving the original layout and aesthetic integrity for a consistent visual representation.\n- Generate high-quality thumbnails for document previews, search results, or digital asset management systems to improve user experience.\n- Support multiple image formats including JPEG, PNG, GIF, TIFF, and BMP, allowing you to choose the best format for your specific needs.\n- Control output image quality and resolution with customizable parameters like Resolution (DPI) and JPEG quality, giving you granular control over file size and visual fidelity.\n- Enhance security and data privacy by converting sensitive PDF content into flattened, uneditable images, and benefit from GDPR and HIPAA-compliant processing.\n- Streamline workflows by converting specific pages from a PDF using our one-to-many functionality to get a separate image file for each page with a single API call.","Render PDF pages to image formats","Convert PDFs to JPGs, BMPs, PNGs, GIFs, and TIFs, accurately preserving color fidelity.","https:\u002F\u002Fwww.youtube.com\u002Fembed\u002FTBh3eHFO9MQ","Why is pdfRest the best API to convert PDF to image files?","pdfRest offers the best solution for converting PDF documents to graphic image files, because it supports unrivaled color management, images for each PDF page, and intuitive design.","pdf-to-images","2024-08-15T15:29:14.854Z","2026-09-18T21:54:36.510Z","2026-09-18T21:54:38.221Z","jr6zly7tchk0iz4zi8s4rlak",{"id":445,"name":446,"alternativeText":447,"caption":48,"width":185,"height":375,"formats":48,"hash":448,"ext":239,"mime":240,"size":449,"url":450,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":451,"updatedAt":452,"documentId":453,"publishedAt":247,"focalPoint":48},65,"pdf-to-images.svg","A PDF file converted to an image","pdf_to_images_e05f4809dc",12.31,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fpdf_to_images_e05f4809dc.svg","2024-08-15T15:25:48.244Z","2024-08-15T15:25:57.531Z","r40074mrrb7xv02yxzhzhnl3",{"id":127,"name":455,"tool_page_desc":456,"new_tool":124,"pro_tool":48,"header_blurb":457,"tool_card_desc":458,"youtube_url":48,"why_section_title":459,"why_section_desc":460,"slug":461,"createdAt":462,"updatedAt":463,"publishedAt":464,"publish_date":465,"rank":466,"cloud_only":48,"documentId":467,"icon":468},"PDF to PostScript","Convert PDF to PostScript is a REST API tool that creates downloadable PostScript files from PDF documents. Developers can select the PostScript language level, pages to export, binary-output behavior, scaling, rotation, shrink-to-fit behavior, and whether printable annotations are included.\n\n## Key Benefits of PDF to PostScript API\n\n- Convert PDF documents into PostScript Level 2 or Level 3 files through a REST API for print, prepress, and legacy production systems that depend on PostScript output.\n- Export an entire PDF or only the pages a workflow needs, helping publishing and production teams prepare targeted PostScript deliverables without manually splitting source files.\n- Choose binary PostScript for compact output or text-safe, 7-bit PostScript for downstream systems, transfer paths, or production environments with compatibility constraints.\n- Adjust scale, rotation, and shrink-to-fit behavior at conversion time to prepare page content for a target output process while preserving the original PDF.\n- Include or omit printable annotations so the generated PostScript reflects the intended production view, whether notes and markups should be carried forward or excluded.\n- Pair with Convert to PDF to support PDF refrying: a PDF -> PostScript -> PDF roundtrip used in certain print and prepress workflows to produce PostScript-based delivery derivatives.\n","Convert PDF to PostScript for print production workflows","Create reliable PostScript output from PDF files for print, prepress, and legacy production systems that depend on PostScript.","Why is pdfRest the best API to convert PDF to PostScript?","pdfRest offers the best solution for converting PDF documents to PostScript, because it combines Adobe technology, production-ready output controls, and a scalable API workflow for print, prepress, and legacy systems.","pdf-to-postscript","2026-09-03T22:03:17.782Z","2026-09-18T21:54:53.661Z","2026-09-18T21:54:55.450Z","2026-09-04T05:00:00.000Z",9,"pbcdzy62zeuvhhzt8g1ubs81",{"id":469,"name":470,"alternativeText":471,"caption":48,"width":185,"height":237,"formats":48,"hash":472,"ext":239,"mime":240,"size":473,"url":474,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":475,"updatedAt":476,"documentId":477,"publishedAt":475,"focalPoint":48},718,"pdf-to-postscript.svg","PDF to PostScript API Tool","pdf_to_postscript_dd764fea4c",11.28,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fpdf_to_postscript_dd764fea4c.svg","2026-09-03T21:04:21.005Z","2026-09-03T21:04:36.851Z","sqjhdfebkpd6e4hncpr0bao9",{"id":479,"name":480,"tool_page_desc":481,"new_tool":124,"pro_tool":124,"header_blurb":482,"tool_card_desc":483,"youtube_url":48,"why_section_title":484,"why_section_desc":485,"slug":486,"createdAt":487,"updatedAt":488,"publishedAt":489,"publish_date":230,"rank":5,"cloud_only":48,"documentId":490,"icon":491},129,"Create ZUGFeRD PDF","Build complete ZUGFeRD and Factur-X e-invoicing workflows with one API Tool. Generate a professional invoice PDF from structured XML, preserve an existing branded PDF when its contents match the invoice data, regenerate it when they do not, and independently validate the finished hybrid invoice.\n## Key Benefits of Create ZUGFeRD PDF API\n\n- Generate complete ZUGFeRD or Factur-X hybrid invoices from CII XML, including a visual PDF, embedded XML attachment, required metadata, and PDF\u002FA-3 packaging.\n- Combine an existing invoice PDF with XML data and identify concrete discrepancies before completing the hybrid invoice for delivery, archival, or automated processing.\n- Regenerate the visual invoice from canonical XML whenever supplied PDF content conflicts with the XML or cannot be confidently confirmed by validation.\n- Validate existing ZUGFeRD and Factur-X PDFs without modifying them, checking XML business rules, PDF\u002FA-3 status, attachment relationships, metadata, and package structure.\n- Support MINIMUM, BASIC WL, BASIC, and EN 16931 profiles for ZUGFeRD 2.5.2 and Factur-X 1.09.2, helping meet current German and French e-invoicing needs.\n- Customize XML-generated invoices with logos, regular and bold fonts, language, regional formats, currency display, colors, decimal precision, and footer messaging.\n- Upload invoice files directly or reuse pdfRest resource IDs from prior operations to build efficient, fully automated e-invoicing workflows at any scale.","Create & validate ZUGFeRD \u002F Factur-X","Create and validate ZUGFeRD and Factur-X e-invoices from XML or PDF files with embedded CII data and PDF\u002FA-3 conformance.","Why is pdfRest the best API for creating and validating ZUGFeRD and Factur-X invoices?","pdfRest offers the best ZUGFeRD and Factur-X solution because it provides one API workflow to create compliant hybrid invoices, preserve or regenerate PDF visuals from canonical CII XML, and validate the completed PDF\u002FA-3 package end to end.","create-zugferd-pdf","2026-09-17T22:16:25.187Z","2026-09-18T21:49:10.411Z","2026-09-18T21:49:12.227Z","fq5lkw4282h9m15mefvekyct",{"id":492,"name":493,"alternativeText":494,"caption":495,"width":496,"height":237,"formats":48,"hash":497,"ext":239,"mime":240,"size":498,"url":499,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":500,"updatedAt":501,"documentId":502,"publishedAt":500,"focalPoint":48},719,"create-zugferd-pdf.svg","Create ZUGFeRD PDF API Tool","",68,"create_zugferd_pdf_c820e83b06",12.06,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fcreate_zugferd_pdf_c820e83b06.svg","2026-09-17T21:39:06.559Z","2026-09-17T21:39:31.101Z","x1mb3q9x8n1wyd3u4k4ksl9z",{"id":295,"name":504,"description":505,"createdAt":506,"updatedAt":507,"publishedAt":508,"rank":295,"documentId":509,"api_tools":510},"Optimize","Enhance PDFs for their intended usage with tools that target specific improvements","2024-08-13T18:39:31.653Z","2025-09-29T20:41:41.021Z","2024-08-13T18:39:33.336Z","nkqykatf69qbewfjcszxzcmy",[511,534,556,577,597,620,641],{"id":209,"name":512,"tool_page_desc":513,"new_tool":284,"pro_tool":284,"header_blurb":514,"tool_card_desc":515,"youtube_url":516,"why_section_title":517,"why_section_desc":518,"slug":519,"createdAt":520,"updatedAt":521,"publishedAt":522,"publish_date":294,"rank":48,"cloud_only":48,"documentId":523,"icon":524},"Compress PDF","Compress PDF is a REST API tool designed to significantly reduce PDF file sizes while maintaining the integrity of the document's content. Developers can automate the compression process, ensuring efficient file size reduction without compromising quality or altering the original layout.\n## Key Benefits of Compress PDF API\n- Maximize file size reduction to optimize storage and improve file transfer speeds, making large PDFs more manageable.\n- Preserve document quality by maintaining text clarity and image fidelity, ensuring compressed files remain professional and readable.\n- Enhance email deliverability by reducing PDF sizes to meet email attachment limits, facilitating seamless communication.\n- Streamline document management by integrating compressed PDFs into existing workflows, reducing storage costs and improving accessibility.\n- Support compliance and archiving by compressing PDFs for long-term storage without losing critical information or metadata.\n- Meet regulatory compliance and document submission limits, ensuring that documents adhere to industry standards and legal requirements.","Reduce file size, preserve quality","Minimize PDF file sizes while preserving content quality to speed up document transfers and reduce storage costs.","https:\u002F\u002Fwww.youtube.com\u002Fembed\u002Fe_dOeGPaG34","Why is pdfRest the best API to compress PDF file size?","pdfRest offers the best solution for compressing PDF documents, because it supports unmatched file size reduction, a simple interface, and gold-standard technology.","compress-pdf","2024-08-15T15:35:48.591Z","2026-07-10T19:44:46.607Z","2024-08-15T15:36:17.475Z","m9un0zvkqqs2lskskm5xbop6",{"id":525,"name":526,"alternativeText":512,"caption":48,"width":527,"height":375,"formats":48,"hash":528,"ext":239,"mime":240,"size":529,"url":530,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":531,"updatedAt":532,"documentId":533,"publishedAt":247,"focalPoint":48},66,"compress-pdf.svg",110,"compress_pdf_afacc9bd77",7.48,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fcompress_pdf_afacc9bd77.svg","2024-08-15T15:31:48.881Z","2024-08-15T15:32:06.178Z","u1o60almx8mpbn35gcls0tor",{"id":466,"name":535,"tool_page_desc":536,"new_tool":284,"pro_tool":284,"header_blurb":537,"tool_card_desc":538,"youtube_url":48,"why_section_title":539,"why_section_desc":540,"slug":541,"createdAt":542,"updatedAt":543,"publishedAt":544,"publish_date":294,"rank":48,"cloud_only":48,"documentId":545,"icon":546},"Linearize PDF","Linearize PDF is a REST API tool that optimizes a PDF file for quick online viewing, often called 'Fast Web View', significantly improving user experience when documents are streamed over a network connection. Developers can use this tool to ensure PDFs are web-optimized, allowing content to load progressively in web browsers without waiting for the entire file to download.\n## Key Benefits of Linearize PDF API\n- Optimize for Fast Web View by restructuring PDF content, enabling pages to display quickly in web viewers even before the entire document is loaded.\n- Improve user experience by providing instant access to PDF content online, reducing wait times and enhancing engagement with your documents.\n- Ensure reliable PDF linearization using the same underlying technology that powers Adobe® Acrobat™, guaranteeing proper optimization from the start.\n- Streamline application with a simple process that requires minimal input, allowing you to easily prepare documents for the best possible online viewing experience.\n- Facilitate easy web app integration as a REST API tool, making it ideally suited for optimizing PDFs intended to be served over any network connection, regardless of your tech stack.\n- Reduce bandwidth usage and server load by enabling efficient, byte-serving delivery of PDF content for online viewing.","Optimize for fast web viewing","Apply linearization to PDFs to support a quick online viewing experience with Fast Web View.","Why is pdfRest the best API to linearize PDF?","pdfRest offers the best solution for linearizing PDF documents, because it supports Fast Web View, simple application, and easy integration.","linearize-pdf","2024-08-15T15:41:29.665Z","2026-07-10T19:45:12.986Z","2024-08-15T15:41:31.843Z","t0uoic69wkk6yuud1tub0gqd",{"id":547,"name":548,"alternativeText":535,"caption":48,"width":348,"height":549,"formats":48,"hash":550,"ext":239,"mime":240,"size":551,"url":552,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":553,"updatedAt":554,"documentId":555,"publishedAt":247,"focalPoint":48},67,"linearize.svg",90,"linearize_586cd2c3a6",5.27,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Flinearize_586cd2c3a6.svg","2024-08-15T15:36:47.868Z","2024-08-15T15:37:10.641Z","u1zpcivoj3og13n61bkclmyu",{"id":557,"name":558,"tool_page_desc":559,"new_tool":284,"pro_tool":284,"header_blurb":560,"tool_card_desc":561,"youtube_url":48,"why_section_title":562,"why_section_desc":563,"slug":564,"createdAt":565,"updatedAt":566,"publishedAt":567,"publish_date":294,"rank":48,"cloud_only":48,"documentId":568,"icon":569},10,"Flatten Transparencies","Flatten Transparencies is a REST API tool that renders and replaces all transparent objects in a PDF with opaque colors. This process increases RIP speed in a prepress workflow and supports conversion to other file formats.  \n## Key Benefits of Flatten Transparencies API\n- Automate transparency flattening to streamline prepress workflows, reducing the need for manual adjustments.\n- Convert transparent objects to opaque colors to increase the speed of raster image processing (RIP), optimizing for print.\n- Flatten transparencies to ensure your PDFs are compatible with a wide range of printing systems and file formats.\n- Eliminate transparency issues and guarantee consistent visual document appearance across printing environments.\n- Ensure compatibility with older printing systems that do not support transparency for reliable print-ready PDFs.","Optimize for print and compatibility","Flatten all transparent objects in a PDF to increase RIP speed in a prepress workflow and support conversion to other file formats.","Why use our version of Flatten Transparencies?","pdfRest is the best API to flatten PDF transparencies because it offers unmatched color accuracy, maximum compatibility, and reliable printing, all powered by Adobe's industry-leading technology.","flatten-transparencies","2024-08-15T15:47:27.619Z","2026-07-10T19:45:42.226Z","2024-08-15T15:47:31.348Z","ng1iuah17kwp3ojabadgq7nr",{"id":496,"name":570,"alternativeText":558,"caption":48,"width":281,"height":375,"formats":48,"hash":571,"ext":239,"mime":240,"size":572,"url":573,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":574,"updatedAt":575,"documentId":576,"publishedAt":247,"focalPoint":48},"flatten-transparencies.svg","flatten_transparencies_a85de628b2",3.07,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fflatten_transparencies_a85de628b2.svg","2024-08-15T15:42:37.863Z","2024-08-15T15:42:42.649Z","p30iwcgolky9ywhenno1ek71",{"id":578,"name":579,"tool_page_desc":580,"new_tool":284,"pro_tool":284,"header_blurb":581,"tool_card_desc":582,"youtube_url":48,"why_section_title":583,"why_section_desc":584,"slug":585,"createdAt":586,"updatedAt":587,"publishedAt":588,"publish_date":294,"rank":48,"cloud_only":48,"documentId":589,"icon":590},12,"Flatten Layers","Flatten Layers is a REST API Tool that collapses all PDF content spread across multiple document layers into one layer of page content. This tool is designed to help developers simplify PDF documents, enhance compatibility, and optimize files for reliable printing and distribution by consolidating complex layered structures.\n## Key Benefits of Flatten Layers API\n- Reduce file complexity by consolidating content from multiple PDF layers into a single, unified page content layer, simplifying document structure for downstream workflows.\n- Prepare PDFs for print reliably by optimizing document content and reducing potential rendering issues associated with layered files, ensuring consistent output.\n- Streamline integration with existing systems by providing a simplified PDF structure that is more universally compatible with various viewers and processing tools.\n- Ensure consistent content display by eliminating the variable visibility of layers, making all content permanently visible for archiving and sharing.\n- Leverage tried-and-true Adobe® technology, which has supported enterprise print operations for decades, guaranteeing reliable optimization of PDF documents.\n- Automate the process of flattening PDF layers, allowing you to achieve optimized files for distribution without needing to delve into the nuances of the PDF file format.","Collapse multiple layers into one","Collapse all content from separate PDF layers onto a single layer of page content.","Why is pdfRest the best API to flatten PDF layers?","pdfRest offers the best solution for flattening PDF layers, because it reduces file complexity, prepares PDFs for print, and streamlines integration.","flatten-layers","2024-08-15T15:58:45.651Z","2026-07-10T19:46:17.474Z","2024-08-15T15:58:47.165Z","lbnvreecu8vz84adatcd4mn8",{"id":424,"name":591,"alternativeText":579,"caption":48,"width":479,"height":237,"formats":48,"hash":592,"ext":239,"mime":240,"size":302,"url":593,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":594,"updatedAt":595,"documentId":596,"publishedAt":247,"focalPoint":48},"flatten-layers.svg","flatten_layers_b3faeefdc7","https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fflatten_layers_b3faeefdc7.svg","2024-08-15T15:52:23.596Z","2024-08-15T15:52:34.368Z","fawqvb0l1mmihshvsnipgwx8",{"id":598,"name":599,"tool_page_desc":600,"new_tool":284,"pro_tool":284,"header_blurb":601,"tool_card_desc":602,"youtube_url":603,"why_section_title":604,"why_section_desc":605,"slug":606,"createdAt":607,"updatedAt":608,"publishedAt":609,"publish_date":610,"rank":48,"cloud_only":48,"documentId":611,"icon":612},13,"Convert PDF Colors","Convert PDF Colors is a REST API tool offering precise control over the color scheme of any PDF document. Adjust the colors of text and images across the entire file using custom ICC profiles or choose from a library of print, screen, web, and grayscale presets.\n\n## Key Benefits of Convert PDF Colors API\n- Convert PDF from RGB to CMYK to achieve consistent color output for print, ensuring accurate colors across substrates.\n- Convert PDF from CMYK to RGB to optimize colors for web display, ensuring accurate representation across screens.\n- Convert color PDF to black and white to prepare for printing on B&W printers and to reduce file size for document archival.\n- Achieve accurate color reproduction through custom ICC profiles and pre-defined color spaces.\n- Maintain color fidelity for digital publications, such as eBooks and online magazines or newsletters.\n","Change a PDF's Color Profile","Change a PDF's color profile to optimize for print, screen, grayscale, or custom needs.","https:\u002F\u002Fwww.youtube.com\u002Fembed\u002FQ0RdR20pZuw","Why is pdfRest the best API to convert PDF Colors?","pdfRest offers the best solution for converting PDF colors, because it offers unmatched control, flexible color space transformations, and efficient preset profiles.","convert-pdf-colors","2024-08-15T16:02:17.972Z","2026-07-10T19:44:21.681Z","2024-08-15T16:08:59.950Z","2024-09-02T05:00:00.000Z","avlqefgbhfhkc269xjadqa4v",{"id":219,"name":613,"alternativeText":599,"caption":48,"width":185,"height":375,"formats":48,"hash":614,"ext":239,"mime":240,"size":615,"url":616,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":617,"updatedAt":618,"documentId":619,"publishedAt":247,"focalPoint":48},"convert-pdf-colors.svg","convert_pdf_colors_ec3097ec4d",2.4,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fconvert_pdf_colors_ec3097ec4d.svg","2024-08-15T16:01:18.268Z","2024-08-15T16:01:38.455Z","lt8xaq9ltwf761uc6ldbi6dz",{"id":621,"name":622,"tool_page_desc":623,"new_tool":284,"pro_tool":284,"header_blurb":624,"tool_card_desc":625,"youtube_url":48,"why_section_title":626,"why_section_desc":627,"slug":628,"createdAt":629,"updatedAt":630,"publishedAt":631,"publish_date":294,"rank":48,"cloud_only":48,"documentId":632,"icon":633},11,"Flatten Annotations","Flatten Annotations is a REST API tool that collapses annotation appearances into page content and makes them no longer editable. It's designed to provide developers with precise control over document finalization, ensuring PDF annotations display consistently across all viewers and platforms while safeguarding against unintended modifications.\n## Key Benefits of Flatten Annotations API\n- Maximize compatibility by converting diverse PDF annotation types into standard page content, ensuring universal display across all PDF viewers and processing tools.\n- Lock in feedback by preserving highlights, comments, and shapes directly into the document's content layer, preventing further editing or accidental changes to critical review notes.\n- Remove hidden comments and associated metadata from annotations, effectively sanitizing the PDF to ensure only visible content remains, enhancing document security and privacy.\n- Streamline document workflows by creating definitive versions of PDFs with finalized annotations, ideal for archiving, distribution, or legal purposes.\n- Enhance document integrity by making all annotation appearances permanent, crucial for audit trails and compliance requirements.\n- Automate the preparation of PDFs for consistent viewing and printing, eliminating rendering inconsistencies often associated with dynamic annotations.","Collapse annotations into page content","Flatten all annotations in a PDF to collapse their appearances into page content and make them uneditable.","Why is pdfRest the best API to flatten PDF annotations?","pdfRest offers the best solution for flattening PDF annotations, because it maximizes compatibility, locks in feedback, and removes hidden comments.","flatten-annotations","2024-08-15T15:51:16.262Z","2026-07-10T19:47:03.359Z","2024-08-15T15:51:18.393Z","d52bv2j55eom32tfy8kt8j96",{"id":399,"name":634,"alternativeText":622,"caption":48,"width":308,"height":298,"formats":48,"hash":635,"ext":239,"mime":240,"size":636,"url":637,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":638,"updatedAt":639,"documentId":640,"publishedAt":247,"focalPoint":48},"flatten-annotations.svg","flatten_annotations_3fb78bfe4a",3.94,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fflatten_annotations_3fb78bfe4a.svg","2024-08-15T15:48:27.679Z","2024-08-15T15:48:31.189Z","rxzqs31gaxrv2skv65v5pe1u",{"id":642,"name":643,"tool_page_desc":644,"new_tool":284,"pro_tool":48,"header_blurb":645,"tool_card_desc":646,"youtube_url":48,"why_section_title":647,"why_section_desc":648,"slug":649,"createdAt":650,"updatedAt":651,"publishedAt":652,"publish_date":653,"rank":48,"cloud_only":48,"documentId":654,"icon":655},31,"Rasterize PDF","Rasterize PDF is a REST API tool that converts each page of a PDF into a rasterized image, a process fundamental to computer graphics, where vector content and text are translated into individual pixels on a 2D plane. The result is a PDF document where all pages are flattened for consistent rendering and printing across every device and platform.\n## Key Benefits of Rasterize PDF API\n- Ensure your PDF files display consistently across all platforms and devices by flattening complex elements into raster images.\n- Rasterization removes dependencies on fonts and other error-prone vector elements, ensuring all content is printed as intended.\n- Protect sensitive information by preventing text extraction and editing, as the content is converted into images.\n- Simplify document storage by creating a uniform format that is less susceptible to rendering issues over time.\n- Maintain the visual integrity of your documents across applications, providing a reliable solution for both digital and print media.\n","Flatten PDF pages to images","Convert each page of a PDF into a rasterized image for consistent rendering and printing.","Why is pdfRest the best API for PDF rasterization?","pdfRest offers the best solution for rasterizing PDF files, because it effectively simplifies printing, ensures consistent rendering, and supports document security.","rasterize-pdf","2025-01-22T21:59:58.706Z","2026-07-10T19:43:48.162Z","2025-01-24T20:50:15.285Z","2024-08-28T05:00:00.000Z","dvnc330jxfwehq9qnkebwqm7",{"id":656,"name":657,"alternativeText":643,"caption":48,"width":445,"height":658,"formats":48,"hash":659,"ext":239,"mime":240,"size":660,"url":661,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":662,"updatedAt":662,"documentId":663,"publishedAt":247,"focalPoint":48},270,"rasterize-pdf.svg",82,"rasterize_pdf_f334fd5734",4.79,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Frasterize_pdf_f334fd5734.svg","2025-01-22T22:01:13.748Z","yq24filwmrn8k0xv2si6mum4",{"id":394,"name":665,"description":666,"createdAt":667,"updatedAt":668,"publishedAt":669,"rank":320,"documentId":670,"api_tools":671},"Secure","Protect your documents and data with this suite of tools to enhance security","2024-08-13T18:40:42.072Z","2025-09-29T20:41:52.950Z","2024-08-13T18:40:43.271Z","zeflmr4447tbe0fht5vd2rpi",[672,695,718,741,766,788],{"id":673,"name":674,"tool_page_desc":675,"new_tool":284,"pro_tool":284,"header_blurb":676,"tool_card_desc":677,"youtube_url":678,"why_section_title":679,"why_section_desc":680,"slug":681,"createdAt":682,"updatedAt":683,"publishedAt":684,"publish_date":294,"rank":295,"cloud_only":48,"documentId":685,"icon":686},23,"Watermark PDF","The Watermark PDF API is a powerful tool for adding either a text-based or image-based watermark to a PDF. This API offers a high degree of customization, giving you precise control over the watermark's appearance, including font, size, color, opacity, rotation, and positioning. It's an effective way to communicate a document's status, enforce intellectual property rights, or apply branding.\n\n### Key Benefits of Watermark PDF API\n\n* Add text or image watermarks with full control over their style and placement, including the ability to use a PDF as the source for an image watermark.\n* Control the watermark's appearance with extensive customization options, including an extensive font list, adjustable text size, and both RGB and CMYK color support.\n* Customize positioning and rotation using x and y offsets and a rotation parameter to place your watermark exactly where you need it on the page.\n* Optionally place watermarks behind page content, allowing for subtle security or branding that doesn't obstruct the document's main text and images.\n* Apply watermarks to specific pages or ranges within a document, giving you granular control over which pages receive the watermark.\n* Automate document security and branding by adding \"Confidential\" or \"Draft\" labels, copyright notices, or company logos at scale.","Apply a text or image watermark to PDF","Apply a watermark to all pages of a PDF using either text or an image.","https:\u002F\u002Fwww.youtube.com\u002Fembed\u002FPuutAS2GWBg","Why is pdfRest the best API to watermark PDF?","pdfRest offers the best solution for watermarking PDF documents, because it supports both text and images, full customization, and an extensive font list.","watermark-pdf","2024-08-15T17:08:26.262Z","2026-07-10T21:35:13.859Z","2024-08-15T17:15:38.047Z","ggaguunbgs7zd97q3jzn8rpb",{"id":687,"name":688,"alternativeText":674,"caption":48,"width":298,"height":237,"formats":48,"hash":689,"ext":239,"mime":240,"size":690,"url":691,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":692,"updatedAt":693,"documentId":694,"publishedAt":247,"focalPoint":48},81,"watermarked-pdf.svg","watermarked_pdf_b261147f0a",6.15,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fwatermarked_pdf_b261147f0a.svg","2024-08-15T17:04:59.298Z","2024-08-15T17:08:04.390Z","sbbdvq5o7olh057k1k8m5qda",{"id":696,"name":697,"tool_page_desc":698,"new_tool":284,"pro_tool":284,"header_blurb":699,"tool_card_desc":700,"youtube_url":701,"why_section_title":702,"why_section_desc":703,"slug":704,"createdAt":705,"updatedAt":706,"publishedAt":707,"publish_date":294,"rank":295,"cloud_only":48,"documentId":708,"icon":709},24,"Encrypt PDF","Encrypt PDF is a REST API tool that securely encrypts and protects all of the content within a PDF document, requiring the viewer to enter a password to access the contents of a document. This tool empowers developers to implement robust PDF security workflows, safeguarding sensitive information and controlling document access programmatically.\n## Key Benefits of Encrypt PDF API\n- Automate security workflows by seamlessly integrating password protection into your document lifecycle, ensuring sensitive information is always secure.\n- Apply industry-leading encryption with AES 256-bit encryption technology, providing robust security that is virtually impenetrable from brute-force attacks.\n- Manage PDF access by easily setting or changing passwords for documents, or even completely removing existing encryption when authorized.\n- Convert various document types into encrypted PDFs for secure archiving, maintaining confidentiality and compliance standards.\n- Create secure document workflows by chaining API requests to encrypt PDFs after conversion or other transformations, enhancing overall data protection.\n- Leverage Adobe® PDF Library™ technology for reliable and secure encryption, trusted by professionals worldwide for robust document security.","Add a required password to open a PDF","Secure PDFs with impenetrable encryption and require a password for viewers to open encrypted documents.","https:\u002F\u002Fwww.youtube.com\u002Fembed\u002FDU0wNxyHXDE","Why is pdfRest the best API to encrypt PDF with password?","pdfRest offers the best solution for encrypting PDF documents with a password, because it supports automated security workflows, removing and changing passwords, and secure AES 256-bit encryption technology.","encrypt-pdf","2024-08-15T17:19:17.502Z","2026-07-10T21:35:34.953Z","2024-08-15T17:21:09.781Z","wxulzpesdvjxbvkofjdyawod",{"id":658,"name":710,"alternativeText":711,"caption":48,"width":397,"height":658,"formats":48,"hash":712,"ext":239,"mime":240,"size":713,"url":714,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":715,"updatedAt":716,"documentId":717,"publishedAt":247,"focalPoint":48},"encrypt-pdf.svg","Encrypt PDF icon showing a PDF document with a padlock in front of it.","encrypt_pdf_ffb93383d4",4.47,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fencrypt_pdf_ffb93383d4.svg","2024-08-15T17:17:02.629Z","2024-08-15T17:17:46.553Z","zaonbfjm3tvd5y9r2knq1kaz",{"id":719,"name":720,"tool_page_desc":721,"new_tool":284,"pro_tool":284,"header_blurb":722,"tool_card_desc":723,"youtube_url":724,"why_section_title":725,"why_section_desc":726,"slug":727,"createdAt":728,"updatedAt":729,"publishedAt":730,"publish_date":294,"rank":295,"cloud_only":48,"documentId":731,"icon":732},25,"Restrict PDF","Restrict PDF is a REST API tool that acts as a powerful security measure, applying usage restrictions to a document to limit how viewers can interact with the content. Developers can use a permissions password to forbid actions like printing, copying text, or editing, ensuring sensitive or confidential information remains secure. With the flexibility to add, modify, or remove restrictions, this tool simplifies document security workflows for legal, financial, and other privacy-sensitive applications.\n\n### Key Benefits of Restrict PDF API\n\n- Secure sensitive documents by preventing unauthorized actions like printing, editing content, or adding annotations, ensuring confidentiality and integrity.\n- Control user permissions for a document by applying a permissions password to a new or existing file, even one that is already secured with an open password.\n- Automate security workflows for confidential documents, such as legal contracts or internal reports, to streamline secure distribution to clients or partners.\n- Support advanced restriction settings, including the ability to differentiate between high- and low-resolution printing, providing granular control over document usage.\n- Remove existing restrictions using the dedicated \u002Funrestricted-pdf endpoint, allowing you to easily update security settings as your document's purpose or audience changes.\n- Ensure best-practice security with a tool powered by the Adobe PDF Library, offering top-quality security features and advanced restriction modification.","Limit what viewers can do with a PDF","Set restrictions on a PDF to limit how users can interact with the document, such as printing, editing, or extracting text and images.","https:\u002F\u002Fwww.youtube.com\u002Fembed\u002FFrKGEI0hSEs","Why is pdfRest the best API to apply restrictions to PDF?","pdfRest offers the best solution for restricting PDF documents with a permissions password, because it supports advanced restriction modification, top quality security, and flexible restriction options.","restrict-pdf","2024-08-15T17:23:57.456Z","2026-07-10T21:36:04.906Z","2024-08-15T17:26:16.673Z","tvk1jhgf95ki7zec9zn2nmae",{"id":733,"name":734,"alternativeText":720,"caption":48,"width":424,"height":400,"formats":48,"hash":735,"ext":239,"mime":240,"size":736,"url":737,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":738,"updatedAt":739,"documentId":740,"publishedAt":247,"focalPoint":48},83,"restrict-pdf.svg","restrict_pdf_444762b050",4.37,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Frestrict_pdf_444762b050.svg","2024-08-15T17:22:21.890Z","2024-08-15T17:22:34.852Z","ykrmuyqt8rqbf6mao9zu5cmo",{"id":742,"name":743,"tool_page_desc":744,"new_tool":284,"pro_tool":124,"header_blurb":745,"tool_card_desc":746,"youtube_url":48,"why_section_title":747,"why_section_desc":748,"slug":749,"createdAt":750,"updatedAt":751,"publishedAt":752,"publish_date":753,"rank":48,"cloud_only":48,"documentId":754,"icon":755},36,"Sign PDF","Sign PDF is a REST API tool for programmatically applying digital signatures to PDF documents using PFX or certificate credentials to embed cryptographically secure signatures. These digital signatures inherently include electronic signature elements, allowing for customized visual appearances with typed text or image files for hand-drawn signatures or logos.\n### Key Benefits of Sign PDF API\n- Programmatically apply signatures to accelerate document processing.\n- Embed cryptographically secure digital signatures using your credentials, enhancing document integrity.\n- Add visual signatures from typed text or image files (e.g., hand-drawn, logos) with customizable appearances.\n- Apply accepted electronic and digital signature formats to meet industry requirements.\n- Programmatically add consistent, professional visual signatures for strong brand identity.\n- Integrate PDF signing capabilities effortlessly into applications using a flexible REST API.","Apply digital signatures","Apply digital signatures to PDFs, securing document authenticity and integrity.","Why is pdfRest the best API to digitally sign PDFs?","pdfRest offers the best API for digitally signing PDFs, because it applies robust, cryptographically-backed digital signatures, enables flexible electronic signature appearances, and empowers critical high-volume, compliance-driven use cases.","sign-pdf","2025-07-18T14:28:15.145Z","2026-07-10T21:34:24.963Z","2025-07-18T21:23:24.704Z","2023-07-11T05:00:00.000Z","fum794n7do1p6893xcg28m1v",{"id":756,"name":757,"alternativeText":758,"caption":48,"width":759,"height":375,"formats":48,"hash":760,"ext":239,"mime":240,"size":761,"url":762,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":763,"updatedAt":764,"documentId":765,"publishedAt":247,"focalPoint":48},424,"sign-pdf.svg","Sign PDF API Tool",79,"sign_pdf_3ffd97fd2e",7.56,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fsign_pdf_3ffd97fd2e.svg","2025-07-18T15:22:16.194Z","2025-07-18T15:22:27.233Z","o4u8tky2zammruoqmpctd8t6",{"id":767,"name":768,"tool_page_desc":769,"new_tool":284,"pro_tool":124,"header_blurb":770,"tool_card_desc":771,"youtube_url":48,"why_section_title":772,"why_section_desc":773,"slug":774,"createdAt":775,"updatedAt":776,"publishedAt":777,"publish_date":778,"rank":48,"cloud_only":48,"documentId":779,"icon":780},37,"Redact PDF","Redact PDF is a REST API tool designed to securely remove sensitive information from PDF documents, ensuring privacy and compliance with data protection regulations. This automated PDF redaction solution is ideal for businesses looking to safeguard confidential data and optimize document workflows.\n## Key Benefits of Redact PDF API\n- Redact PDF documents by targeting specific text or using custom regular expressions to detect and sanitize PII, financial data, and other sensitive content.\n- Use built-in redaction presets to instantly identify and redact common patterns like phone numbers, email addresses, and URLs.\n- Comply with data protection laws such as GDPR, HIPAA, and CCPA by securely redacting personal and regulated data.\n- Redact PDF files automatically with custom rules or text matches to remove sensitive information at scale.\n- Automate the redaction and sanitization process to enhance workflow efficiency and reduce manual intervention, perfect for high-volume document processing.\n- Enhance data security by ensuring that redacted and sanitized information is permanently removed, safeguarding against unauthorized access and data breaches.","Securely remove sensitive data","Securely remove sensitive data from PDFs to protect privacy, ensure compliance, and prevent unauthorized information disclosure.","Why is pdfRest the best API to redact PDF text?","pdfRest offers the best solution for redacting PDF documents, because it combines trusted Adobe technology, flexible automation options, and advanced data sanitization for compliance.","redact-pdf-api","2025-04-23T18:39:53.179Z","2026-07-10T21:34:49.080Z","2025-08-27T20:16:49.335Z","2023-08-09T05:00:00.000Z","r06b2atyfz0w4lfz3j6kziu5",{"id":781,"name":782,"alternativeText":768,"caption":48,"width":348,"height":375,"formats":48,"hash":783,"ext":239,"mime":240,"size":784,"url":785,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":786,"updatedAt":786,"documentId":787,"publishedAt":247,"focalPoint":48},357,"redact-pdf.svg","redact_pdf_6dd37af9bd",4.36,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fredact_pdf_6dd37af9bd.svg","2025-04-23T19:10:30.691Z","yqm2nlyhxhl3lwx2z1jty2kx",{"id":789,"name":790,"tool_page_desc":791,"new_tool":124,"pro_tool":284,"header_blurb":792,"tool_card_desc":793,"youtube_url":48,"why_section_title":794,"why_section_desc":795,"slug":796,"createdAt":227,"updatedAt":797,"publishedAt":798,"publish_date":799,"rank":320,"cloud_only":284,"documentId":800,"icon":801},74,"TDM Reserve PDF","TDM Reserve PDF is a REST API tool that applies machine-readable TDMRep metadata to your documents to formally reserve your rights against unauthorized automated processing. Designed to support the W3C TDM Reservation Protocol, this tool enables content owners to clearly state their Text and Data Mining (TDM) policy, ensuring compliance with the EU CDSM Directive Article 4 and providing a standardized signal to AI crawlers and scrapers.\n## Key Benefits of TDM Reserve PDF API\n- Apply machine-readable \"opt-out\" signals to your PDF files to protect your intellectual property from unauthorized AI model training and automated data mining.\n- Ensure your digital assets comply with the EU Copyright in the Digital Single Market (CDSM) Directive by asserting TDM reservation rights as required by Article 4.\n- Use the policy parameter to embed a URL or custom string that directs scrapers and crawlers to your specific terms of use and mining restrictions.\n- Leverage the standardized W3C TDM Reservation Protocol (TDMRep) to ensure your document's protection is recognizable by modern, compliant web technologies.\n- Add a critical layer of security to your publishing pipeline by automatically injecting reservation metadata into every PDF before it is distributed or hosted online.\n- Protect your content with a simple, single-call API integration that eliminates the need for manual metadata editing or complex PDF internal restructuring.","Protect PDFs from AI mining","Protect PDFs from AI text and data mining by applying standardized TDM reservation metadata.","Why is pdfRest the best API to apply TDM reservations?","pdfRest offers the best solution for TDM reservations because it guarantees EU CDSM compliance, reliably injects machine-readable metadata, and provides straightforward, developer-focused policy controls.","tdm-reserve-pdf","2026-07-10T21:36:27.235Z","2026-04-24T19:36:26.165Z","2026-04-24T05:00:00.000Z","jt8jle4hq2ut9i3vp32pxd37",{"id":802,"name":803,"alternativeText":790,"caption":48,"width":399,"height":400,"formats":48,"hash":804,"ext":239,"mime":240,"size":805,"url":806,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":807,"updatedAt":808,"documentId":809,"publishedAt":247,"focalPoint":48},692,"tdm-reservation.svg","tdm_reservation_589def3185",6.5,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Ftdm_reservation_589def3185.svg","2026-04-23T22:07:23.048Z","2026-04-23T22:07:33.861Z","yq84fc8cbpz69ec1kuob2i1z",{"id":369,"name":811,"description":812,"createdAt":813,"updatedAt":814,"publishedAt":815,"rank":345,"documentId":816,"api_tools":817},"Extract","Extract text, data, images, and document details to collect information and drive conditional logic","2024-08-13T18:40:26.128Z","2025-09-29T20:42:02.887Z","2024-08-13T18:40:27.423Z","ddvn9rnnkkfe8n73trswzl87",[818,842,865,888,909],{"id":819,"name":820,"tool_page_desc":821,"new_tool":284,"pro_tool":124,"header_blurb":822,"tool_card_desc":823,"youtube_url":824,"why_section_title":825,"why_section_desc":826,"slug":827,"createdAt":828,"updatedAt":829,"publishedAt":830,"publish_date":610,"rank":48,"cloud_only":48,"documentId":831,"icon":832},20,"OCR PDF","OCR PDF is an advanced API tool designed to convert scanned documents and images within PDFs into searchable and extractable text using state-of-the-art Optical Character Recognition (OCR) technology. By leveraging OCR PDF, developers can transform static PDF documents into dynamic, searchable text PDFs, significantly enhancing document management processes.\n## Key Benefits of OCR PDF API\n- Accurately recognize and extract text from scanned PDF files, turning static image-based content into fully searchable and selectable text.\n- Integrate OCR tools directly into your development workflow with a flexible REST API that works across all major programming languages and operating systems.\n- Use OCR as a pre-processing step before text extraction, enabling reliable data retrieval from any PDF regardless of how it was created.\n- Convert scanned documents to editable formats like Word for easy editing, formatting, and repurposing of content.\n- Handle large volumes of image-based PDFs efficiently with batch-ready processing designed for enterprise document management.","Get searchable, extractable text from PDF images","Unlock searchable and extractable PDF text by applying OCR to embedded images.","https:\u002F\u002Fwww.youtube.com\u002Fembed\u002FCdxZMACFEXI?si=J4QbxZpH1CrDSbig","Why is pdfRest the best API to OCR PDF Documents?","pdfRest offers the best solution for applying OCR to PDF documents, because it generates searchable PDF files, supports image-based text extraction, and integrates easily with all projects.","ocr-pdf","2024-08-15T16:45:56.517Z","2026-07-10T21:37:18.967Z","2024-08-15T16:45:58.693Z","n2v85fbuwy3jijswma3d8gqd",{"id":833,"name":834,"alternativeText":820,"caption":48,"width":372,"height":400,"formats":835,"hash":836,"ext":239,"mime":240,"size":837,"url":838,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":839,"updatedAt":840,"documentId":841,"publishedAt":247,"focalPoint":48},78,"ocr-pdf.svg",{},"ocr_pdf_029bb8a80c",8.49,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Focr_pdf_029bb8a80c.svg","2024-08-15T16:40:55.146Z","2025-11-07T15:58:51.720Z","tnze0l8y1o92slargd4oxm5u",{"id":843,"name":844,"tool_page_desc":845,"new_tool":284,"pro_tool":284,"header_blurb":846,"tool_card_desc":847,"youtube_url":848,"why_section_title":849,"why_section_desc":850,"slug":851,"createdAt":852,"updatedAt":853,"publishedAt":854,"publish_date":294,"rank":48,"cloud_only":48,"documentId":855,"icon":856},21,"Extract Text","Extract Text is a REST API tool designed to efficiently extract text from PDF files, with options to include detailed style and positional information. Used as a powerful PDF to text converter, it gives developers and businesses a reliable online tool for streamlining data extraction and copying text content into applications, databases, and AI-driven workflows.\n## Key Benefits of Extract Text API\n- Extract text from PDFs with precision, capturing all content for further analysis or integration into databases and other systems.\n- Include optional style information, such as font type, size, and color, to preserve the original document's appearance in the extracted text.\n- Utilize positional data to maintain text layout and structure, essential for applications requiring exact text placement, such as digital archiving and document conversion.\n- Automate text extraction workflows to enhance efficiency and reduce manual data entry, perfect for high-volume document processing.\n- Enhance data accessibility by converting static PDF content into dynamic, usable data for business intelligence, compliance, and reporting purposes.\n- Supply large language models (LLM) with rich content from PDF archives, enabling advanced AI applications like natural language processing and sentiment analysis. Transform static documents into valuable data sources for AI-driven insights and decision-making.","Extract all text from PDFs","Extract all text from a PDF, optionally including style and position information.","https:\u002F\u002Fwww.youtube.com\u002Fembed\u002FX9REVAvOkQw","Why is pdfRest the best API to extract text from PDF?","pdfRest offers the best solution for extracting text from PDF documents, because it preserves positional data, includes text style information, and taps into data.","extract-text","2024-08-15T16:50:46.004Z","2026-07-10T21:37:41.113Z","2024-08-15T16:50:48.433Z","t50vz6ahj0hy3s5x5xs9u7zr",{"id":759,"name":857,"alternativeText":844,"caption":48,"width":858,"height":237,"formats":48,"hash":859,"ext":239,"mime":240,"size":860,"url":861,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":862,"updatedAt":863,"documentId":864,"publishedAt":247,"focalPoint":48},"extract-text.svg",125,"extract_text_9bb8fa32f1",8.15,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fextract_text_9bb8fa32f1.svg","2024-08-15T16:47:10.900Z","2024-08-15T16:47:32.142Z","e9ohhvg32e02gdslo6885xz0",{"id":866,"name":867,"tool_page_desc":868,"new_tool":284,"pro_tool":284,"header_blurb":869,"tool_card_desc":870,"youtube_url":871,"why_section_title":872,"why_section_desc":873,"slug":874,"createdAt":875,"updatedAt":876,"publishedAt":877,"publish_date":294,"rank":48,"cloud_only":48,"documentId":878,"icon":879},22,"Query PDF","Query PDF is a REST API tool that provides a programmatic way to retrieve a wide range of insights about a PDF document. It allows developers to check for conditional properties, metadata, and content details such as forms, fonts, security settings, and digital signatures. This tool is essential for conditional processing, enabling you to automate workflows and trigger subsequent actions based on a file’s unique characteristics.\n\n### Key Benefits of Query PDF API\n\n- Perform over 25 different queries in a single API call, including checks for document metadata, embedded fonts, and JavaScript, for a comprehensive overview of a PDF's properties.\n- Validate PDF\u002FA conformance with the industry-standard veraPDF validation engine, returning a simple true or false value for easy programmatic checks without complex reporting.\n- Automate workflows with conditional processing, saving time and resources by using file properties to determine if you need to apply OCR, convert to PDF\u002FA, or perform other operations.\n- Seamlessly audit page boundaries (MediaBox, CropBox, BleedBox, TrimBox, ArtBox) before making precise document dimension adjustments with the Set Page Boxes API.\n- Identify accessibility features by checking for the presence of structure tags, ensuring your documents meet compliance standards.\n- Retrieve and leverage custom metadata, returned as a JSON list of key:value pairs, enabling you to extract unique data properties added by other applications.\n- Extract key document information, including whether a file contains signatures, passwords, or forms (Acroforms or XFA), to drive secure and specialized workflows.","Get info and check for conditions","Get the facts to power your workflow - return detailed info about a PDF and its content to drive conditional processing.","https:\u002F\u002Fwww.youtube.com\u002Fembed\u002FV9gQT1lyCds","Why is pdfRest the best API to get info from PDF?","pdfRest offers the industry’s most efficient API for extracting PDF metadata and document properties, empowering you to drive conditional processing, validate industry-standard PDF\u002FA compliance, and run over 25 distinct queries in a single, lightning-fast call.","query-pdf","2024-08-15T17:03:12.991Z","2026-07-10T21:38:06.763Z","2024-08-15T17:03:14.852Z","ovui67x1sxfg3scjkhic67wj",{"id":880,"name":881,"alternativeText":867,"caption":48,"width":397,"height":687,"formats":48,"hash":882,"ext":239,"mime":240,"size":883,"url":884,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":885,"updatedAt":886,"documentId":887,"publishedAt":247,"focalPoint":48},80,"query-pdf.svg","query_pdf_e08ca961f2",5.51,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fquery_pdf_e08ca961f2.svg","2024-08-15T16:54:12.083Z","2024-08-15T16:54:22.255Z","hkf3hd3s4hbxjn5uvkhsflws",{"id":889,"name":890,"tool_page_desc":891,"new_tool":284,"pro_tool":284,"header_blurb":892,"tool_card_desc":893,"youtube_url":48,"why_section_title":894,"why_section_desc":895,"slug":896,"createdAt":897,"updatedAt":898,"publishedAt":899,"publish_date":230,"rank":48,"cloud_only":48,"documentId":900,"icon":901},30,"Extract Images","Extract Images is a REST API tool designed to efficiently extract all images from PDF documents. Developers can automate the retrieval of embedded graphics, ensuring quick and accurate extraction without altering the original PDF content.  \n## Key Benefits of Extract Images API\n- Automate image extraction to streamline workflows, eliminating the need for manual extraction in software like Acrobat.\n- Preserve image quality to ensure that extracted images maintain their original resolution and color accuracy.\n- Extract images in their native formats, such as JPEG, PNG, or TIFF, providing flexibility for further processing or analysis.\n- Enhance digital asset management by easily integrating extracted images into DAM systems.\n- Leverage extracted images to streamline content repurposing for marketing materials, presentations, and other creative projects.  ","Extract all images from PDFs","Extract images embedded in PDF documents to individual image files, preserving color, resolution, and format.","Why is pdfRest the best API to extract images from PDF?","pdfRest is the best API for extracting images from PDFs because it offers high-quality preservation, supports multiple formats, and integrates seamlessly into automated workflows.","extract-images","2024-11-19T15:46:02.001Z","2026-07-10T21:36:56.499Z","2024-12-17T17:25:39.699Z","wajlqvlo0fbqloqcmnr41mt3",{"id":902,"name":903,"alternativeText":48,"caption":48,"width":92,"height":375,"formats":48,"hash":904,"ext":239,"mime":240,"size":905,"url":906,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":907,"updatedAt":907,"documentId":908,"publishedAt":247,"focalPoint":48},215,"extract-images.svg","extract_images_f989d8b5f1",8.03,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fextract_images_f989d8b5f1.svg","2024-11-19T15:41:33.964Z","i49wmqbj6ktux4xysh7p2hc9",{"id":910,"name":911,"tool_page_desc":912,"new_tool":284,"pro_tool":284,"header_blurb":913,"tool_card_desc":914,"youtube_url":48,"why_section_title":915,"why_section_desc":916,"slug":917,"createdAt":918,"updatedAt":919,"publishedAt":920,"publish_date":921,"rank":48,"cloud_only":48,"documentId":922,"icon":923},35,"PDF to Markdown","PDF to Markdown is a REST API tool that converts PDF documents into clean, structured Markdown format, facilitating content repurposing and easy text manipulation. It empowers developers to accurately extract human-readable content while preserving document hierarchy, making PDFs easily consumable for content repurposing, data analysis, and LLM training.\n\n## Key Benefits of PDF to Markdown API\n- Convert complex PDFs into lightweight, plain-text Markdown, ideal for web content, documentation systems, or blog posts.\n- Extract structured content from PDFs, accurately preserving headings, lists, tables, and other formatting elements in an easily parseable format.\n- Simplify PDF content for easier management and version control in text-based systems like Git.\n- Enable advanced data processing, LLM training, and analysis by providing clean, semantic text extracted from PDFs for AI, NLP, or search indexing.\n- Support accessibility initiatives by transforming inaccessible PDF content into universally readable Markdown.\n- Automate large-scale PDF to Markdown conversions, streamlining workflows for content migration or dynamic publishing.","Extract Structured Content from PDFs","Transforms PDF documents into clean, structured Markdown, making content easily extractable for repurposing, analysis, and LLM training.","Why is pdfRest the best API to convert PDF to Markdown?","pdfRest offers the best solution for PDF to Markdown conversion, because it delivers accurate content extraction, preserves structural integrity, and enables flexible content repurposing for modern applications.","pdf-to-markdown-api","2025-07-09T20:42:56.960Z","2026-08-05T15:03:15.720Z","2025-07-11T21:53:55.683Z","2025-07-11T05:00:00.000Z","bx8g2gmotxivn9aoky69h6i0",{"id":924,"name":925,"alternativeText":926,"caption":48,"width":185,"height":375,"formats":48,"hash":927,"ext":239,"mime":240,"size":928,"url":929,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":930,"updatedAt":931,"documentId":932,"publishedAt":247,"focalPoint":48},414,"pdf-to-markdown.svg","PDF to Markdown API Tool","pdf_to_markdown_4fcfb1f15e",10.41,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fpdf_to_markdown_4fcfb1f15e.svg","2025-07-09T21:17:57.306Z","2025-07-10T21:24:18.613Z","ms9hfna1itl2y0rxkklzka2b",{"id":320,"name":934,"description":935,"createdAt":936,"updatedAt":937,"publishedAt":938,"rank":369,"documentId":939,"api_tools":940},"Modify","Apply changes to PDF content with this suite of modification tools","2024-08-13T18:39:58.837Z","2025-09-29T20:42:10.221Z","2024-08-13T18:40:00.335Z","l00w5wlfgz8uh23fptajvkl0",[941,964,987,1010,1032],{"id":858,"name":942,"tool_page_desc":943,"new_tool":284,"pro_tool":284,"header_blurb":944,"tool_card_desc":945,"youtube_url":946,"why_section_title":947,"why_section_desc":948,"slug":949,"createdAt":950,"updatedAt":951,"publishedAt":952,"publish_date":294,"rank":295,"cloud_only":48,"documentId":953,"icon":954},"Add to PDF","Add to PDF is a REST API tool designed to add new content to PDF documents, including text, images, lines, rectangles, tables, and file attachments. Developers can use it to enhance existing PDFs without disrupting underlying content, or pair it with Create Blank PDF to generate new PDFs from scratch for invoices, reports, statements, forms, and other data-driven documents.\n## Key Benefits of Add to PDF API\n- Automate PDF content creation and enhancement workflows, eliminating the need for manual editing in Acrobat, Illustrator, or other software.\n- Pair with Create Blank PDF to generate new documents from application data, including invoices, reports, statements, forms, and other structured PDFs.\n- Place text, images, lines, rectangles, and tables with coordinate-level control, making it easier to align inserted content with exact page layouts.\n- Build structured PDF tables with headers, footers, merged cells, styling, image cells, and multi-page overflow support for data-driven documents.\n- Customize text insertion for both LTR and RTL languages with font, size, color, rotation, opacity, maximum width, wrapping, and placement controls.\n- Add optional structure tags for newly inserted text, images, shapes, and tables to support more structured generated or enhanced PDF output.\n- Attach source files, XML data, spreadsheets, or supporting documents directly within a PDF for e-invoicing, archival, and compliance workflows.","Insert tables, text, images, shapes, attachments","Insert tables, text, images, and shapes into a PDF with precise positioning while preserving the original content, and attach files, including XML and other formats.","https:\u002F\u002Fwww.youtube.com\u002Fembed\u002FXABYfB9b1_0","Why is pdfRest the best API to add content to PDF?","pdfRest offers a flexible API for adding text, images, shapes, tables, and attachments to PDF documents. It supports precise positioning, variable data workflows, structured table insertion, optional tags for newly added content, and PDF Generation workflows when paired with Create Blank PDF.","add-to-pdf","2024-08-15T16:18:30.403Z","2026-09-18T16:28:52.626Z","2026-09-18T16:28:54.474Z","ysclnvjn2upu6nv6daetg4hz",{"id":249,"name":955,"alternativeText":956,"caption":48,"width":957,"height":237,"formats":48,"hash":958,"ext":239,"mime":240,"size":959,"url":960,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":961,"updatedAt":962,"documentId":963,"publishedAt":247,"focalPoint":48},"add-to-pdf.svg","Add to PDF Logo",121,"add_to_pdf_9917f410ab",5.62,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fadd_to_pdf_9917f410ab.svg","2024-08-15T16:11:15.697Z","2024-08-15T16:11:39.908Z","fonwbccct3f9dvnn7ibyhcx1",{"id":965,"name":966,"tool_page_desc":967,"new_tool":284,"pro_tool":284,"header_blurb":968,"tool_card_desc":969,"youtube_url":48,"why_section_title":970,"why_section_desc":971,"slug":972,"createdAt":973,"updatedAt":974,"publishedAt":975,"publish_date":294,"rank":320,"cloud_only":48,"documentId":976,"icon":977},15,"Merge PDFs","Merge PDFs is a REST API tool that joins together any number of full PDF files or specified pages from separate documents into a consolidated PDF. It's designed to provide developers with precise control over document assembly, enabling the programmatic merging of PDF files to create organized, streamlined, and optimized consolidated documents for various applications.\n## Key Benefits of Merge PDFs API\n- Produce optimized output by ensuring merged PDF files are free of unnecessary \"bloat,\" resulting in smaller file sizes and faster user experiences for transfers and viewing.\n- Assemble your perfect document with flexible page range selection, allowing you to choose specific pages or ranges from multiple input PDFs and arrange them in any desired order.\n- Support sophisticated document compilation workflows, such as extracting specific chapters from different reports or combining legal documents with precise page control.\n- Level up with chainable API calls, allowing you to merge various file types (e.g., Word, Excel, images, HTML) into a single PDF by first converting them and then seamlessly merging their outputs without re-uploading.\n- Expedite report compilation and other document assembly tasks by automating the process of combining diverse PDF content into a single, cohesive file.\n- Enhance document management by creating consolidated PDFs that are easier to store, distribute, and access, improving overall organizational efficiency.","Combine whole PDFs or page ranges","Combine multiple PDF documents or pages into one consolidated PDF.\n\n","Why is pdfRest the best API to merge PDF files?","pdfRest offers the best solution for merging multiple PDF documents together, because it produces optimized output, supports flexible page ranges, and can be combined with conversion to merge files of other formats.","merge-pdfs","2024-08-15T16:22:46.662Z","2026-07-10T21:40:04.065Z","2024-08-15T16:22:56.699Z","ke8rhxnq4lsb5t4tlsk1pl1c",{"id":978,"name":979,"alternativeText":966,"caption":48,"width":980,"height":375,"formats":48,"hash":981,"ext":239,"mime":240,"size":982,"url":983,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":984,"updatedAt":985,"documentId":986,"publishedAt":247,"focalPoint":48},73,"merge-pdfs.svg",147,"merge_pdfs_028d9c9ff5",7.81,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fmerge_pdfs_028d9c9ff5.svg","2024-08-15T16:19:24.527Z","2024-08-15T16:19:39.411Z","z554wdjfbc4krjnvydptaplq",{"id":988,"name":989,"tool_page_desc":990,"new_tool":284,"pro_tool":284,"header_blurb":991,"tool_card_desc":992,"youtube_url":993,"why_section_title":994,"why_section_desc":995,"slug":996,"createdAt":997,"updatedAt":998,"publishedAt":999,"publish_date":294,"rank":345,"cloud_only":48,"documentId":1000,"icon":1001},16,"Split PDF","Split PDF is a REST API tool that gives developers precise control over document content by separating a single PDF file into multiple new documents. Use it to split PDF files by page range, extract specific sections, or automate document workflows at scale. This versatile tool is ideal for breaking down large documents into smaller, more manageable files for easier distribution, archiving, or processing. Whether you need to extract specific pages, delete unwanted content, or reorder pages, the Split PDF API provides the flexibility to meet your workflow needs.\n\n### Key Benefits of Split PDF API\n\n- Split PDFs with flexible page ranges, allowing you to specify individual pages, page ranges (e.g., 1-10), or even keywords like even or odd for precise control.\n- Extract or delete pages from a document by defining a page range for a single output file — one of the most useful PDF tools for managing and sanitizing document content.\n- Reorder or duplicate pages by listing page numbers in your desired sequence, enabling you to rearrange or repeat content as needed.\n- Create multiple new documents with a single API call by defining each output file, providing an efficient way to handle complex splitting tasks.\n- Optimize new files by automatically removing unused content from the original document, ensuring the output files are as small and efficient as possible.\n- Automate document management workflows for tasks like archiving large reports, isolating legal contracts, or separating chapters of a book for publishing.","Split a PDF into multiple output files","Split a single PDF document into one or more PDF documents with exactly the pages you need.","https:\u002F\u002Fwww.youtube.com\u002Fembed\u002FGOxSDafBb3Q","Why is pdfRest the best API to split PDF?","pdfRest offers the best solution for splitting a PDF input into multiple PDF outputs, because it supports flexible page ranges, optimized content, and deleting or exporting pages.","split-pdf","2024-08-15T16:24:51.290Z","2026-07-10T21:40:27.334Z","2024-08-15T16:27:17.095Z","cpoqkgryfsnab76sdlnv15v9",{"id":789,"name":1002,"alternativeText":989,"caption":48,"width":1003,"height":375,"formats":48,"hash":1004,"ext":239,"mime":240,"size":1005,"url":1006,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":1007,"updatedAt":1008,"documentId":1009,"publishedAt":247,"focalPoint":48},"split-pdf.svg",155,"split_pdf_378760c4c6",7.76,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fsplit_pdf_378760c4c6.svg","2024-08-15T16:23:25.518Z","2024-08-15T16:23:41.859Z","hrt65mecnhczujhjlfbg0l58",{"id":1011,"name":1012,"tool_page_desc":1013,"new_tool":284,"pro_tool":284,"header_blurb":1014,"tool_card_desc":1015,"youtube_url":48,"why_section_title":1016,"why_section_desc":1017,"slug":1018,"createdAt":1019,"updatedAt":1020,"publishedAt":1021,"publish_date":1022,"rank":369,"cloud_only":48,"documentId":1023,"icon":1024},33,"Set Page Boxes","Set Page Boxes is a REST API tool that allows precise control over PDF page boundaries, enabling developers to set or edit the MediaBox (page size), CropBox (visible content area for cropping PDF and removing white space), BleedBox (extra margin for professional printing with bleed), TrimBox (final printed page dimensions), and ArtBox (boundary of the artwork or content).\n\n## Key Benefits of Set Page Boxes API\n- Offers granular control over PDF page dimensions by allowing users to set or modify the MediaBox, CropBox, BleedBox, TrimBox, and ArtBox.\n- Crop PDF files by setting the CropBox to focus on essential content and remove unwanted white space for cleaner viewing and printing.\n- Control the overall dimensions of your PDF by setting the MediaBox, allowing you to resize PDF pages.\n- Configure the BleedBox to extend content beyond the TrimBox, ensuring accurate trimming and eliminating white edges in professionally printed documents.\n- Set the TrimBox to specify the intended final dimensions of the printed page after it has been cut.\n- Use the ArtBox to define the precise boundaries of the artwork or meaningful visual elements on the page, crucial for design and prepress workflows.","Set PDF page boundary boxes","Set or edit PDF page boundary box values for MediaBox, CropBox, BleedBox, TrimBox, and ArtBox.","Why is pdfRest the best API to set PDF page boundary boxes?","pdfRest provides the best API to set PDF page boundary boxes because it offers precise control over all five box types (MediaBox, CropBox, BleedBox, TrimBox, ArtBox), leverages advanced PDF technology for accuracy, and enables seamless integration for automated workflows.","set-page-boxes","2025-05-27T19:54:27.197Z","2026-07-10T21:40:57.166Z","2025-05-28T21:12:41.077Z","2025-11-21T06:00:00.000Z","cavyxet54k196c49ftemgysr",{"id":1025,"name":1026,"alternativeText":1012,"caption":48,"width":323,"height":237,"formats":48,"hash":1027,"ext":239,"mime":240,"size":1028,"url":1029,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":1030,"updatedAt":1030,"documentId":1031,"publishedAt":247,"focalPoint":48},399,"set-page-boxes.svg","set_page_boxes_399944da86",7.69,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fset_page_boxes_399944da86.svg","2025-05-27T18:29:39.917Z","i1ypu8muxiyb6coxov8tt6zq",{"id":1033,"name":1034,"tool_page_desc":1035,"new_tool":284,"pro_tool":284,"header_blurb":1036,"tool_card_desc":1037,"youtube_url":48,"why_section_title":1038,"why_section_desc":1039,"slug":1040,"createdAt":950,"updatedAt":1041,"publishedAt":1042,"publish_date":230,"rank":5,"cloud_only":48,"documentId":1043,"icon":1044},119,"Create Blank PDF","Create Blank PDF is a REST API tool designed to generate new, empty PDF documents with precise page size and page count specifications. As a simple yet vital utility, it serves as the foundational first step in workflows where developers need to programmatically generate PDFs by filling this blank slate text, images, and other content.\n\n## Key Benefits of Create Blank PDF API\n\n- Facilitate dynamic PDF generation workflows by creating a blank document ready to be programmatically filled with content via the Add to PDF tool.\n- Precisely define the dimensions and orientation of the new document using standard sizes (e.g., Letter, A4) or custom measurements.\n- Avoid template storage and management by generating a simple blank canvas instantly, eliminating the need to upload and process static template files.\n- Simplify complex document creation workflows by separating the blank file generation from the content placement step.\n- Ensure document consistency by defining a standard template size and orientation for all subsequently generated content.","Create a blank PDF with custom page specifications","Generate new, empty PDF documents with precise control over page size, orientation, and page count, serving as a clean foundation for content generation workflows.","Why is pdfRest the best API to create blank PDF documents?","pdfRest offers the best solution for creating blank PDF documents because it provides precise control over document dimensions, ensures seamless compatibility with subsequent modification steps, and accelerates programmatic content generation.","create-blank-pdf","2026-09-04T05:31:02.130Z","2026-09-04T05:31:03.826Z","iuzct8ivuzipwsqssi7mxhei",{"id":1045,"name":1046,"alternativeText":1047,"caption":48,"width":399,"height":400,"formats":48,"hash":1048,"ext":239,"mime":240,"size":1049,"url":1050,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":1051,"updatedAt":1052,"documentId":1053,"publishedAt":247,"focalPoint":48},679,"create-blank-pdf.svg","Create Blank PDF API Tool","create_blank_pdf_bc88149c38",4.58,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fcreate_blank_pdf_bc88149c38.svg","2025-11-21T20:02:16.110Z","2025-11-21T20:02:30.029Z","ejg018im1qtfv6zbpdoccabs",{"id":345,"name":1055,"description":1056,"createdAt":1057,"updatedAt":1058,"publishedAt":1059,"rank":394,"documentId":1060,"api_tools":1061},"Forms","Process all PDF forms, including static and dynamic XFA and AcroForms","2024-08-13T18:40:13.083Z","2025-09-29T20:42:18.033Z","2024-08-13T18:40:14.259Z","vc2pcm39zmox1fvotebqr946",[1062,1084,1106,1129],{"id":1063,"name":1064,"tool_page_desc":1065,"new_tool":284,"pro_tool":124,"header_blurb":1066,"tool_card_desc":1067,"youtube_url":1068,"why_section_title":1069,"why_section_desc":1070,"slug":1071,"createdAt":1072,"updatedAt":1073,"publishedAt":1074,"publish_date":294,"rank":48,"cloud_only":48,"documentId":1075,"icon":1076},17,"Flatten Forms","Flatten Forms is a REST API tool designed to lock and preserve PDF form field values, converting Acroform and XFA files into standard, non-editable PDF documents. This ensures maximum compatibility across all PDF viewers and platforms, making it an essential tool for businesses and developers looking to streamline document workflows and enhance data security.\n## Key Benefits of Flatten Forms API\n- Lock form fields to prevent unauthorized edits, ensuring the integrity and authenticity of your documents.\n- Convert interactive forms into static PDFs, eliminating compatibility issues with different PDF readers and ensuring access for all users.\n- Seamlessly process Static XFA, Dynamic XFA, and Acroforms, making it ideal for diverse document management needs.\n- Automate the flattening process to enhance efficiency and reduce manual intervention, perfect for high-volume document processing.\n- Preserve the visual appearance and data integrity of forms, making them suitable for legal, compliance, print, and archival purposes.","Lock data and maximize compatibility","Preserve and lock PDF form field values, make forms no longer editable, and convert Acroform and XFA files into standard PDF files.","https:\u002F\u002Fwww.youtube.com\u002Fembed\u002F--WcisYKttU","Why is pdfRest the best API to flatten PDF forms?","pdfRest offers the best solution for flattening PDF forms, because it preserves form field values, supports XFA and Acroforms, and maximizes compatibility.","flatten-forms","2024-08-15T16:30:45.372Z","2026-07-10T21:50:47.187Z","2024-08-15T16:30:47.642Z","w6fcdt29smep2qmsij1ls6pa",{"id":237,"name":1077,"alternativeText":1064,"caption":48,"width":281,"height":397,"formats":48,"hash":1078,"ext":239,"mime":240,"size":1079,"url":1080,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":1081,"updatedAt":1082,"documentId":1083,"publishedAt":247,"focalPoint":48},"flatten-forms.svg","flatten_forms_994c0d2c6a",15.23,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fflatten_forms_994c0d2c6a.svg","2024-08-15T16:28:31.980Z","2024-08-15T16:28:39.138Z","exy8ggo4l4nl5ju77d65udcw",{"id":1085,"name":1086,"tool_page_desc":1087,"new_tool":284,"pro_tool":124,"header_blurb":1088,"tool_card_desc":1089,"youtube_url":1090,"why_section_title":1091,"why_section_desc":1092,"slug":1093,"createdAt":1094,"updatedAt":1095,"publishedAt":1096,"publish_date":294,"rank":48,"cloud_only":48,"documentId":1097,"icon":1098},18,"Import Form Data","Import Form Data is a REST API tool designed to support programmatic PDF form filling by importing data from external data files into Acroforms, static XFA, and dynamic XFA.\n## Key Benefits of Import Form Data API\n- Built upon the foundation of Adobe's PDF forms technology, ensuring robust and reliable form filling capabilities.\n- Offers unmatched support for dynamic XFA files, in addition to static XFA and Acroforms, providing unparalleled flexibility for complex forms.\n- Seamlessly imports data from external files to automatically populate PDF form fields, eliminating manual data entry.\n- Facilitates the programmatic filling of PDF forms, minimizing errors associated with manual input and ensuring data accuracy.\n- Easily integrates with existing applications and workflows to automate document generation and data management processes.","Import data from external file into PDF form fields","Import values into PDF form fields from an external data file for both XFA forms and Acroforms.","https:\u002F\u002Fwww.youtube.com\u002Fembed\u002FD-V-vMqkd-c","Why is pdfRest the best API to fill PDF forms with data?","pdfRest offers the best solution for importing data into PDF forms, because it supports automated form filling, comprehensive XFA forms and Acroform compatibility, and robust data protection for professional results.","import-form-data","2024-08-15T16:35:38.553Z","2026-08-05T14:54:20.653Z","2024-08-15T16:35:40.609Z","nnfp9h2wzgk9vwqtnxfefvnw",{"id":375,"name":1099,"alternativeText":1086,"caption":48,"width":236,"height":375,"formats":48,"hash":1100,"ext":239,"mime":240,"size":1101,"url":1102,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":1103,"updatedAt":1104,"documentId":1105,"publishedAt":247,"focalPoint":48},"import-form-data.svg","import_form_data_381722dd2e",7.41,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fimport_form_data_381722dd2e.svg","2024-08-15T16:31:46.212Z","2024-08-15T16:31:54.236Z","b4itrtuvfqc8zpbtvfhlyopk",{"id":1107,"name":1108,"tool_page_desc":1109,"new_tool":284,"pro_tool":124,"header_blurb":1110,"tool_card_desc":1111,"youtube_url":1112,"why_section_title":1113,"why_section_desc":1114,"slug":1115,"createdAt":1116,"updatedAt":1117,"publishedAt":1118,"publish_date":294,"rank":48,"cloud_only":48,"documentId":1119,"icon":1120},19,"Export Form Data","Export Form Data is a REST API tool that extracts values from PDF form fields and exports them to external data files for Acroforms, static XFA, and dynamic XFA.\n## Key Benefits of Export Form Data API\n- Efficiently extract data from filled PDF forms, regardless of their complexity or underlying technology, into easily manageable external data files.\n- Reliably exports data from Acroforms, static XFA, and dynamic XFA forms for complete coverage of PDF form types.\n- Enables seamless integration of extracted form data into databases and other services for streamlined data management and analysis.\n- Built with the robust foundation of Adobe's PDF forms technology, ensuring accurate and dependable data extraction.\n- Included in the enterprise-grade PDF Forms Pro toolkit, designed for demanding PDF forms processing and complex automated workflows.\n\n","Export data from PDF form fields to external file","Export values from PDF form fields to an external data file for both XFA forms and Acroforms.","https:\u002F\u002Fwww.youtube.com\u002Fembed\u002FFCWVHfkmn4s","Why is pdfRest the best API to export PDF form data?","pdfRest offers the best solution for exporting data from filled PDF forms, because it supports data aggregation, XFA forms and Acroforms, and professional results.","export-form-data","2024-08-15T16:39:42.481Z","2026-08-05T14:55:29.369Z","2024-08-15T16:39:47.970Z","pzhwjkrmhd4khcemmebl81cv",{"id":1121,"name":1122,"alternativeText":1108,"caption":48,"width":236,"height":375,"formats":48,"hash":1123,"ext":239,"mime":240,"size":1124,"url":1125,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":1126,"updatedAt":1127,"documentId":1128,"publishedAt":247,"focalPoint":48},77,"export-form-data.svg","export_form_data_6a7b74f8fc",7.47,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fexport_form_data_6a7b74f8fc.svg","2024-08-15T16:36:13.475Z","2024-08-15T16:36:20.869Z","rr1czsbfllqg9w2eelckeyv2",{"id":1130,"name":1131,"tool_page_desc":1132,"new_tool":284,"pro_tool":124,"header_blurb":1133,"tool_card_desc":1134,"youtube_url":1135,"why_section_title":1136,"why_section_desc":1137,"slug":1138,"createdAt":1139,"updatedAt":1140,"publishedAt":1141,"publish_date":230,"rank":48,"cloud_only":48,"documentId":1142,"icon":1143},29,"XFA to Acroforms","XFA to Acroforms is a REST API tool designed to convert PDF forms from Static XFA or Dynamic XFA to Acroforms using the highest-quality Adobe technology. By converting to Acroforms, developers can ensure PDF forms are highly compatible with forms processing tools and workflows.\n## Key Benefits of XFA to Acroforms API\n- Converting XFA to Acroforms can help streamline workflows by ensuring compatibility with downstream processes.\n- Support Legacy System Modernization by migrating to Acroforms and future-proofing against declining XFA support.\n- While \"XFA form cannot be edited\" errors are common, Acroforms offer a more consistent and user-friendly experience.\n- Acroforms often adhere more closely to PDF standards, ensuring better compliance with industry regulations.\n- Acroforms offer better accessibility features, making them easier to use for individuals with disabilities.\n- Acroforms are generally easier to manage and edit compared to XFA forms, reducing maintenance efforts.","Convert XFA forms to widely supported Acroforms","Convert PDF forms from Static XFA or Dynamic XFA to Acroforms for expanded compatibility with forms processing tools and workflows.","https:\u002F\u002Fwww.youtube.com\u002Fembed\u002FKGflmj30DA4","Why is pdfRest the best API to Convert XFA to Acroforms?","pdfRest offers the best solution for converting XFA forms to Acroforms, because it preserves form fidelity, offers instant online validation, and removes compatibility issues associated with the XFA format.  ","xfa-to-acroforms","2024-09-17T15:30:07.362Z","2026-07-10T21:41:24.447Z","2024-09-17T15:33:23.322Z","gjb3owl3eqetep5zgm7racf9",{"id":1144,"name":1145,"alternativeText":1131,"caption":48,"width":96,"height":375,"formats":48,"hash":1146,"ext":239,"mime":240,"size":1147,"url":1148,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":1149,"updatedAt":1150,"documentId":1151,"publishedAt":247,"focalPoint":48},96,"xfa-to-acroforms.svg","xfa_to_acroforms_ca251cf707",15.27,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fxfa_to_acroforms_ca251cf707.svg","2024-09-17T16:05:54.557Z","2024-09-17T16:06:06.162Z","ddqfkoqq3ay4dwv9eyyk0lfr",{"id":419,"name":1153,"description":1154,"createdAt":1155,"updatedAt":1156,"publishedAt":1157,"rank":419,"documentId":1158,"api_tools":1159},"Simplify","Build simple, streamlined workflows with these flexible utility tools","2024-08-13T18:40:55.809Z","2025-09-29T20:42:31.285Z","2024-08-13T18:40:57.148Z","ebzkwrxnvvcxdp9p0i5vfoxi",[1160,1181,1202,1225],{"id":1161,"name":1162,"tool_page_desc":1163,"new_tool":284,"pro_tool":284,"header_blurb":1164,"tool_card_desc":1165,"youtube_url":48,"why_section_title":1166,"why_section_desc":1167,"slug":1168,"createdAt":1169,"updatedAt":1170,"publishedAt":1171,"publish_date":294,"rank":48,"cloud_only":48,"documentId":1172,"icon":1173},26,"Upload Files","The Upload Files API is a flexible tool that simplifies how developers get files onto the pdfRest server for processing. While it is an optional step, this tool is ideal for pre-processing by enabling you to upload one or more files from your local storage or directly from a public URL. By using the Upload Files API, you can replace more complex multipart\u002Fform-data requests with simpler single-part JSON payloads for subsequent processing calls.\n\n### Key Benefits of Upload Files API\n\n* Streamline API requests by pre-uploading files and using a simple resource ID in subsequent calls, avoiding the need for complex multipart\u002Fform-data payloads.\n* Upload multiple files at once from local storage or public URLs, providing an efficient way to transfer and manage a batch of files in a single request.\n* Conveniently upload files from a public URL, a feature unique to this tool that simplifies workflows by directly fetching files from an external source.\n* Maintain data security and privacy with robust GDPR and HIPAA compliance, ensuring your files are encrypted and processed securely.\n* Simplify file management with an intuitive JSON response that associates each uploaded file's original name with a unique resource ID for easy tracking.\n* Support for flexible upload methods, including single-part binary payloads for individual files and multipart\u002Fform-data for multiple files.","Upload files with flexible options","Upload multiple files at once from local storage or public URL for convenient transfers prior to processing.","Why does pdfRest API offer the most convenient file uploads?","pdfRest offers the best solution for uploading files for processing, because it supports multiple files at once, upload from URL, and intuitive responses for easy resource tracking.","upload-files","2024-08-15T17:28:33.279Z","2025-09-17T21:38:25.843Z","2024-08-15T17:28:52.675Z","pud8sq3owma6mh11lnbhpuhn",{"id":400,"name":1174,"alternativeText":1162,"caption":48,"width":372,"height":237,"formats":48,"hash":1175,"ext":239,"mime":240,"size":1176,"url":1177,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":1178,"updatedAt":1179,"documentId":1180,"publishedAt":247,"focalPoint":48},"upload-files.svg","upload_files_5b876cd91c",4.01,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fupload_files_5b876cd91c.svg","2024-08-15T17:27:12.595Z","2024-08-15T17:27:21.424Z","ytvm7mhlr56k59ehjzg5uxap",{"id":1182,"name":1183,"tool_page_desc":1184,"new_tool":284,"pro_tool":284,"header_blurb":1185,"tool_card_desc":1186,"youtube_url":48,"why_section_title":1187,"why_section_desc":1188,"slug":1189,"createdAt":1190,"updatedAt":1191,"publishedAt":1192,"publish_date":294,"rank":48,"cloud_only":48,"documentId":1193,"icon":1194},27,"Zip Files","Zip Files is a REST API tool designed to streamline file management by compressing and extracting files. It allows developers to compress multiple uploaded or processed files into a single Zip archive for convenient download or extract files from .zip archives, including those protected by passwords.  \n## Key Benefits of Zip Files API\n- Simplify the handling of multiple files by compressing them into a single Zip archive, making storage and transfer more efficient.\n- Unlock protected .zip archives using a password, ensuring you can access and manage secured files without hassle.\n- Integrate zipping and unzipping operations into automated workflows, reducing the need for manual file handling.\n- Package multiple files into a single archive for easy distribution, whether for sharing with clients or archiving project files.\n- Seamlessly incorporate the Zip and Unzip Files tool into existing systems, supporting a wide range of use cases.","Zip processed files for easy downloads","Compress multiple files into a single Zip for easy download, or extract files from a .zip archive to access and process them individually.","Why is pdfRest the best API to Zip files?","pdfRest offers the best solution for zipping files together, because it supports convenience, all file types, and easy development.","zip-files","2024-08-15T17:31:52.169Z","2025-09-10T19:45:28.046Z","2024-08-15T17:31:54.117Z","dnkaxk3gi1e16vvgola3c053",{"id":1195,"name":1196,"alternativeText":1183,"caption":48,"width":298,"height":237,"formats":48,"hash":1197,"ext":239,"mime":240,"size":713,"url":1198,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":1199,"updatedAt":1200,"documentId":1201,"publishedAt":247,"focalPoint":48},85,"zip-files.svg","zip_files_d581f52e92","https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fzip_files_d581f52e92.svg","2024-08-15T17:32:20.904Z","2024-08-15T17:32:30.183Z","tzwrt7ryn6ztfztlxvk3ki2f",{"id":1203,"name":1204,"tool_page_desc":1205,"new_tool":284,"pro_tool":284,"header_blurb":1206,"tool_card_desc":1207,"youtube_url":48,"why_section_title":1208,"why_section_desc":1209,"slug":1210,"createdAt":1211,"updatedAt":1212,"publishedAt":1213,"publish_date":610,"rank":48,"cloud_only":124,"documentId":1214,"icon":1215},28,"API Polling","API Polling is a REST API tool that supports asynchronous monitoring for the status of requests sent to any pdfRest endpoint. It's designed to give developers granular control over long-running PDF processing tasks, ensuring workflow flexibility and preventing front-end timeouts for even the most complex operations.\n## Key Benefits of API Polling\n- Avoid timeouts by getting an instant requestId response, especially for complex PDF conversions or advanced document optimizations.\n- Enhance workflow flexibility by designing robust asynchronous workflows, initiating multiple PDF processing tasks concurrently without waiting for each to complete.\n- Gain granular status monitoring using the requestId to check the progress of any pdfRest API call at your own pace, enabling efficient application management.\n- Enjoy universal compatibility by seamlessly integrating API polling with all pdfRest tools, simplifying development and promoting consistent code reusability across your projects.\n- Optimize efficient resource management by allowing your application to move on to other tasks while waiting for PDF job completion.\n- Ensure reliable asynchronous processing for time-consuming PDF automation workflows without blocking your main application thread.","Poll for request statuses","Asynchronously poll for status of requests sent to any pdfRest endpoint for flexible workflow control that avoids timeouts","Why pdfRest for API Polling?","pdfRest offers the best solution for polling request statuses, because it prevents timeouts, offers workflow flexibility, and is universally supported across the toolkit.","api-polling","2024-08-15T17:35:48.465Z","2026-08-05T03:00:33.495Z","2024-08-15T17:36:40.731Z","rmfpfeem8uzb37t0cdg0gooo",{"id":1216,"name":1217,"alternativeText":1204,"caption":48,"width":1218,"height":1195,"formats":48,"hash":1219,"ext":239,"mime":240,"size":1220,"url":1221,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":1222,"updatedAt":1223,"documentId":1224,"publishedAt":247,"focalPoint":48},86,"api-polling.svg",93,"api_polling_122863dce8",7.64,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fapi_polling_122863dce8.svg","2024-08-15T17:33:13.922Z","2024-10-21T16:53:49.385Z","fe1uamh2xt9ko2d8112ygnef",{"id":424,"name":1226,"tool_page_desc":1227,"new_tool":284,"pro_tool":284,"header_blurb":1228,"tool_card_desc":1229,"youtube_url":48,"why_section_title":1230,"why_section_desc":1231,"slug":1232,"createdAt":1233,"updatedAt":1234,"publishedAt":1235,"publish_date":1236,"rank":48,"cloud_only":48,"documentId":1237,"icon":1238},"Delete Files","Delete Files is a REST API tool that gives developers full control over their file lifecycle by enabling the immediate, permanent deletion of uploaded or generated files. While all files are automatically removed after a brief retention period, this tool serves as an optional helper for users who need to explicitly and securely delete sensitive data at any time, ensuring compliance and enhancing privacy.\n\n### Key Benefits of Delete Files API\n\n- Permanently delete files before the default file retention period, ensuring sensitive data is removed instantly and with no copies archived.\n- Streamline security and compliance workflows for tasks involving confidential data, such as PII redaction, encryption, or watermarking.\n- Exercise granular control over file management by deleting individual files using a specific resource ID.\n- Automate file cleanup at scale with the option to perform batch deletions, removing multiple files with a single API call.\n- Enhance data privacy with a secure deletion process that verifies file ownership via your API key, safeguarding your files from unauthorized access.\n- Simplify your integration with a straightforward, easy-to-use tool that fits seamlessly into your existing PDF processing workflows.","Delete files on-demand","Immediately and permanently delete uploaded or generated files to take full control of the data lifecycle.","Why does pdfRest offer the best API for deleting files?","pdfRest offers the best solution for deleting files, because it enables on-demand deletion, supports individual and batch operations, and offers enterprise-grade security.","delete-files","2025-09-17T21:16:49.822Z","2026-04-24T14:55:51.210Z","2025-09-19T22:00:08.254Z","2025-09-17T05:00:00.000Z","gyveemixg5f8cs5p81c8c0fs",{"id":1239,"name":1240,"alternativeText":1241,"caption":48,"width":422,"height":880,"formats":48,"hash":1242,"ext":239,"mime":240,"size":1243,"url":1244,"previewUrl":48,"provider":243,"provider_metadata":48,"createdAt":1245,"updatedAt":1246,"documentId":1247,"publishedAt":247,"focalPoint":48},582,"delete-files.svg","Delete Files API Tool","delete_files_63f748cd95",4.69,"https:\u002F\u002Fenergized-actor-82099f85fb.media.strapiapp.com\u002Fdelete_files_63f748cd95.svg","2025-09-17T19:50:52.993Z","2025-09-17T19:52:24.246Z","l191zdc6fx0jb8ti6dvq0xd0",{},[1250,1327,1365,1451,1509,1575,1628,1682,1715,1753,1823,1867,1948,2038,2112,2198,2248],{"id":1251,"uuid":1252,"title":1253,"slug":1254,"html":1255,"comment_id":1256,"feature_image":48,"featured":284,"visibility":1257,"created_at":1258,"updated_at":1259,"published_at":1260,"custom_excerpt":48,"codeinjection_head":1261,"codeinjection_foot":48,"custom_template":48,"canonical_url":1262,"authors":1263,"tags":1269,"primary_author":1321,"primary_tag":1322,"url":1323,"excerpt":1324,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":1325,"meta_description":1326,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b12db","04d85677-8f8a-4ca5-a399-6433fcc459e4","Artificial Intelligence (AI)","artificial-intelligence-ai-hub","\u003Ch2>Harness the Power of AI and PDF Processing for Enhanced Document Workflows\u003C\u002Fh2>\n\u003Cp>pdfRest empowers you to enhance document workflows using the combined strength of our robust PDF processing tools and our \u003Cstrong>new\u003C\u002Fstrong> integrated \u003Cstrong>AI-powered APIs\u003C\u002Fstrong>. You can integrate extracted document content with external services like ChatGPT and OpenAI LLMs, or leverage our direct, dedicated solutions, starting with the \u003Cstrong>\u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsummarize-pdf\u002F\">Summarize PDF API Tool\u003C\u002Fa>\u003C\u002Fstrong>.\u003C\u002Fp>\n\u003Ch2>Key Benefits of AI &amp; PDF Solutions:\u003C\u002Fh2>\n\u003Cul>\n\u003Cli>\u003Cstrong>Accelerated document workflows:\u003C\u002Fstrong> Automate critical tasks like text summarization directly within the pdfRest platform.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Enhanced data insights:\u003C\u002Fstrong> Extract valuable information and metadata from PDF documents for deeper analysis and decision-making, whether using our integrated AI or external LLMs.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Competitive advantage:\u003C\u002Fstrong> Leverage the combined power of direct, integrated AI and reliable PDF processing to differentiate your business.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch2>Two Paths for AI-Driven PDF Workflows:\u003C\u002Fh2>\n\u003Col>\n\u003Cli>\n    \u003Cstrong>Path 1: Utilize Integrated pdfRest AI Tools\u003C\u002Fstrong>\n    \u003Cp>For immediate, structured results, use our growing library of integrated AI solutions. For example, the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsummarize-pdf\u002F\">Summarize PDF API Tool\u003C\u002Fa> processes your document and returns a customizable summary in a single, streamlined API call, eliminating the need to manage external LLM context windows or complex integration steps.\u003C\u002Fp>\n\u003C\u002Fli>\n\u003Cli>\n    \u003Cstrong>Path 2: Integrate with External LLMs (e.g., OpenAI\u002FChatGPT)\u003C\u002Fstrong>\n    \u003Cp>For advanced, custom tasks (like sentiment analysis or specific content generation), you can leverage external LLMs. First, use pdfRest's \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F\">Extract Text\u003C\u002Fa>, \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Focr-pdf\u002F\">OCR PDF\u003C\u002Fa>, \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-markdown-api\u002F\">PDF to Markdown\u003C\u002Fa>, and \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F\">Query PDF\u003C\u002Fa> APIs to reliably extract text and metadata from PDF documents. Then, feed this extracted content into your chosen external AI tool.\u003C\u002Fp>\n\u003C\u002Fli>\n\u003C\u002Fol>\n\u003Cp>By integrating AI with PDF workflows using pdfRest, either through our direct AI-powered tools or through deep external integration, you can unlock new possibilities and achieve greater efficiency and effectiveness.\u003C\u002Fp>","651dbd942d4014c9499b20f4","public","2023-10-04T19:31:32.000+00:00","2026-09-04T17:53:52.000+00:00","2023-10-04T19:33:00.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"CollectionPage\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fartificial-intelligence-ai\u002F#collection\",\n      \"name\": \"Artificial Intelligence (AI)\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fartificial-intelligence-ai\u002F\",\n      \"isPartOf\": {\n        \"@type\": \"WebSite\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"mainEntity\": {\n        \"@type\": \"ItemList\",\n        \"itemListElement\": [\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 1,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fsecure-proprietary-pdf-reports-from-ai-scraping-and-data-mining\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 2,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fautomate-eu-cdsm-article-4-compliance-for-digital-pdf-publications\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 3,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fautomate-multi-language-knowledge-base-creation-from-product-manuals\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 4,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fstreamline-global-e-discovery-by-translating-foreign-legal-documents\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 5,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fbuild-a-scalable-ai-driven-document-analysis-platform\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 6,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Foptimize-legal-discovery-with-ai-summaries-of-contracts-pleadings\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 7,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fextract-structured-pdf-data-for-optimized-llm-training-with-markdown\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 8,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Faccess-pdf-processing-power-with-ai-magic\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 9,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fconvert-pdf-to-text-to-unlock-trapped-data\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 10,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fdiscover-sentiment-insights-from-pdf-documents-with-pdfrest-and-chatgpt\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 11,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fgenerating-summaries-of-pdf-documents-using-chatgpt\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 12,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Ftranslate-pdf-text-to-new-language-with-chatgpt\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 13,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fintegrate-pdfrest-with-chatgpt-to-generate-pdf-info-summary\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 14,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-choose-the-right-pdf-summary-format-style\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 15,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 16,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 17,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-java-code\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 18,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 19,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-php-code\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 20,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 21,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 22,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 23,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 24,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 25,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 26,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 27,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 28,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 29,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 30,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 31,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 32,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-python\u002F\"\n          }\n        ]\n      },\n      \"description\": \"Integrate PDF workflows with AI Tools, such as ChatGPT LLM from OpenAI. Leverage the combined power of AI and robust PDF processing capabilities.\",\n      \"keywords\": \"AI, Analysis, ChatGPT, OpenAI, Sentiment, Summarize PDF, Summary, Translate PDF, Translation, pdfAssistant\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Artificial Intelligence (AI)\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fartificial-intelligence-ai\u002F\"\n        }\n      ]\n    }\n  ]\n}","https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fartificial-intelligence-ai\u002F",[1264],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},"65ae9a7f656af204db4b0d8e","Dana Liang","dana","https:\u002F\u002Fcms.pdfrest.com\u002Fauthor\u002Fdana\u002F",[1270,1274,1278,1285,1289,1293,1297,1301,1305,1309,1313,1317],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},"65ae9a81656af204db4b0f41","content-hub","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Fcontent-hub\u002F",{"id":1275,"name":1276,"slug":1276,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1277},"65ae9a81656af204db4b0f44","artificial-intelligence-ai","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Fartificial-intelligence-ai\u002F",{"id":1279,"name":1280,"slug":1281,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0ef3","#AI","hash-ai","internal","popular","https:\u002F\u002Fcms.pdfrest.com\u002F404\u002F",{"id":1286,"name":1287,"slug":1288,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0ef4","#ChatGPT","hash-chatgpt",{"id":1290,"name":1291,"slug":1292,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0ef5","#OpenAI","hash-openai",{"id":1294,"name":1295,"slug":1296,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f78","#Summary","hash-summary",{"id":1298,"name":1299,"slug":1300,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f79","#Translation","hash-translation",{"id":1302,"name":1303,"slug":1304,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f8a","#Sentiment","hash-sentiment",{"id":1306,"name":1307,"slug":1308,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f8b","#Analysis","hash-analysis",{"id":1310,"name":1311,"slug":1312,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65b41f64533c9f26b9435dc0","#pdfAssistant","hash-pdfassistant",{"id":1314,"name":1315,"slug":1316,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"68daf08c533c9f26b943a62d","#Summarize PDF","hash-summarize-pdf",{"id":1318,"name":1319,"slug":1320,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"68f1062e533c9f26b943a789","#Translate PDF","hash-translate-pdf",{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},"https:\u002F\u002Fcms.pdfrest.com\u002Fartificial-intelligence-ai-hub\u002F","Harness the Power of AI and PDF Processing for Enhanced Document Workflows\n\n\npdfRest empowers you to enhance document workflows using the combined strength of our robust PDF processing tools and our new integrated AI-powered APIs. You can integrate extracted document content with external services like ChatGPT and OpenAI LLMs, or leverage our direct, dedicated solutions, starting with the Summarize PDF API Tool.\n\n\n\nKey Benefits of AI & PDF Solutions:\n\n\n * Accelerated document workflows: Automate","PDF AI Workflows for Developers, Artificial Intelligence for PDF | pdfRest","Integrate PDF workflows with AI Tools, such as ChatGPT LLM from OpenAI. Leverage the combined power of AI and robust PDF processing capabilities.",{"id":1328,"uuid":1329,"title":1330,"slug":1331,"html":1332,"comment_id":1333,"feature_image":48,"featured":284,"visibility":1257,"created_at":1334,"updated_at":1335,"published_at":1336,"custom_excerpt":48,"codeinjection_head":1337,"codeinjection_foot":48,"custom_template":48,"canonical_url":1338,"authors":1339,"tags":1341,"primary_author":1359,"primary_tag":1360,"url":1361,"excerpt":1362,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":1363,"meta_description":1364,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b12e1","273b6649-e046-4bd3-aa99-d597d5ed9ca0","Check & Validate PDF","check","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Ensure PDF Quality and Compliance with pdfRest Validation Tools\u003C\u002Fh2>\n\n\u003Cp>pdfRest empowers you to examine and validate PDF documents, exposing issues that can affect compatibility throughout document workflows. Early detection of potential problems helps teams route documents appropriately before they reach a downstream system or reviewer.\u003C\u002Fp>\n\n\u003Ch2>Proactive PDF Quality Control\u003C\u002Fh2>\n\n\u003Cp>By checking PDFs early, you can catch issues and make more informed processing decisions across a range of workflows. With pdfRest, you can:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Cstrong>Identify potential errors:\u003C\u002Fstrong> Catch issues such as corrupted data or formatting inconsistencies before they disrupt workflows.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Check conformance:\u003C\u002Fstrong> Inspect PDF\u002FA, PDF\u002FX, PDF\u002FUA, and other relevant document characteristics.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Support records workflows:\u003C\u002Fstrong> Review document properties and conformance information before routing a file for retention or follow-up.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Inspect document features:\u003C\u002Fstrong> Check elements such as fonts, images, metadata, forms, language, and tagging before printing or distribution.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Powerful Validation Tools at Your Fingertips\u003C\u002Fh2>\n\n\u003Cp>Leverage pdfRest's \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F\">Query PDF API Tool\u003C\u002Fa> for in-depth PDF analysis:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Cstrong>Conditional Data Check:\u003C\u002Fstrong> Verify specific information within PDFs using conditional queries.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Standard Conformance:\u003C\u002Fstrong> Query document characteristics relevant to PDF\u002FA, PDF\u002FX, PDF\u002FUA, and other standards.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Metadata Analysis:\u003C\u002Fstrong> Gain detailed insights into document metadata, forms, fonts, images, language, tagging, and more.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Validate Hybrid Electronic Invoices\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fvalidate-zugferd-pdf\u002F\">Validate ZUGFeRD PDF API Tool\u003C\u002Fa> checks an existing ZUGFeRD or Factur-X hybrid invoice and its PDF\u002FA conformance without modifying the submitted document. Use it as an intake check for supplier invoices or as a verification step after creating an invoice with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-zugferd-pdf\u002F\">Create ZUGFeRD PDF API Tool\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>By using pdfRest's validation capabilities, applications can make a clear routing decision based on the document returned by a workflow rather than treating every uploaded PDF as ready for the same next step.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","651f0fed2d4014c9499b2180","2023-10-05T19:35:09.000+00:00","2026-09-18T20:05:09.000+00:00","2023-10-05T19:35:39.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"CollectionPage\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fcheck-validate-pdf\u002F#collection\",\n      \"name\": \"Check & Validate PDF\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fcheck-validate-pdf\u002F\",\n      \"isPartOf\": {\n        \"@type\": \"WebSite\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"mainEntity\": {\n        \"@type\": \"ItemList\",\n        \"itemListElement\": [\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 1,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fdiscover-how-pdfrest-outperforms-free-open-source-pdf-tools\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 2,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fparse-pdf-files-to-streamline-data-extraction\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 3,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fadd-page-numbers-to-pdf-documents\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 4,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fdetect-and-repair-non-conformant-pdf-a-documents\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 5,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fintegrate-pdfrest-with-chatgpt-to-generate-pdf-info-summary\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 6,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 7,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 8,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 9,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 10,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 11,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 12,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 13,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 14,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 15,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 16,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 17,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-python\u002F\"\n          }\n        ]\n      },\n      \"description\": \"Check PDFs to uncover errors and optimize content. Validate PDF\u002FA, PDF\u002FX, & PDF\u002FUA conformance, gain insights, and safeguard PDF performance with powerful API tools.\",\n      \"keywords\": \"PDF Info, Query PDF, Validate\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Check & Validate PDF\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fcheck-validate-pdf\u002F\"\n        }\n      ]\n    }\n  ]\n}","https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fcheck-validate-pdf\u002F",[1340],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[1342,1343,1347,1351,1355],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1344,"name":1345,"slug":1345,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1346},"65ae9a81656af204db4b0f4b","check-validate-pdf","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Fcheck-validate-pdf\u002F",{"id":1348,"name":1349,"slug":1350,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0ef7","#PDF Info","hash-pdf-info",{"id":1352,"name":1353,"slug":1354,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0ef6","#Query PDF","hash-query-pdf",{"id":1356,"name":1357,"slug":1358,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"66461892533c9f26b94377d5","#Validate","hash-validate",{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},"https:\u002F\u002Fcms.pdfrest.com\u002Fcheck\u002F","\n\n\n\n\nEnsure PDF Quality and Compliance with pdfRest Validation Tools\n\n\n\npdfRest empowers you to examine and validate PDF documents, exposing issues that can affect compatibility throughout document workflows. Early detection of potential problems helps teams route documents appropriately before they reach a downstream system or reviewer.\n\n\n\n\nProactive PDF Quality Control\n\n\n\nBy checking PDFs early, you can catch issues and make more informed processing decisions across a range of workflows. With ","Check & Validate PDF Quality, Conditions, & Compliance, PDF\u002FA, PDF\u002FX, PDF\u002FUA | pdfRest","Check PDFs to uncover errors and optimize content. Validate PDF\u002FA, PDF\u002FX, & PDF\u002FUA conformance, gain insights, and safeguard PDF performance with powerful API tools.",{"id":1366,"uuid":1367,"title":1368,"slug":1369,"html":1370,"comment_id":1371,"feature_image":48,"featured":284,"visibility":1257,"created_at":1372,"updated_at":1373,"published_at":1374,"custom_excerpt":48,"codeinjection_head":1375,"codeinjection_foot":48,"custom_template":48,"canonical_url":1376,"authors":1377,"tags":1379,"primary_author":1445,"primary_tag":1446,"url":1447,"excerpt":1448,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":1449,"meta_description":1450,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b12dc","9594629c-408a-4690-a2f2-8b37e8ed4ee3","Converting to PDF","converting-to-pdf-hub","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Convert Many File Formats to PDF with pdfRest\u003C\u002Fh2>\n\n\u003Cp>pdfRest empowers you to convert a wide range of file formats into universally compatible PDF documents. Whether you're working with Microsoft Office documents, images, emails, HTML webpages, structured content, or other common file types, pdfRest streamlines conversion for efficient sharing and consistent rendering across platforms.\u003C\u002Fp>\n\n\u003Ch2>Supported Conversion Formats\u003C\u002Fh2>\n\n\u003Cp>pdfRest's robust \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool\u003C\u002Fa> offers comprehensive support for a wide range of file types:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Cstrong>Microsoft Office:\u003C\u002Fstrong> Word (DOCX), Excel (XLSX), PowerPoint (PPTX)\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Images:\u003C\u002Fstrong> JPG, PNG, BMP, TIFF\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Email:\u003C\u002Fstrong> EML\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Web Content:\u003C\u002Fstrong> HTML, URL\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Structured Content:\u003C\u002Fstrong> Markdown, plain text, JSON, XML, CSV\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Vector Graphics:\u003C\u002Fstrong> PostScript (PS), Encapsulated PostScript (EPS)\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Electronic Invoices:\u003C\u002Fstrong> ZUGFeRD and Factur-X hybrid PDF\u002FA-3 invoices\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Create Hybrid Electronic Invoices\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-zugferd-pdf\u002F\">Create ZUGFeRD PDF API Tool\u003C\u002Fa> combines canonical invoice XML with a visual invoice PDF to produce a ZUGFeRD or Factur-X hybrid PDF\u002FA-3 invoice. This lets billing, procurement, and accounts-payable workflows deliver one invoice that can be read as a PDF and processed from its embedded structured data.\u003C\u002Fp>\n\n\u003Cp>When the visual PDF agrees with the invoice XML, pdfRest preserves it. Applications can also enable a fallback replacement PDF when a match cannot be confirmed, while retaining control of the PDF presentation used for that replacement.\u003C\u002Fp>\n\n\u003Ch2>Customized PDF Conversion Settings\u003C\u002Fh2>\n\n\u003Cp>Enhance your conversion process with pdfRest's flexible configuration options. Tailor settings to optimize PDF output and align each result with the needs of your application or document workflow.\u003C\u002Fp>\n\n\u003Cp>Explore the Convert to PDF API Tool and its related conversion capabilities to standardize source documents, structured content, and electronic invoices through a consistent API workflow.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","651dbe3d2d4014c9499b2106","2023-10-04T19:34:21.000+00:00","2026-09-18T20:05:08.000+00:00","2023-10-04T19:35:20.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"CollectionPage\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fconverting-to-pdf\u002F#collection\",\n      \"name\": \"Converting to PDF\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fconverting-to-pdf\u002F\",\n      \"isPartOf\": {\n        \"@type\": \"WebSite\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"mainEntity\": {\n        \"@type\": \"ItemList\",\n        \"itemListElement\": [\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 1,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fconvert-email-to-pdf-for-legal-and-compliance-archives\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 2,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fextract-structured-pdf-data-for-optimized-llm-training-with-markdown\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 3,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fdiscover-how-pdfrest-outperforms-free-open-source-pdf-tools\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 4,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Faccess-pdf-processing-power-with-ai-magic\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 5,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fconvert-pdf-to-text-to-unlock-trapped-data\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 6,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fexpedite-litigation-workflows-with-pdf-and-word-conversions\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 7,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fconvert-pdf-files-to-editable-microsoft-office-documents\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 8,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fconvert-html-newsletter-to-pdf-to-preserve-content\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 9,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fconvert-documents-into-encrypted-pdfs-for-archiving\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 10,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Frender-pdf-pages-to-graphic-file-formats-with-accurate-color-preservation\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 11,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Foptimize-pdf-documents-for-long-term-preservation\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 12,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Foptimize-word-excel-and-powerpoint-files-for-long-term-preservation\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 13,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Foptimize-pdfs-for-email-attachment\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 14,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fmerge-multiple-types-of-files-together\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 15,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-automate-pdf-to-markdown-conversions-for-content-repurposing-and-llm-training\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 16,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 17,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 18,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 19,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 20,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 21,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 22,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 23,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 24,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 25,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 26,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 27,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 28,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 29,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 30,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 31,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 32,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 33,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 34,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 35,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 36,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 37,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 38,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 39,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 40,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 41,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 42,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 43,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 44,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 45,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 46,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 47,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 48,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 49,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 50,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 51,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 52,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 53,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 54,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 55,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 56,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 57,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 58,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 59,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 60,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 61,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 62,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 63,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 64,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 65,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 66,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 67,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 68,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-word-to-pdf-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 69,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 70,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 71,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 72,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 73,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 74,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 75,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 76,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 77,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-java-code\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 78,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 79,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-php-code\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 80,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 81,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 82,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 83,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 84,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 85,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 86,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 87,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 88,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 89,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 90,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 91,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 92,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 93,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 94,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 95,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 96,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 97,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 98,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 99,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-in-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 100,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-in-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 101,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 102,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 103,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 104,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 105,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 106,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 107,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 108,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 109,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 110,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 111,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 112,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 113,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 114,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-convert-excel-to-pdf\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 115,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-convert-html-to-pdf\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 116,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-convert-pdf-to-excel-spreadsheets\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 117,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-convert-pdf-to-markdown-for-ai-and-data-analysis-guide\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 118,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-convert-pdf-to-powerpoint-presentations\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 119,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-convert-pdf-to-word-documents\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 120,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-convert-word-documents-to-pdf\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 121,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-generate-pdf-invoice-files\u002F\"\n          }\n        ]\n      },\n      \"description\": \"Convert Word, Excel, PowerPoint, images, HTML, and more to PDF for seamless sharing and compatibility. Customize output and automate workflows.\",\n      \"keywords\": \"CSV, Conversion, Convert, Convert to PDF, Email, HTML, JSON, Markdown, Newsletter, Plain Text, URL, XML\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Converting to PDF\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fconverting-to-pdf\u002F\"\n        }\n      ]\n    }\n  ]\n}","https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fconverting-to-pdf\u002F",[1378],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[1380,1381,1385,1389,1393,1397,1401,1405,1409,1413,1417,1421,1425,1429,1433,1437,1441],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1382,"name":1383,"slug":1383,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1384},"65ae9a81656af204db4b0f45","converting-to-pdf","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Fconverting-to-pdf\u002F",{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e14","#Conversion","hash-conversion",{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e0e","#Convert","hash-convert",{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e1c","#Convert to PDF","hash-convert-to-pdf",{"id":1398,"name":1399,"slug":1400,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e17","#Email","hash-email",{"id":1402,"name":1403,"slug":1404,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e21","#HTML","hash-html",{"id":1406,"name":1407,"slug":1408,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e95","#Newsletter","hash-newsletter",{"id":1410,"name":1411,"slug":1412,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e96","#URL","hash-url",{"id":1414,"name":1415,"slug":1416,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"6a9202f2533c9f26b943ac56","#Markdown","hash-markdown",{"id":1418,"name":1419,"slug":1420,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"6a999117d1b70dd2e2978a84","#CSV","hash-csv",{"id":1422,"name":1423,"slug":1424,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"6a999118d1b70dd2e2978a86","#JSON","hash-json",{"id":1426,"name":1427,"slug":1428,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"6a999118d1b70dd2e2978a88","#XML","hash-xml",{"id":1430,"name":1431,"slug":1432,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"6a999118d1b70dd2e2978a8a","#Plain Text","hash-plain-text",{"id":1434,"name":1435,"slug":1436,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"6aa957d2d1b70dd2e2978ede","#ZUGFeRD","hash-zugferd",{"id":1438,"name":1439,"slug":1440,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"6aa957d2d1b70dd2e2978edf","#Factur-X","hash-factur-x",{"id":1442,"name":1443,"slug":1444,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"6aad98f6d1b70dd2e2978fc9","#Create ZUGFeRD PDF","hash-create-zugferd-pdf",{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},"https:\u002F\u002Fcms.pdfrest.com\u002Fconverting-to-pdf-hub\u002F","\n\n\n\n\nConvert Many File Formats to PDF with pdfRest\n\n\n\npdfRest empowers you to convert a wide range of file formats into universally compatible PDF documents. Whether you're working with Microsoft Office documents, images, emails, HTML webpages, structured content, or other common file types, pdfRest streamlines conversion for efficient sharing and consistent rendering across platforms.\n\n\n\n\nSupported Conversion Formats\n\n\n\npdfRest's robust Convert to PDF API Tool offers comprehensive support for a","API for Converting to PDF from Office, Images, HTML | pdfRest","Convert Word, Excel, PowerPoint, images, HTML, and more to PDF for seamless sharing and compatibility. Customize output and automate workflows.",{"id":1452,"uuid":1453,"title":1454,"slug":1455,"html":1456,"comment_id":1457,"feature_image":48,"featured":284,"visibility":1257,"created_at":1458,"updated_at":1459,"published_at":1460,"custom_excerpt":48,"codeinjection_head":1461,"codeinjection_foot":48,"custom_template":48,"canonical_url":1462,"authors":1463,"tags":1465,"primary_author":1503,"primary_tag":1504,"url":1505,"excerpt":1506,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":1507,"meta_description":1508,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b12e2","427335e2-522e-47eb-a7ba-ccbe39653e98","Extract from PDF","extract-from-pdf-hub","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Unlock the Power of PDF Data with pdfRest Extraction Tools\u003C\u002Fh2>\n\u003Cp>pdfRest empowers you to extract a wealth of information from your PDF documents. Go beyond static files and unlock the true potential of your data. Our extraction tools transform your PDFs into a dynamic source of data, enriching your data landscape and enabling powerful analysis.\u003C\u002Fp>\n\n\u003Ch2>Extract, Export, and Leverage PDF Content Seamlessly\u003C\u002Fh2>\n\u003Cp>pdfRest simplifies the process of extracting valuable data from your PDFs, making it readily available for further processing and analysis. Easily integrate extracted data with various applications, including:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Cstrong>AI Tools:\u003C\u002Fstrong> Leverage data extracted from PDFs to power AI-driven tasks, such as sentiment analysis or document classification.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Content Management Systems (CMS):\u003C\u002Fstrong> Populate your CMS with extracted data, ensuring consistency and streamlined content management.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Data Processing & Analysis Tools:\u003C\u002Fstrong> Integrate extracted data with your existing data analysis tools for deeper insights and informed decision-making.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>And More!\u003C\u002Fstrong> The possibilities are endless. Leverage extracted PDF data across various applications to enhance your workflows.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Powerful PDF Extraction Tools\u003C\u002Fh2>\n\n\u003Cp>Unlock the full potential of your PDF content and data with pdfRest's API Tools:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-markdown\u002F'>PDF to Markdown\u003C\u002Fa>\u003C\u002Fstrong>: Extract PDF content in structured Markdown format, preserving headers, lists, tables, and bold styling.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Focr-pdf\u002F'>OCR PDF\u003C\u002Fa>\u003C\u002Fstrong>: Convert scanned PDFs and PDF images into searchable and extractable text.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F'>Extract Text\u003C\u002Fa>\u003C\u002Fstrong>: Extract all text content from PDFs, including formatting and positional information.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-images\u002F'>Extract Images\u003C\u002Fa>\u003C\u002Fstrong>: Extract all images from PDFs and save them as high-quality image files.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F'>Query PDF\u003C\u002Fa>\u003C\u002Fstrong>: Extract conditional information and metadata from your PDFs.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F'>Split PDF\u003C\u002Fa>\u003C\u002Fstrong>: Extract individual PDF pages or page ranges into separate documents.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>Start extracting valuable data from your PDFs today! Explore pdfRest's powerful tools and unlock a world of possibilities.\u003C\u002Fp>\n\n\u003C!--kg-card-end: html-->\n","651f101b2d4014c9499b218f","2023-10-05T19:35:55.000+00:00","2026-09-04T17:53:47.000+00:00","2023-10-05T19:36:24.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"CollectionPage\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fextract-from-pdf\u002F#collection\",\n      \"name\": \"Extract from PDF\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fextract-from-pdf\u002F\",\n      \"isPartOf\": {\n        \"@type\": \"WebSite\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"mainEntity\": {\n        \"@type\": \"ItemList\",\n        \"itemListElement\": [\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 1,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fpersonalize-pdf-templates-with-dynamic-content\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 2,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fgenerate-dynamic-pdf-reports-with-structured-tables\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 3,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fcreate-tagged-pdfs-from-scratch-with-application-data\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 4,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fsecure-proprietary-pdf-reports-from-ai-scraping-and-data-mining\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 5,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fautomate-eu-cdsm-article-4-compliance-for-digital-pdf-publications\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 6,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fextract-structured-pdf-data-for-optimized-llm-training-with-markdown\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 7,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Ftransform-pdf-files-to-markdown-for-dynamic-web-content-seo\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 8,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fdiscover-how-pdfrest-outperforms-free-open-source-pdf-tools\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 9,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fprotect-data-privacy-in-financial-services-with-pdf-redaction-solution\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 10,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fensure-patient-privacy-in-healthcare-research-with-pdf-redaction-solution\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 11,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fstreamline-digital-marketing-with-effortless-pdf-image-extraction\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 12,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fparse-pdf-files-to-streamline-data-extraction\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 13,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fadd-page-numbers-to-pdf-documents\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 14,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fautomate-pdf-text-insertion-for-variable-data-printing\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 15,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fextract-text-from-pdf-using-ocr\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 16,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fcreate-searchable-pdf-files-with-ocr\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 17,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fconvert-pdf-to-text-to-unlock-trapped-data\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 18,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fdiscover-sentiment-insights-from-pdf-documents-with-pdfrest-and-chatgpt\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 19,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fgenerating-summaries-of-pdf-documents-using-chatgpt\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 20,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Ftranslate-pdf-text-to-new-language-with-chatgpt\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 21,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fintegrate-pdfrest-with-chatgpt-to-generate-pdf-info-summary\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 22,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fextract-pages-from-a-pdf-to-isolate-key-data\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 23,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 24,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 25,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 26,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-a-pdf-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 27,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 28,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-automate-pdf-to-markdown-conversions-for-content-repurposing-and-llm-training\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 29,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 30,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 31,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-java-code\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 32,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 33,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-php-code\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 34,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 35,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 36,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 37,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 38,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 39,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 40,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 41,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 42,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 43,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 44,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 45,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 46,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 47,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 48,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 49,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-dot-net-c-sharp\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 50,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 51,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 52,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-javascript\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 53,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 54,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 55,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 56,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 57,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-convert-pdf-to-markdown-for-ai-and-data-analysis-guide\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 58,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-extract-text-from-pdf\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 59,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-fill-pdf-forms\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 60,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-generate-pdf-invoice-files\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 61,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-ocr-pdfs-to-create-searchable-documents\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 62,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-in-net-with-c-code\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 63,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-curl-code\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 64,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-java-code\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 65,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-javascript-code-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 66,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-php-code\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 67,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-python-code\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 68,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 69,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 70,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 71,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 72,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 73,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 74,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 75,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 76,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 77,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 78,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 79,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-python\u002F\"\n          }\n        ]\n      },\n      \"description\": \"Extract text, OCR text, data, and pages from PDF for AI, analysis and more. Automate workflows with powerful API tools to unlock PDF info and integrate services.\",\n      \"keywords\": \"Data, Extract, Extract Images, Extract Text, OCR, OCR PDF, PDF to Markdown, Text\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Extract from PDF\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fextract-from-pdf\u002F\"\n        }\n      ]\n    }\n  ]\n}","https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fextract-from-pdf\u002F",[1464],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[1466,1467,1471,1475,1479,1483,1487,1491,1495,1499],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1468,"name":1469,"slug":1469,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1470},"65ae9a81656af204db4b0f4c","extract-from-pdf","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Fextract-from-pdf\u002F",{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e31","#Data","hash-data",{"id":1476,"name":1477,"slug":1478,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e29","#Extract Text","hash-extract-text",{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0ef8","#Text","hash-text",{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f60","#Extract","hash-extract",{"id":1488,"name":1489,"slug":1490,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"66a1389f533c9f26b9437ef3","#OCR PDF","hash-ocr-pdf",{"id":1492,"name":1493,"slug":1494,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"66a2bcdf533c9f26b9437f77","#OCR","hash-ocr",{"id":1496,"name":1497,"slug":1498,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"673e471b533c9f26b9438f16","#Extract Images","hash-extract-images",{"id":1500,"name":1501,"slug":1502,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"6870353c533c9f26b9439c92","#PDF to Markdown","hash-pdf-to-markdown",{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},"https:\u002F\u002Fcms.pdfrest.com\u002Fextract-from-pdf-hub\u002F","\n\n\n\n\nUnlock the Power of PDF Data with pdfRest Extraction Tools\n\n\npdfRest empowers you to extract a wealth of information from your PDF documents. Go beyond static files and unlock the true potential of your data. Our extraction tools transform your PDFs into a dynamic source of data, enriching your data landscape and enabling powerful analysis.\n\n\n\n\nExtract, Export, and Leverage PDF Content Seamlessly\n\n\npdfRest simplifies the process of extracting valuable data from your PDFs, making it readily ","Export & Extract from PDF - Data, Metadata, Pages, OCR  | pdfRest","Extract text, OCR text, data, and pages from PDF for AI, analysis and more. Automate workflows with powerful API tools to unlock PDF info and integrate services.",{"id":1510,"uuid":1511,"title":1512,"slug":1513,"html":1514,"comment_id":1515,"feature_image":48,"featured":284,"visibility":1257,"created_at":1516,"updated_at":1517,"published_at":1518,"custom_excerpt":48,"codeinjection_head":1519,"codeinjection_foot":48,"custom_template":48,"canonical_url":1520,"authors":1521,"tags":1523,"primary_author":1569,"primary_tag":1570,"url":1571,"excerpt":1572,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":1573,"meta_description":1574,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b12de","90292082-ab82-4e26-a48f-fa051040c845","Graphic Image Formats","graphic-image-formats-hub","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Convert Between PDF Files and Graphic Image Formats\u003C\u002Fh2>\n\n\u003Cp>pdfRest's versatile API tools allow you to convert between PDFs and a variety of common image file types, including BMP, JPG, PNG, GIF, and TIFF. Convert each page of a PDF to a separate image file, or convert an image file to a PDF.\u003C\u002Fp>\n\n\u003Ch2>Image Conversion Benefits with pdfRest\u003C\u002Fh2>\n\n\u003Cul>\n  \u003Cli>\u003Cstrong>Flexible Conversion Options:\u003C\u002Fstrong> Convert PDFs to images or vice versa to suit your specific requirements.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>High-Quality Output:\u003C\u002Fstrong> Preserve the integrity of your visual content with accurate and high-quality conversions powered by Adobe technology.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Simplified Workflows:\u003C\u002Fstrong> Streamline your document processing tasks with a user-friendly API.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Versatility:\u003C\u002Fstrong> Use converted images or PDFs in various applications, from presentations and print to web design and document archiving.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Key PDF & Image Conversion Features\u003C\u002Fh2>\n\u003Cul>\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF\u003C\u002Fa>:\u003C\u002Fstrong> Transform images from BMP, JPG, PNG, EPS, and TIFF into high-quality PDF documents for easy sharing, print, and archiving.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F'>PDF to Images\u003C\u002Fa>:\u003C\u002Fstrong> Convert PDFs into various image formats, including BMP, JPG, PNG, GIF, and TIFF, preserving the integrity of your visual content.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>Discover the power of pdfRest's PDF to Image and Image to PDF APIs and transform your documents effortlessly!\u003C\u002Fp>\n\n\u003C!--kg-card-end: html-->\n","651f0efa2d4014c9499b214d","2023-10-05T19:31:06.000+00:00","2026-09-04T17:53:50.000+00:00","2023-10-05T19:31:49.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"CollectionPage\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fgraphic-image-formats\u002F#collection\",\n      \"name\": \"Graphic Image Formats\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fgraphic-image-formats\u002F\",\n      \"isPartOf\": {\n        \"@type\": \"WebSite\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"mainEntity\": {\n        \"@type\": \"ItemList\",\n        \"itemListElement\": [\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 1,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fdiscover-how-pdfrest-outperforms-free-open-source-pdf-tools\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 2,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Faccess-pdf-processing-power-with-ai-magic\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 3,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fcreate-pdf-thumbnail-images\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 4,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Frender-pdf-pages-to-graphic-file-formats-with-accurate-color-preservation\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 5,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fmerge-multiple-types-of-files-together\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 6,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Foptimize-pdfs-for-fast-web-viewing\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 7,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 8,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 9,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 10,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 11,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 12,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 13,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 14,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 15,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 16,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 17,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 18,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 19,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 20,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 21,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 22,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 23,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 24,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 25,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 26,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-image-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 27,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 28,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 29,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 30,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 31,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 32,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 33,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 34,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 35,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 36,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 37,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 38,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 39,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 40,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 41,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 42,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 43,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 44,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 45,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 46,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-python\u002F\"\n          }\n        ]\n      },\n      \"description\": \"Convert between PDF and common graphic image file formats, such as PNG, JPG, BMP, TIFF, EPS, and GIF. Transform your documents into images and vice versa.\",\n      \"keywords\": \"BMP, EPS, GIF, JPG, PDF Viewer, PDF to Images, PNG, Rendering, TIFF, Thumbnail\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Graphic Image Formats\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fgraphic-image-formats\u002F\"\n        }\n      ]\n    }\n  ]\n}","https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fgraphic-image-formats\u002F",[1522],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[1524,1525,1529,1533,1537,1541,1545,1549,1553,1557,1561,1565],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1526,"name":1527,"slug":1527,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1528},"65ae9a81656af204db4b0f48","graphic-image-formats","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Fgraphic-image-formats\u002F",{"id":1530,"name":1531,"slug":1532,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e23","#BMP","hash-bmp",{"id":1534,"name":1535,"slug":1536,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e2f","#GIF","hash-gif",{"id":1538,"name":1539,"slug":1540,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e30","#PDF to Images","hash-pdf-to-images",{"id":1542,"name":1543,"slug":1544,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e1f","#JPG","hash-jpg",{"id":1546,"name":1547,"slug":1548,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e22","#PNG","hash-png",{"id":1550,"name":1551,"slug":1552,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e2e","#Rendering","hash-rendering",{"id":1554,"name":1555,"slug":1556,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e20","#TIFF","hash-tiff",{"id":1558,"name":1559,"slug":1560,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e25","#PDF Viewer","hash-pdf-viewer",{"id":1562,"name":1563,"slug":1564,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f64","#Thumbnail","hash-thumbnail",{"id":1566,"name":1567,"slug":1568,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e1e","#EPS","hash-eps",{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},"https:\u002F\u002Fcms.pdfrest.com\u002Fgraphic-image-formats-hub\u002F","\n\n\n\n\nConvert Between PDF Files and Graphic Image Formats\n\n\n\npdfRest's versatile API tools allow you to convert between PDFs and a variety of common image file types, including BMP, JPG, PNG, GIF, and TIFF. Convert each page of a PDF to a separate image file, or convert an image file to a PDF.\n\n\n\n\nImage Conversion Benefits with pdfRest\n\n\n\n * Flexible Conversion Options: Convert PDFs to images or vice versa to suit your specific requirements.\n * High-Quality Output: Preserve the integrity of your ","Convert Between PDF & Graphic Image Formats, PNG, JPG, BMP, TIFF | pdfRest","Convert between PDF and common graphic image file formats, such as PNG, JPG, BMP, TIFF, EPS, and GIF. Transform your documents into images and vice versa.",{"id":1576,"uuid":1577,"title":1578,"slug":1579,"html":1580,"comment_id":1581,"feature_image":48,"featured":284,"visibility":1257,"created_at":1582,"updated_at":1459,"published_at":1583,"custom_excerpt":48,"codeinjection_head":1584,"codeinjection_foot":48,"custom_template":48,"canonical_url":1585,"authors":1586,"tags":1588,"primary_author":1622,"primary_tag":1623,"url":1624,"excerpt":1625,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":1626,"meta_description":1627,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b12e3","998145c8-4df5-4a5b-a440-6edd1ce078f3","Merge & Split PDF","merge-2","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Merge & Split PDF Files with Precision\u003C\u002Fh2>\n\n\u003Cp>pdfRest's powerful \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fmerge-pdfs\u002F'>Merge PDFs\u003C\u002Fa> and \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F'>Split PDF\u003C\u002Fa> API tools enable you to merge, split, extract pages, delete pages, and restructure your PDF documents with ease. Gain granular control over your content and create customized versions of your files.\u003C\u002Fp>\n\n\n\u003Ch2>Key Merge & Split PDF Features\u003C\u002Fh2>\n\n\u003Cul>\n  \u003Cli>\u003Cstrong>Split PDF:\u003C\u002Fstrong> Split all pages of a PDF into separate documents, or choose custom pages or page ranges to split out.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Extract Pages:\u003C\u002Fstrong> Extract specific pages from a PDF document to create standalone files.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Merge PDFs:\u003C\u002Fstrong> Combine multiple PDFs into a single document, preserving the original content and formatting.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Reorder Pages:\u003C\u002Fstrong> Rearrange the order of pages within a PDF to suit your needs.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Remove Pages:\u003C\u002Fstrong> Delete unwanted pages from a PDF document.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>Optimize your PDF workflows and enhance your document management capabilities with pdfRest's merging and splitting tools.\u003C\u002Fp>\n\n\u003C!--kg-card-end: html-->\n","651f10592d4014c9499b21a1","2023-10-05T19:36:57.000+00:00","2023-10-05T19:37:45.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"CollectionPage\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fmerge-split-pdf\u002F#collection\",\n      \"name\": \"Merge & Split PDF\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fmerge-split-pdf\u002F\",\n      \"isPartOf\": {\n        \"@type\": \"WebSite\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"mainEntity\": {\n        \"@type\": \"ItemList\",\n        \"itemListElement\": [\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 1,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fgenerate-dynamic-pdf-reports-with-structured-tables\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 2,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fdiscover-how-pdfrest-outperforms-free-open-source-pdf-tools\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 3,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fresize-pdf-pages-for-consistent-archiving\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 4,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fcrop-pdf-files-to-optimize-scanned-documents\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 5,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fadd-page-numbers-to-pdf-documents\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 6,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Faccess-pdf-processing-power-with-ai-magic\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 7,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fmerge-pdf-documents-for-streamlined-report-compilation\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 8,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fcreate-pdf-thumbnail-images\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 9,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Frender-pdf-pages-to-graphic-file-formats-with-accurate-color-preservation\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 10,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fmerge-multiple-types-of-files-together\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 11,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fextract-pages-from-a-pdf-to-isolate-key-data\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 12,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fdelete-pages-from-a-pdf-to-sanitize-documents\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 13,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 14,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 15,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 16,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 17,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 18,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 19,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 20,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 21,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 22,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 23,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 24,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 25,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 26,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdfs-with-dot-net-c-sharp\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 27,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdf-files-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 28,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdf-files-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 29,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdf-files-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 30,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdfs-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 31,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdf-documents-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 32,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-merge-multiple-pdf-files-into-one\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 33,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-split-pdf-into-multiple-files\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 34,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-c-code-in-net\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 35,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 36,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 37,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-javascript-code-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 38,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-php-code\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 39,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 40,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 41,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 42,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 43,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 44,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 45,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-python\u002F\"\n          }\n        ]\n      },\n      \"description\": \"Combine, separate, and rearrange PDF documents with granular page-level control using pdfRest API Tools.\",\n      \"keywords\": \"Combine, Merge PDFs, Pages, Remove, Report, Scanned Docs, Split PDF\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Merge & Split PDF\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fmerge-split-pdf\u002F\"\n        }\n      ]\n    }\n  ]\n}","https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fmerge-split-pdf\u002F",[1587],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[1589,1590,1594,1598,1602,1606,1610,1614,1618],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1591,"name":1592,"slug":1592,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1593},"65ae9a81656af204db4b0f4d","merge-split-pdf","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Fmerge-split-pdf\u002F",{"id":1595,"name":1596,"slug":1597,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e1a","#Merge PDFs","hash-merge-pdfs",{"id":1599,"name":1600,"slug":1601,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e27","#Remove","hash-remove",{"id":1603,"name":1604,"slug":1605,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e28","#Split PDF","hash-split-pdf",{"id":1607,"name":1608,"slug":1609,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e2a","#Pages","hash-pages",{"id":1611,"name":1612,"slug":1613,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e1b","#Scanned Docs","hash-scanned-docs",{"id":1615,"name":1616,"slug":1617,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f93","#Report","hash-report",{"id":1619,"name":1620,"slug":1621,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f94","#Combine","hash-combine",{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},"https:\u002F\u002Fcms.pdfrest.com\u002Fmerge-2\u002F","\n\n\n\n\nMerge & Split PDF Files with Precision\n\n\n\npdfRest's powerful Merge PDFs and Split PDF API tools enable you to merge, split, extract pages, delete pages, and restructure your PDF documents with ease. Gain granular control over your content and create customized versions of your files.\n\n\n\n\n\nKey Merge & Split PDF Features\n\n\n\n * Split PDF: Split all pages of a PDF into separate documents, or choose custom pages or page ranges to split out.\n * Extract Pages: Extract specific pages from a PDF doc","Merge & Split PDF Files - Export, Delete, & Reorder Pages | pdfRest","Combine, separate, and rearrange PDF documents with granular page-level control using pdfRest API Tools.",{"id":1629,"uuid":1630,"title":1631,"slug":1632,"html":1633,"comment_id":1634,"feature_image":48,"featured":284,"visibility":1257,"created_at":1635,"updated_at":1636,"published_at":1637,"custom_excerpt":48,"codeinjection_head":1638,"codeinjection_foot":48,"custom_template":48,"canonical_url":1639,"authors":1640,"tags":1642,"primary_author":1676,"primary_tag":1677,"url":1678,"excerpt":1679,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":1680,"meta_description":1681,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b12df","d6598ee1-9cf3-42c9-a7b7-7e4c1a9d276e","Microsoft Office Files","microsoft-office-files-hub","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Convert Between PDF and Microsoft Office with pdfRest\u003C\u002Fh2>\n\n\u003Cp>pdfRest offers a comprehensive suite of tools to effortlessly convert both directions between PDF and Microsoft Office formats, including Word, Excel, and PowerPoint. Our API is designed to simplify your document conversion workflows and enhance your productivity.\u003C\u002Fp>\n\n\u003Ch2>Convert PDF to Word, Excel, & PowerPoint with Ease\u003C\u002Fh2>\n\n\u003Cp>PDF to Office Pro Tools provide a user-friendly REST API for converting PDF documents into Microsoft Office formats. With just a few simple steps, you can transform your PDFs into editable Word, Excel, or PowerPoint files. Also available as a \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fproducts\u002Fpdf-forms-pro-self-hosted-api\u002F'>Self-Hosted API\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Key Microsoft Office Conversion Features\u003C\u002Fh2>\n\u003Cul>\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-word\u002F'>PDF to Word\u003C\u002Fa>:\u003C\u002Fstrong> Convert PDF documents into editable Word documents, preserving formatting and content.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-powerpoint\u002F'>PDF to PowerPoint\u003C\u002Fa>:\u003C\u002Fstrong> Transform PDFs into visually appealing PowerPoint presentations, including slides, images, and text.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-excel\u002F'>PDF to Excel\u003C\u002Fa>:\u003C\u002Fstrong> Convert PDFs containing tables or data into editable Excel spreadsheets.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF\u003C\u002Fa>:\u003C\u002Fstrong> Easily convert Word, Excel, and PowerPoint documents into high-quality PDFs for sharing and archiving.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>Discover the power of pdfRest and streamline your document conversion workflows today!\u003C\u002Fp>\n\n\u003C!--kg-card-end: html-->\n","651f0f2f2d4014c9499b2162","2023-10-05T19:31:59.000+00:00","2026-09-04T17:53:49.000+00:00","2023-10-05T19:33:05.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"CollectionPage\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fmicrosoft-office-files\u002F#collection\",\n      \"name\": \"Microsoft Office Files\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fmicrosoft-office-files\u002F\",\n      \"isPartOf\": {\n        \"@type\": \"WebSite\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"mainEntity\": {\n        \"@type\": \"ItemList\",\n        \"itemListElement\": [\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 1,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fdiscover-how-pdfrest-outperforms-free-open-source-pdf-tools\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 2,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Faccess-pdf-processing-power-with-ai-magic\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 3,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fexpedite-litigation-workflows-with-pdf-and-word-conversions\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 4,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fconvert-pdf-files-to-editable-microsoft-office-documents\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 5,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Foptimize-word-excel-and-powerpoint-files-for-long-term-preservation\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 6,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fmerge-multiple-types-of-files-together\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 7,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 8,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 9,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 10,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 11,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 12,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 13,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 14,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 15,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 16,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 17,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 18,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 19,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 20,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 21,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 22,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 23,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 24,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 25,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 26,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 27,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 28,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 29,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 30,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 31,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 32,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 33,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 34,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 35,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 36,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 37,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 38,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 39,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 40,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 41,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-convert-excel-to-pdf\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 42,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-convert-pdf-to-excel-spreadsheets\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 43,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-convert-pdf-to-powerpoint-presentations\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 44,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-convert-pdf-to-word-documents\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 45,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-convert-word-documents-to-pdf\u002F\"\n          }\n        ]\n      },\n      \"description\": \"Convert PDF to \u002F from Word, Excel, PowerPoint with PDF to Office Pro and Convert to PDF API Tools from pdfRest.\",\n      \"keywords\": \"Excel, Microsoft Office, PDF to Excel, PDF to PowerPoint, PDF to Word, PowerPoint, Word\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Microsoft Office Files\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fmicrosoft-office-files\u002F\"\n        }\n      ]\n    }\n  ]\n}","https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fmicrosoft-office-files\u002F",[1641],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[1643,1644,1648,1652,1656,1660,1664,1668,1672],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1645,"name":1646,"slug":1646,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1647},"65ae9a81656af204db4b0f49","microsoft-office-files","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Fmicrosoft-office-files\u002F",{"id":1649,"name":1650,"slug":1651,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e11","#Excel","hash-excel",{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e0f","#Microsoft Office","hash-microsoft-office",{"id":1657,"name":1658,"slug":1659,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e12","#PowerPoint","hash-powerpoint",{"id":1661,"name":1662,"slug":1663,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e10","#Word","hash-word",{"id":1665,"name":1666,"slug":1667,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f7a","#PDF to Word","hash-pdf-to-word",{"id":1669,"name":1670,"slug":1671,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f7b","#PDF to Excel","hash-pdf-to-excel",{"id":1673,"name":1674,"slug":1675,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f7c","#PDF to PowerPoint","hash-pdf-to-powerpoint",{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},"https:\u002F\u002Fcms.pdfrest.com\u002Fmicrosoft-office-files-hub\u002F","\n\n\n\n\nConvert Between PDF and Microsoft Office with pdfRest\n\n\n\npdfRest offers a comprehensive suite of tools to effortlessly convert both directions between PDF and Microsoft Office formats, including Word, Excel, and PowerPoint. Our API is designed to simplify your document conversion workflows and enhance your productivity.\n\n\n\n\nConvert PDF to Word, Excel, & PowerPoint with Ease\n\n\n\nPDF to Office Pro Tools provide a user-friendly REST API for converting PDF documents into Microsoft Office formats","PDF & Microsoft Office Conversion - Word, Excel, PowerPoint | pdfRest","Convert PDF to \u002F from Word, Excel, PowerPoint with PDF to Office Pro and Convert to PDF API Tools from pdfRest.",{"id":1683,"uuid":1684,"title":1685,"slug":1686,"html":1687,"comment_id":1688,"feature_image":48,"featured":284,"visibility":1257,"created_at":1689,"updated_at":1335,"published_at":1690,"custom_excerpt":48,"codeinjection_head":1691,"codeinjection_foot":48,"custom_template":48,"canonical_url":1692,"authors":1693,"tags":1695,"primary_author":1709,"primary_tag":1710,"url":1711,"excerpt":1712,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":1713,"meta_description":1714,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b12e0","4c06aa7f-a1d9-4dcb-9dca-ab38f663212b","PDF Archival Format (PDF\u002FA)","pdf-archival-format-pdfa","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Convert PDF Files to the Archival PDF\u002FA Format\u003C\u002Fh2>\n\n\u003Cp>pdfRest's \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfa\u002F\">Convert to PDF\u002FA\u003C\u002Fa> API empowers you to convert standard PDF files to the PDF\u002FA archival format, ensuring their long-term preservation and compatibility.\u003C\u002Fp>\n\n\u003Ch2>Validate PDF\u002FA Conformance\u003C\u002Fh2>\n\n\u003Cp>Leverage pdfRest's \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F\">Query PDF\u003C\u002Fa> API to assess the PDF\u002FA conformance of your documents. By identifying non-conformant PDFs, you can take proactive steps to convert them to the appropriate PDF\u002FA standard.\u003C\u002Fp>\n\n\u003Ch2>Key PDF\u002FA Benefits\u003C\u002Fh2>\n\n\u003Cul>\n\u003Cli>\u003Cstrong>Identify non-compliant PDFs:\u003C\u002Fstrong> Pinpoint documents that require conversion to PDF\u002FA.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Ensure long-term preservation:\u003C\u002Fstrong> Protect your valuable data from obsolescence and data loss.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Maintain compatibility:\u003C\u002Fstrong> Ensure your PDFs can be viewed and processed reliably in the future.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Meet industry standards:\u003C\u002Fstrong> Comply with regulations and requirements that mandate PDF\u002FA usage.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Supported PDF\u002FA Standards\u003C\u002Fh2>\n\n\u003Cp>pdfRest supports a wide range of PDF\u002FA standards, including:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Cstrong>PDF\u002FA-1b:\u003C\u002Fstrong> Ensures basic visual integrity over the long term. It's the most widely accepted version for simple archival needs, guaranteeing that documents will look the same when accessed in the future.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>PDF\u002FA-2b:\u003C\u002Fstrong> Supports more modern features like JPEG2000 compression and transparency, making it suitable for documents that require better image quality and more complex visual elements while maintaining compliance with archival standards.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>PDF\u002FA-2u:\u003C\u002Fstrong> Includes Unicode support for enhanced text searchability and accessibility, making it ideal for documents that need to be both visually consistent and easily searchable across different languages and character sets.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>PDF\u002FA-3b:\u003C\u002Fstrong> Allows embedding of additional file formats (e.g., XML, CSV) within the PDF, making it suitable for documents that need to include supplementary data files alongside the main document content.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>PDF\u002FA-3u:\u003C\u002Fstrong> Combines the benefits of PDF\u002FA-3b with Unicode support, offering a comprehensive solution for archival documents that require both embedded files and enhanced text searchability and accessibility.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Use PDF\u002FA-3 for Hybrid Electronic Invoices\u003C\u002Fh2>\n\n\u003Cp>ZUGFeRD and Factur-X electronic invoices use PDF\u002FA-3 to combine a visual invoice PDF with embedded, machine-readable invoice XML. The \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-zugferd-pdf\u002F\">Create ZUGFeRD PDF API Tool\u003C\u002Fa> creates this specific type of hybrid PDF\u002FA-3 invoice from canonical XML and a visual PDF, giving billing and procurement workflows one document that can be read by people and processed by systems.\u003C\u002Fp>\n\n\u003Cp>This is distinct from converting an existing PDF to PDF\u002FA for a general archival workflow. Use Create ZUGFeRD PDF when the goal is a hybrid electronic invoice; use Convert to PDF\u002FA when an existing PDF needs conversion to an archival PDF\u002FA profile.\u003C\u002Fp>\n\n\u003Cp>Safeguard your PDFs for the future with pdfRest's PDF\u002FA compliance tools.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","651f0fdf2d4014c9499b2173","2023-10-05T19:34:55.000+00:00","2023-10-05T19:34:58.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"CollectionPage\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fpdf-archival-format\u002F#collection\",\n      \"name\": \"PDF Archival Format (PDF\u002FA)\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fpdf-archival-format\u002F\",\n      \"isPartOf\": {\n        \"@type\": \"WebSite\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"mainEntity\": {\n        \"@type\": \"ItemList\",\n        \"itemListElement\": [\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 1,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fconvert-email-to-pdf-for-legal-and-compliance-archives\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 2,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fdiscover-how-pdfrest-outperforms-free-open-source-pdf-tools\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 3,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fresize-pdf-pages-for-consistent-archiving\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 4,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fchoose-the-right-pdf-a-version-for-your-archival-or-compliance-needs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 5,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fdetect-and-repair-non-conformant-pdf-a-documents\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 6,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fcreate-an-e-invoicing-pdf-workflow-for-regulatory-compliance\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 7,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fconverting-pdf-files-to-grayscale\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 8,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fconvert-html-newsletter-to-pdf-to-preserve-content\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 9,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fconvert-documents-into-encrypted-pdfs-for-archiving\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 10,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Foptimize-pdf-documents-for-long-term-preservation\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 11,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Foptimize-word-excel-and-powerpoint-files-for-long-term-preservation\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 12,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 13,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 14,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 15,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 16,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 17,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfa-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 18,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 19,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 20,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 21,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-python\u002F\"\n          }\n        ]\n      },\n      \"description\": \"Validate PDF\u002FA conformance and convert to the PDF\u002FA format with pdfRest to future-proof the compatibility of your documents and information.\",\n      \"keywords\": \"Archival, Convert to PDF\u002FA\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"PDF Archival Format (PDF\u002FA)\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fpdf-archival-format\u002F\"\n        }\n      ]\n    }\n  ]\n}","https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fpdf-archival-format\u002F",[1694],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[1696,1697,1701,1705],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1698,"name":1699,"slug":1699,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1700},"65ae9a81656af204db4b0f4a","pdf-archival-format","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Fpdf-archival-format\u002F",{"id":1702,"name":1703,"slug":1704,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e13","#Archival","hash-archival",{"id":1706,"name":1707,"slug":1708,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e16","#Convert to PDF\u002FA","hash-convert-to-pdfa",{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},"https:\u002F\u002Fcms.pdfrest.com\u002Fpdf-archival-format-pdfa\u002F","\n\n\n\n\nConvert PDF Files to the Archival PDF\u002FA Format\n\n\n\npdfRest's Convert to PDF\u002FA API empowers you to convert standard PDF files to the PDF\u002FA archival format, ensuring their long-term preservation and compatibility.\n\n\n\n\nValidate PDF\u002FA Conformance\n\n\n\nLeverage pdfRest's Query PDF API to assess the PDF\u002FA conformance of your documents. By identifying non-conformant PDFs, you can take proactive steps to convert them to the appropriate PDF\u002FA standard.\n\n\n\n\nKey PDF\u002FA Benefits\n\n\n\n * Identify non-complian","Validate & Convert to PDF\u002FA, PDF Archival Format | pdfRest","Validate PDF\u002FA conformance and convert to the PDF\u002FA format with pdfRest to future-proof the compatibility of your documents and information.",{"id":1716,"uuid":1717,"title":1718,"slug":1719,"html":1720,"comment_id":1721,"feature_image":48,"featured":284,"visibility":1257,"created_at":1722,"updated_at":1723,"published_at":1724,"custom_excerpt":48,"codeinjection_head":1725,"codeinjection_foot":48,"custom_template":48,"canonical_url":1726,"authors":1727,"tags":1729,"primary_author":1747,"primary_tag":1748,"url":1749,"excerpt":1750,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":1751,"meta_description":1752,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b12ee","dd5b306f-03be-40e5-bf74-f46da71d4c8a","PDF Compression","pdf-compression-hub","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Optimize PDF File Size with Powerful Compression\u003C\u002Fh2>\n\n\u003Cp>pdfRest empowers you to efficiently compress your PDF documents, minimizing file size while preserving the integrity of your content. Our advanced compression techniques remove hidden, unnecessary, and redundant elements, optimizing your PDFs for storage and performance.\u003C\u002Fp>\n\n\n\u003Ch2>Tailored PDF Compression Options\u003C\u002Fh2>\n\n\u003Cp>pdfRest offers a range of compression settings to suit your specific requirements. Choose from high, medium, and low compression options, allowing you to prioritize file size reduction or maintain a higher level of image fidelity. Or select custom compression to adjust compression settings for fonts, images, and other elements to achieve the optimal balance between file size and quality.\u003C\u002Fp>\n\n\n\u003Ch2>Unmatched Compression Results with Leading Technology\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcompress-pdf\u002F'>Compress PDF API Tool\u003C\u002Fa> leverages cutting-edge technology from Adobe, renowned for its expertise in PDF development. This ensures unmatched file size reduction while preserving the quality of your text and images.\u003C\u002Fp>\n\n\n\u003Ch2>Streamlined PDF Compression Integration and Scalability\u003C\u002Fh2>\n\n\u003Cp>Easily integrate pdfRest's compression functionality with your existing document storage solutions. This allows you to compress large volumes of PDFs automatically, significantly reducing your storage space requirements and associated costs.\u003C\u002Fp>\n\n\n\u003Cp>Unlock the benefits of efficient PDF compression with pdfRest. Start optimizing your documents today!\u003C\u002Fp>\n\n\u003C!--kg-card-end: html-->\n","653933742d4014c9499b2478","2023-10-25T15:25:40.000+00:00","2026-09-04T17:53:44.000+00:00","2023-10-25T15:26:26.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"CollectionPage\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fpdf-compression\u002F#collection\",\n      \"name\": \"PDF Compression\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fpdf-compression\u002F\",\n      \"isPartOf\": {\n        \"@type\": \"WebSite\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"mainEntity\": {\n        \"@type\": \"ItemList\",\n        \"itemListElement\": [\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 1,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Foptimize-web-application-performance-by-compressing-pdfs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 2,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fdiscover-how-pdfrest-outperforms-free-open-source-pdf-tools\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 3,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Foptimize-pdf-file-submissions-for-uae-digital-government-strategy-2025\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 4,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Faccess-pdf-processing-power-with-ai-magic\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 5,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fmaximize-pdf-performance-with-reduced-file-size\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 6,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Foptimize-pdfs-for-email-attachment\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 7,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-files-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 8,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-files-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 9,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-files-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 10,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 11,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 12,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 13,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-compress-pdf-files-to-reduce-file-size\u002F\"\n          }\n        ]\n      },\n      \"description\": \"Reduce PDF file size while preserving quality. Choose compression level and integrate with storage solutions to optimize for space and performance.\",\n      \"keywords\": \"Compress PDF, File Size, Performance\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"PDF Compression\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fpdf-compression\u002F\"\n        }\n      ]\n    }\n  ]\n}","https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fpdf-compression\u002F",[1728],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[1730,1731,1735,1739,1743],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1732,"name":1733,"slug":1733,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1734},"65ae9a81656af204db4b0f47","pdf-compression","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Fpdf-compression\u002F",{"id":1736,"name":1737,"slug":1738,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e18","#Compress PDF","hash-compress-pdf",{"id":1740,"name":1741,"slug":1742,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e19","#File Size","hash-file-size",{"id":1744,"name":1745,"slug":1746,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f86","#Performance","hash-performance",{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},"https:\u002F\u002Fcms.pdfrest.com\u002Fpdf-compression-hub\u002F","\n\n\n\n\nOptimize PDF File Size with Powerful Compression\n\n\n\npdfRest empowers you to efficiently compress your PDF documents, minimizing file size while preserving the integrity of your content. Our advanced compression techniques remove hidden, unnecessary, and redundant elements, optimizing your PDFs for storage and performance.\n\n\n\n\n\nTailored PDF Compression Options\n\n\n\npdfRest offers a range of compression settings to suit your specific requirements. Choose from high, medium, and low compression o","PDF Compression, Compress PDF to Reduce File Size | pdfRest","Reduce PDF file size while preserving quality. Choose compression level and integrate with storage solutions to optimize for space and performance.",{"id":1754,"uuid":1755,"title":1756,"slug":1757,"html":1758,"comment_id":1759,"feature_image":48,"featured":284,"visibility":1257,"created_at":1760,"updated_at":1761,"published_at":1762,"custom_excerpt":48,"codeinjection_head":1763,"codeinjection_foot":48,"custom_template":48,"canonical_url":1764,"authors":1765,"tags":1771,"primary_author":1817,"primary_tag":1818,"url":1819,"excerpt":1820,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":1821,"meta_description":1822,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1330","228bb8ad-92f5-45af-af30-63c86553224c","PDF Forms Processing","forms-processing-hub","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Automate PDF Forms Processing Workflows\u003C\u002Fh2>\n\u003Cp>pdfRest empowers you to automate repetitive tasks in your PDF forms processing workflows. Easily import data from external sources to pre-populate forms using the Import Form Data API. Extract data from multiple forms and consolidate it into a single source with the Export Form Data API. Ensure data integrity by locking form fields and flatten your PDFs for universal compatibility with the Flatten Forms API. Finally, convert XFA forms to Acroforms for broader accessibility using the XFA to Acroforms API.\u003C\u002Fp>\n\n\u003Ch2>Flexible Support for All PDF Form Types and Environments\u003C\u002Fh2>\n\u003Cp>pdfRest Forms Pro is your one-stop solution for automating and batch processing all PDF forms, including Static XFA, Dynamic XFA, and Acroforms. Available as both \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fproducts\u002Fcloud-api\u002F'>Cloud API\u003C\u002Fa> and \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fproducts\u002Fpdf-forms-pro-self-hosted-api\u002F'>Self-Hosted API\u003C\u002Fa> services, it offers the flexibility to integrate with your existing infrastructure.\u003C\u002Fp>\n\n\u003Ch2>Key PDF Forms Features:\u003C\u002Fh2>\n\u003Cul>\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fimport-form-data\u002F'>Import Form Data\u003C\u002Fa>:\u003C\u002Fstrong> Fill forms automatically with data from external sources.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fexport-form-data\u002F'>Export Form Data\u003C\u002Fa>:\u003C\u002Fstrong> Extract data from multiple forms for analysis and reporting.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-forms\u002F'>Flatten Forms\u003C\u002Fa>:\u003C\u002Fstrong> Lock fields and flatten PDFs for universal compatibility.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fxfa-to-acroforms\u002F'>XFA to Acroforms\u003C\u002Fa>:\u003C\u002Fstrong> Convert XFA forms to Acroforms for broader accessibility.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>Empower your workflows and improve efficiency with pdfRest Forms Pro!\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","6557d5172d4014c9499b2f0b","2023-11-17T21:03:19.000+00:00","2026-09-04T17:53:43.000+00:00","2023-11-17T21:05:13.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"CollectionPage\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fforms-processing\u002F#collection\",\n      \"name\": \"PDF Forms Processing\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fforms-processing\u002F\",\n      \"isPartOf\": {\n        \"@type\": \"WebSite\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"mainEntity\": {\n        \"@type\": \"ItemList\",\n        \"itemListElement\": [\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 1,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fdiscover-how-pdfrest-outperforms-free-open-source-pdf-tools\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 2,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fparse-pdf-files-to-streamline-data-extraction\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 3,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Foptimize-pdf-forms-for-e-signature-compatibility-solution\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 4,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fadd-generated-barcodes-to-pdf-forms\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 5,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Foptimize-filled-pdf-forms-for-universal-compatibility\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 6,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 7,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 8,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 9,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 10,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 11,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 12,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-dot-net-c-sharp\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 13,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 14,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 15,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-javascript\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 16,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 17,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 18,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-fill-out-pdf-form-input-fields\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 19,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 20,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 21,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 22,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 23,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 24,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 25,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 26,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 27,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 28,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 29,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 30,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 31,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-fill-pdf-forms\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 32,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-flatten-pdf-forms-for-compatibility-and-security\u002F\"\n          }\n        ]\n      },\n      \"description\": \"Automate PDF forms processing. Fill, extract data, lock fields, flatten, and convert XFA to Acroforms. Handle all form types: Static XFA, Dynamic XFA, and Acroforms.\",\n      \"keywords\": \"Acroforms, Barcode, Dynamic XFA, Export Form Data, Flatten Forms, Forms, Import Form Data, Static XFA, XFA, XFA to Acroforms\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"PDF Forms Processing\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fforms-processing\u002F\"\n        }\n      ]\n    }\n  ]\n}","https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fforms-processing\u002F",[1766],{"id":1767,"name":1768,"slug":1769,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1770},"65ae9a7f656af204db4b0d92","Eric Shore","eric","https:\u002F\u002Fcms.pdfrest.com\u002Fauthor\u002Feric\u002F",[1772,1773,1777,1781,1785,1789,1793,1797,1801,1805,1809,1813],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1774,"name":1775,"slug":1775,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1776},"65ae9a81656af204db4b0f85","forms-processing","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Fforms-processing\u002F",{"id":1778,"name":1779,"slug":1780,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f54","#Flatten Forms","hash-flatten-forms",{"id":1782,"name":1783,"slug":1784,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f7f","#Forms","hash-forms",{"id":1786,"name":1787,"slug":1788,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f81","#XFA","hash-xfa",{"id":1790,"name":1791,"slug":1792,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f82","#Static XFA","hash-static-xfa",{"id":1794,"name":1795,"slug":1796,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f83","#Dynamic XFA","hash-dynamic-xfa",{"id":1798,"name":1799,"slug":1800,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f80","#Acroforms","hash-acroforms",{"id":1802,"name":1803,"slug":1804,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f56","#Export Form Data","hash-export-form-data",{"id":1806,"name":1807,"slug":1808,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f55","#Import Form Data","hash-import-form-data",{"id":1810,"name":1811,"slug":1812,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"66280bf0533c9f26b943730c","#Barcode","hash-barcode",{"id":1814,"name":1815,"slug":1816,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"66e4ad50533c9f26b94384d2","#XFA to Acroforms","hash-xfa-to-acroforms",{"id":1767,"name":1768,"slug":1769,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1770},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},"https:\u002F\u002Fcms.pdfrest.com\u002Fforms-processing-hub\u002F","\n\n\n\n\nAutomate PDF Forms Processing Workflows\n\n\npdfRest empowers you to automate repetitive tasks in your PDF forms processing workflows. Easily import data from external sources to pre-populate forms using the Import Form Data API. Extract data from multiple forms and consolidate it into a single source with the Export Form Data API. Ensure data integrity by locking form fields and flatten your PDFs for universal compatibility with the Flatten Forms API. Finally, convert XFA forms to Acroforms f","PDF Forms Processing for Developers, Import & Export Data, Convert & Flatten Forms | pdfRest","Automate PDF forms processing. Fill, extract data, lock fields, flatten, and convert XFA to Acroforms. Handle all form types: Static XFA, Dynamic XFA, and Acroforms.",{"id":1824,"uuid":1825,"title":1826,"slug":1827,"html":1828,"comment_id":1824,"feature_image":48,"featured":284,"visibility":1257,"created_at":1829,"updated_at":1830,"published_at":1831,"custom_excerpt":48,"codeinjection_head":1832,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"authors":1833,"tags":1835,"primary_author":1861,"primary_tag":1862,"url":1863,"excerpt":1864,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":1865,"meta_description":1866,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6920d2e0533c9f26b943a85c","de38dcbd-66f6-43cf-92b7-f458b76a0136","PDF Generation","pdf-generation-hub","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Achieve Custom PDF Generation Workflows via API\u003C\u002Fh2>\n\n\u003Cp>Build professional PDF documents from application data using pdfRest. Start with a blank PDF canvas, add precisely positioned content, and create finished documents such as invoices, reports, statements, forms, and certificates without relying on a pre-existing template.\u003C\u002Fp>\n\n\u003Cp>The pdfRest API provides the building blocks for programmatic PDF generation:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Cstrong>Create the document foundation:\u003C\u002Fstrong> Use the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-blank-pdf\u002F\">Create Blank PDF API Tool\u003C\u002Fa> to define the page size, orientation, and number of pages.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Add dynamic content:\u003C\u002Fstrong> Use the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\">Add to PDF API Tool\u003C\u002Fa> to place text, images, lines, rectangles, and tables using application data.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Build structured layouts:\u003C\u002Fstrong> Create styled tables with headers, footers, merged cells, image cells, and multi-page overflow handling.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Support accessible workflows:\u003C\u002Fstrong> Apply optional structure tags to newly inserted text, images, shapes, and table content.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Assemble documents:\u003C\u002Fstrong> Use the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fmerge-pdfs\u002F\">Merge PDFs API Tool\u003C\u002Fa> to combine generated pages, blank canvases, templates, or supporting documents.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Prepare archival output:\u003C\u002Fstrong> Use the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfa\u002F\">Convert to PDF\u002FA API Tool\u003C\u002Fa> to prepare generated documents for long-term preservation and applicable archival workflows.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Generate Documents from Structured Data\u003C\u002Fh2>\n\n\u003Cp>PDF generation becomes especially useful when document content changes for every request. Your application can supply customer information, transaction details, measurements, product data, or other structured content, while the API controls how that data appears in the final PDF.\u003C\u002Fp>\n\n\u003Cp>Common examples include:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>Invoices with customer details, line items, taxes, totals, and payment instructions\u003C\u002Fli>\n  \u003Cli>Financial statements with account summaries and transaction tables\u003C\u002Fli>\n  \u003Cli>Shipping documents with addresses, package details, barcodes, and status information\u003C\u002Fli>\n  \u003Cli>Reports with headings, charts, tables, summaries, and supporting images\u003C\u002Fli>\n  \u003Cli>Certificates and forms with names, dates, identifiers, signatures, and organization branding\u003C\u002Fli>\n  \u003Cli>Compliance documents with required metadata, structured content, and attached source files\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>This approach keeps business data in the application while allowing the PDF layout to be generated consistently for each request.\u003C\u002Fp>\n\n\u003Ch2>Build a PDF from a Blank Canvas\u003C\u002Fh2>\n\n\u003Cp>A typical generation workflow begins with a blank document:\u003C\u002Fp>\n\n\u003Col>\n  \u003Cli>Call Create Blank PDF to establish the page dimensions and page count.\u003C\u002Fli>\n  \u003Cli>Use the returned file identifier as the input to Add to PDF.\u003C\u002Fli>\n  \u003Cli>Insert the document's text, images, shapes, and tables.\u003C\u002Fli>\n  \u003Cli>Repeat the process when additional content must be added.\u003C\u002Fli>\n  \u003Cli>Use other pdfRest API Tools to finalize, combine, secure, or archive the result.\u003C\u002Fli>\n\u003C\u002Fol>\n\n\u003Cp>For example, an invoice workflow might create a Letter-sized blank PDF, add a logo and company information, insert customer and payment details, generate a line-item table, and then add totals and footer content.\u003C\u002Fp>\n\n\u003Cp>The same workflow can also enhance an existing PDF. Add to PDF accepts an existing document when content needs to be appended to a template, report, form, or previously generated file.\u003C\u002Fp>\n\n\u003Ch2>Generate Tables and Structured Content\u003C\u002Fh2>\n\n\u003Cp>The Add to PDF API Tool supports table-oriented layouts for data-driven documents. Applications can define:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>Fixed or proportional column widths\u003C\u002Fli>\n  \u003Cli>Header and footer rows\u003C\u002Fli>\n  \u003Cli>Repeated headers when a table continues onto another page\u003C\u002Fli>\n  \u003Cli>Merged cells spanning multiple columns or rows\u003C\u002Fli>\n  \u003Cli>Cell-level text and image content\u003C\u002Fli>\n  \u003Cli>Table, row, column, and cell styling\u003C\u002Fli>\n  \u003Cli>Borders, fills, padding, opacity, and text formatting\u003C\u002Fli>\n  \u003Cli>Optional structure tags for table content\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>These capabilities make it possible to generate useful business documents directly from records, transactions, or other structured input rather than treating the PDF as a collection of unrelated text fragments.\u003C\u002Fp>\n\n\u003Ch2>Support Tagged PDF Generation\u003C\u002Fh2>\n\n\u003Cp>Generated documents can include optional structure tags for newly inserted content. These tags can identify text, images, shapes, and tables in the PDF structure for downstream processing and accessibility-oriented workflows.\u003C\u002Fp>\n\n\u003Cp>When a document is built from a blank PDF, the generated content can be tagged as it is added. When content is added to an already tagged PDF, the new tagged content can be appended while preserving the existing document structure.\u003C\u002Fp>\n\n\u003Cp>Tagging does not automatically create a complete structure tree for pre-existing untagged content. It is intended to identify content introduced by the current generation or enhancement workflow.\u003C\u002Fp>\n\n\u003Ch2>Scale Document Generation Workflows\u003C\u002Fh2>\n\n\u003Cp>Once the document layout is defined, the same workflow can be applied to large volumes of requests. Generate individualized documents from billing records, customer data, transactions, or other application events while maintaining consistent page geometry and formatting.\u003C\u002Fp>\n\n\u003Cp>Batch-oriented generation can help organizations:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>Produce customer-specific documents automatically\u003C\u002Fli>\n  \u003Cli>Reduce manual document preparation\u003C\u002Fli>\n  \u003Cli>Apply consistent branding and layout rules\u003C\u002Fli>\n  \u003Cli>Generate documents on demand or on a schedule\u003C\u002Fli>\n  \u003Cli>Integrate PDF output with storage, delivery, and archival systems\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Combine and Finalize Generated PDFs\u003C\u002Fh2>\n\n\u003Cp>Generated PDFs can be passed through additional pdfRest workflows depending on the requirements of the final document:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>Combine generated pages or supporting documents with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fmerge-pdfs\u002F\">Merge PDFs API Tool\u003C\u002Fa>.\u003C\u002Fli>\n  \u003Cli>Prepare the result for archival workflows with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfa\u002F\">Convert to PDF\u002FA API Tool\u003C\u002Fa>.\u003C\u002Fli>\n  \u003Cli>Compress the output for more efficient storage or delivery.\u003C\u002Fli>\n  \u003Cli>Attach XML, spreadsheets, or supporting files to the PDF.\u003C\u002Fli>\n  \u003Cli>Encrypt or restrict the document when access controls are required.\u003C\u002Fli>\n  \u003Cli>Upload, poll, and manage files through the supporting workflow tools.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Start Building PDFs from Application Data\u003C\u002Fh2>\n\n\u003Cp>Use the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-blank-pdf\u002F\">Create Blank PDF API Tool\u003C\u002Fa> to define the document canvas, then use the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\">Add to PDF API Tool\u003C\u002Fa> to populate it with dynamic content.\u003C\u002Fp>\n\n\u003Cp>Together, these tools provide a foundation for generating custom PDFs from scratch, enhancing existing documents, and building scalable document workflows around application data.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-11-21T21:00:16.000+00:00","2026-09-04T17:53:41.000+00:00","2025-11-21T21:05:30.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"CollectionPage\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fpdf-generation\u002F#collection\",\n      \"name\": \"PDF Generation\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fpdf-generation\u002F\",\n      \"isPartOf\": {\n        \"@type\": \"WebSite\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"mainEntity\": {\n        \"@type\": \"ItemList\",\n        \"itemListElement\": [\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 1,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fpersonalize-pdf-templates-with-dynamic-content\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 2,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fgenerate-dynamic-pdf-reports-with-structured-tables\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 3,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fcreate-tagged-pdfs-from-scratch-with-application-data\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 4,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fachieve-custom-pdf-generation-workflows-via-api\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 5,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fautomate-programmatic-pdf-invoice-generation\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 6,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fadd-page-numbers-to-pdf-documents\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 7,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fautomate-pdf-text-insertion-for-variable-data-printing\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 8,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fadd-generated-barcodes-to-pdf-forms\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 9,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fcreate-an-e-invoicing-pdf-workflow-for-regulatory-compliance\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 10,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 11,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 12,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 13,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 14,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 15,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 16,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 17,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 18,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 19,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 20,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 21,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 22,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 23,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 24,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 25,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 26,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 27,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 28,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 29,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 30,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 31,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-a-pdf-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 32,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 33,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 34,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 35,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 36,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 37,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 38,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 39,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 40,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 41,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 42,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 43,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 44,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 45,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-generate-pdf-invoice-files\u002F\"\n          }\n        ]\n      },\n      \"description\": \"Programmatically generate custom PDF documents from data, build complex reports, and create PDFs using the Create Blank PDF and Add to PDF APIs.\",\n      \"keywords\": \"Add to PDF, Create Blank PDF, PDF Generation, Tables, Tagged PDF\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"PDF Generation\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fpdf-generation\u002F\"\n        }\n      ]\n    }\n  ]\n}",[1834],{"id":1767,"name":1768,"slug":1769,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1770},[1836,1837,1841,1845,1849,1853,1857],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1838,"name":1839,"slug":1839,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1840},"6920d340533c9f26b943a862","pdf-generation","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Fpdf-generation\u002F",{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f5e","#Add to PDF","hash-add-to-pdf",{"id":1846,"name":1847,"slug":1848,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"6920ce6e533c9f26b943a84b","#Create Blank PDF","hash-create-blank-pdf",{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"6920ce6e533c9f26b943a84c","#PDF Generation","hash-pdf-generation",{"id":1854,"name":1855,"slug":1856,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"6a6cba55533c9f26b943aad9","#Tagged PDF","hash-tagged-pdf",{"id":1858,"name":1859,"slug":1860,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"6a6cefd6533c9f26b943aaf7","#Tables","hash-tables",{"id":1767,"name":1768,"slug":1769,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1770},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},"https:\u002F\u002Fcms.pdfrest.com\u002Fpdf-generation-hub\u002F","\n\n\n\n\nAchieve Custom PDF Generation Workflows via API\n\n\n\nBuild professional PDF documents from application data using pdfRest. Start with a blank PDF canvas, add precisely positioned content, and create finished documents such as invoices, reports, statements, forms, and certificates without relying on a pre-existing template.\n\n\n\nThe pdfRest API provides the building blocks for programmatic PDF generation:\n\n\n\n * Create the document foundation: Use the Create Blank PDF API Tool to define the page ","PDF Generation API, Programmatic Custom Document Creation | pdfRest","Programmatically generate custom PDF documents from data, build complex reports, and create PDFs using the Create Blank PDF and Add to PDF APIs.",{"id":1868,"uuid":1869,"title":1870,"slug":1871,"html":1872,"comment_id":1873,"feature_image":48,"featured":284,"visibility":1257,"created_at":1874,"updated_at":1723,"published_at":1875,"custom_excerpt":48,"codeinjection_head":1876,"codeinjection_foot":48,"custom_template":48,"canonical_url":1877,"authors":1878,"tags":1880,"primary_author":1942,"primary_tag":1943,"url":1944,"excerpt":1945,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":1946,"meta_description":1947,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b12ed","f6a77bfa-537f-4d51-a686-c8dcec2b488f","PDF Optimization","pdf-optimization-hub","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Optimize PDFs for Maximum Efficiency and Performance with pdfRest\u003C\u002Fh2>\n\n\u003Cp>pdfRest offers a comprehensive suite of tools to optimize your PDF documents for specific needs, from print to digital and beyond, including:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Cstrong>Print Optimization:\u003C\u002Fstrong> Prepare PDFs for high-quality printing with features like \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F'>color space conversion\u003C\u002Fa>, \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frasterize-pdf\u002F'>page rasterization\u003C\u002Fa>, and \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-transparencies\u002F'>transparency flattening\u003C\u002Fa>.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Web Viewing:\u003C\u002Fstrong> Optimize PDFs for fast loading and smooth rendering on web browsers with \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Flinearize-pdf\u002F'>linearization\u003C\u002Fa>.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Archiving:\u003C\u002Fstrong> Ensure long-term preservation of PDFs by converting them to \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfa\u002F'>archival formats\u003C\u002Fa>.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Storage:\u003C\u002Fstrong> \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcompress-pdf\u002F'>Reduce file size\u003C\u002Fa> and optimize for efficient storage without compromising quality.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Performance:\u003C\u002Fstrong> Enhance PDF performance by flattening elements like \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-annotations\u002F'>annotations\u003C\u002Fa> and \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-layers\u002F'>layers\u003C\u002Fa>.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\n\u003Ch2>Streamline Your Workflows with Batch Processing\u003C\u002Fh2>\n\n\u003Cp>pdfRest's batch processing capabilities allow you to optimize large volumes of PDFs simultaneously, saving you time and effort. Enjoy the benefits of:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Cstrong>Increased productivity:\u003C\u002Fstrong> Process multiple PDFs with concurrent API calls.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Time and cost savings:\u003C\u002Fstrong> Automate repetitive tasks and reduce manual effort.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Consistent results:\u003C\u002Fstrong> Ensure consistent optimization across all your PDFs.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\n\u003Cp>Experience the power of pdfRest's optimization tools and unlock the full potential of your PDF documents.\u003C\u002Fp>\n\n\u003C!--kg-card-end: html-->\n","653932742d4014c9499b2466","2023-10-25T15:21:24.000+00:00","2023-10-25T15:22:25.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"CollectionPage\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fpdf-optimization\u002F#collection\",\n      \"name\": \"PDF Optimization\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fpdf-optimization\u002F\",\n      \"isPartOf\": {\n        \"@type\": \"WebSite\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"mainEntity\": {\n        \"@type\": \"ItemList\",\n        \"itemListElement\": [\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 1,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fextract-structured-pdf-data-for-optimized-llm-training-with-markdown\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 2,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Foptimize-web-application-performance-by-compressing-pdfs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 3,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fdiscover-how-pdfrest-outperforms-free-open-source-pdf-tools\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 4,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fresize-pdf-pages-for-consistent-archiving\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 5,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fcrop-pdf-files-to-optimize-scanned-documents\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 6,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fremove-white-space-from-pdf-files-for-professional-printing\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 7,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Foptimize-pdf-file-submissions-for-uae-digital-government-strategy-2025\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 8,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fenhance-pdf-security-by-rasterizing-text\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 9,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fflatten-pdf-pages-to-raster-images-for-seamless-printing\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 10,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fchoose-the-right-pdf-x-version-for-your-print-needs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 11,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Foptimize-pdf-forms-for-e-signature-compatibility-solution\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 12,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fcreate-searchable-pdf-files-with-ocr\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 13,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fcreate-an-e-invoicing-pdf-workflow-for-regulatory-compliance\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 14,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fconverting-pdf-files-to-grayscale\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 15,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fmaximize-pdf-performance-with-reduced-file-size\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 16,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Foptimize-filled-pdf-forms-for-universal-compatibility\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 17,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fconvert-pdf-to-pdfx-to-optimize-for-print\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 18,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fflatten-transparencies-for-improved-print-performance\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 19,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Foptimize-pdf-documents-for-long-term-preservation\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 20,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Foptimize-word-excel-and-powerpoint-files-for-long-term-preservation\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 21,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Foptimize-pdfs-for-email-attachment\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 22,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Foptimize-pdfs-for-fast-web-viewing\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 23,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 24,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 25,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 26,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 27,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 28,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 29,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 30,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-php-code\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 31,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 32,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 33,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 34,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 35,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 36,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 37,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-layers-in-pdf-files-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 38,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-layers-of-a-pdf-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 39,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-layers-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 40,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 41,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 42,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 43,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 44,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 45,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 46,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 47,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 48,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-compress-pdf-files-to-reduce-file-size\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 49,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-crop-and-resize-pdf-pages-guide\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 50,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-flatten-pdf-forms-for-compatibility-and-security\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 51,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 52,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 53,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 54,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 55,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 56,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 57,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-c-code-in-net\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 58,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 59,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 60,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-javascript-code-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 61,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-php-code\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 62,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 63,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 64,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 65,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 66,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 67,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 68,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 69,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-in-net-with-c-2\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 70,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 71,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 72,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 73,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 74,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 75,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 76,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 77,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 78,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 79,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 80,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 81,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 82,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 83,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 84,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 85,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-python\u002F\"\n          }\n        ]\n      },\n      \"description\": \"Optimize PDFs for print, web viewing, archive, storage, performance, and other document objectives with pdfRest API Toolkit.\",\n      \"keywords\": \"API Polling, Accessibility, Attachment, Compatibility, Crop, Flatten Annotations, Flatten Layers, Linearize PDF, Optimization, Rasterize PDF, Resize, Unzip, Upload Files, Zip Files\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"PDF Optimization\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fpdf-optimization\u002F\"\n        }\n      ]\n    }\n  ]\n}","https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fpdf-optimization\u002F",[1879],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[1881,1882,1886,1890,1894,1898,1902,1906,1910,1914,1918,1922,1926,1930,1934,1938],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1883,"name":1884,"slug":1884,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1885},"65ae9a81656af204db4b0f4e","pdf-optimization","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Fpdf-optimization\u002F",{"id":1887,"name":1888,"slug":1889,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e24","#Linearize PDF","hash-linearize-pdf",{"id":1891,"name":1892,"slug":1893,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e15","#Optimization","hash-optimization",{"id":1895,"name":1896,"slug":1897,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f5c","#Flatten Annotations","hash-flatten-annotations",{"id":1899,"name":1900,"slug":1901,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f5b","#Flatten Layers","hash-flatten-layers",{"id":1903,"name":1904,"slug":1905,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f84","#Compatibility","hash-compatibility",{"id":1907,"name":1908,"slug":1909,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"661e89f2533c9f26b943714b","#Attachment","hash-attachment",{"id":1911,"name":1912,"slug":1913,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f57","#Upload Files","hash-upload-files",{"id":1915,"name":1916,"slug":1917,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65f7b777533c9f26b9436b0d","#Zip Files","hash-zip-files",{"id":1919,"name":1920,"slug":1921,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"662aa29e533c9f26b9437416","#API Polling","hash-api-polling",{"id":1923,"name":1924,"slug":1925,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"66a2bcdf533c9f26b9437f76","#Accessibility","hash-accessibility",{"id":1927,"name":1928,"slug":1929,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"67366b58533c9f26b9438e5b","#Unzip","hash-unzip",{"id":1931,"name":1932,"slug":1933,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"6793dfcc533c9f26b94391e9","#Rasterize PDF","hash-rasterize-pdf",{"id":1935,"name":1936,"slug":1937,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"68375d7b533c9f26b94399a1","#Crop","hash-crop",{"id":1939,"name":1940,"slug":1941,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"683779b9533c9f26b94399d3","#Resize","hash-resize",{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},"https:\u002F\u002Fcms.pdfrest.com\u002Fpdf-optimization-hub\u002F","\n\n\n\n\nOptimize PDFs for Maximum Efficiency and Performance with pdfRest\n\n\n\npdfRest offers a comprehensive suite of tools to optimize your PDF documents for specific needs, from print to digital and beyond, including:\n\n\n\n * Print Optimization: Prepare PDFs for high-quality printing with features like color space conversion, page rasterization, and transparency flattening.\n * Web Viewing: Optimize PDFs for fast loading and smooth rendering on web browsers with linearization.\n * Archiving: Ensure lo","PDF Optimization, Optimize for Print, Web, Archive | pdfRest","Optimize PDFs for print, web viewing, archive, storage, performance, and other document objectives with pdfRest API Toolkit.",{"id":1949,"uuid":1950,"title":1951,"slug":1952,"html":1953,"comment_id":1954,"feature_image":48,"featured":284,"visibility":1257,"created_at":1955,"updated_at":1956,"published_at":1957,"custom_excerpt":48,"codeinjection_head":1958,"codeinjection_foot":48,"custom_template":48,"canonical_url":1959,"authors":1960,"tags":1962,"primary_author":2032,"primary_tag":2033,"url":2034,"excerpt":2035,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":2036,"meta_description":2037,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b12dd","10145b3c-dd78-4c0c-abcd-92608d99ab77","PDF Security","pdf-security-hub","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Protect Sensitive Data and Control Access to PDF Documents\u003C\u002Fh2>\n\n\u003Cp>pdfRest's PDF Security API provides a robust toolkit for safeguarding sensitive information and controlling access to your PDF documents. With a wide range of features, you can implement comprehensive security measures to protect your valuable content from unauthorized access, modification, or distribution. Whether you need to redact PII, restrict editing permissions, add watermarks, prevent AI scraping, or implement advanced encryption, pdfRest's API equips you with the necessary tools to maintain the integrity and confidentiality of your PDFs.\u003C\u002Fp>\n\n\u003Ch2>Key PDF Security Features\u003C\u002Fh2>\n\u003Cul>\n\u003Cli>\u003Cstrong>Redaction:\u003C\u002Fstrong> Use \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fredact-pdf-api\u002F'>Redact PDF\u003C\u002Fa> API to find and redact private information, including exact matches or pattern matches like phone numbers, credit card numbers, and email addresses.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Digital Signatures:\u003C\u002Fstrong> Use \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsign-pdf\u002F'>Sign PDF\u003C\u002Fa> API to apply cryptographic digital signatures to PDF files, ensuring authenticity and compliance.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Password Protection:\u003C\u002Fstrong> Use \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F'>Encrypt PDF\u003C\u002Fa> API to require passwords for opening PDF documents.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Apply Restrictions:\u003C\u002Fstrong> Use \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frestrict-pdf\u002F'>Restrict PDF\u003C\u002Fa> API to control PDF editing, printing, copying, and other restrictions.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Watermarking:\u003C\u002Fstrong> Use \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fwatermark-pdf\u002F'>Watermark PDF\u003C\u002Fa> API to apply image or text watermarks to visually identify and protect your documents.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>AI Scraping Protection:\u003C\u002Fstrong> Use \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Ftdm-reserve-pdf\u002F'>TDM Reserve PDF\u003C\u002Fa> API to embed machine-readable metadata that restricts automated text and data mining, explicitly opting your content out of AI training.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>By leveraging pdfRest's PDF Security API Tools, you can effectively protect your sensitive data, control access to your documents, and deter unauthorized use.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","651f0e2d2d4014c9499b2127","2023-10-05T19:27:41.000+00:00","2026-09-04T17:53:51.000+00:00","2023-10-05T19:27:53.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"CollectionPage\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fpdf-security\u002F#collection\",\n      \"name\": \"PDF Security\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fpdf-security\u002F\",\n      \"isPartOf\": {\n        \"@type\": \"WebSite\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"mainEntity\": {\n        \"@type\": \"ItemList\",\n        \"itemListElement\": [\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 1,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fsecure-proprietary-pdf-reports-from-ai-scraping-and-data-mining\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 2,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fautomate-eu-cdsm-article-4-compliance-for-digital-pdf-publications\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 3,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fconvert-email-to-pdf-for-legal-and-compliance-archives\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 4,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fsecure-digital-contracts-for-remote-teams-and-clients\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 5,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fstreamline-batch-pdf-signing-for-high-volume-workflows\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 6,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fdiscover-how-pdfrest-outperforms-free-open-source-pdf-tools\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 7,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fprotect-data-privacy-in-financial-services-with-pdf-redaction-solution\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 8,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fchoose-the-right-pdf-a-version-for-your-archival-or-compliance-needs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 9,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fensure-patient-privacy-in-healthcare-research-with-pdf-redaction-solution\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 10,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fensure-gdpr-compliance-for-pdf-processing-with-eu-based-cloud-api\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 11,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fself-host-your-pdf-processing-api-on-premises-with-container-deployment\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 12,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Foptimize-pdf-file-submissions-for-uae-digital-government-strategy-2025\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 13,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fenhance-pdf-security-by-rasterizing-text\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 14,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Faccess-pdf-processing-power-with-ai-magic\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 15,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fadd-pdf-watermarks-that-cannot-be-removed\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 16,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fpreserving-copyright-through-watermarking\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 17,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fcreate-secure-document-workflows-with-pdf-password-protection\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 18,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fbest-fit-pdf-toolkit-integration-for-any-application-or-workflow\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 19,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fconvert-documents-into-encrypted-pdfs-for-archiving\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 20,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fcontrol-your-backend-with-pdfrest-api-toolkit-self-hosted\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 21,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fdelete-pages-from-a-pdf-to-sanitize-documents\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 22,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 23,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 24,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 25,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 26,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 27,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 28,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-automate-pdf-digital-signatures-for-secure-and-efficient-workflows-guide\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 29,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-automate-pdf-redaction-for-data-privacy-and-compliance-guide\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 30,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 31,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 32,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 33,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 34,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 35,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 36,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 37,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 38,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 39,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 40,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 41,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 42,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-in-net-with-c-code\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 43,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-curl-code\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 44,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-java-code\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 45,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-javascript-code-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 46,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 47,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 48,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-files-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 49,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-files-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 50,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 51,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 52,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 53,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 54,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-add-watermark-to-pdf\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 55,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-flatten-pdf-forms-for-compatibility-and-security\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 56,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-redact-pdf-files-to-remove-sensitive-data\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 57,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-sign-pdf-documents-with-digital-signatures-guide\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 58,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-in-net-with-c-code\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 59,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-curl-code\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 60,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-java-code\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 61,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-javascript-code-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 62,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-php-code\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 63,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-python-code\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 64,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 65,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 66,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 67,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 68,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 69,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 70,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 71,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 72,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 73,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 74,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 75,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 76,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 77,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 78,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 79,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 80,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 81,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 82,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 83,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-python\u002F\"\n          }\n        ]\n      },\n      \"description\": \"Learn how to secure and protect your PDF documents with a safe and reliable API service from pdfRest. Encrypt with password-protection, restrict access rights, & add watermarks.\",\n      \"keywords\": \"Compliance, Copyright, Decrypt PDF, Delete File, Digital Signature, EU, Encrypt PDF, GDPR, Password, Redact PDF, Restrict PDF, Sanitization, Security, Sign PDF, TDM Reserve PDF, Watermark PDF\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"PDF Security\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fpdf-security\u002F\"\n        }\n      ]\n    }\n  ]\n}","https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fpdf-security\u002F",[1961],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[1963,1964,1968,1972,1976,1980,1984,1988,1992,1996,2000,2004,2008,2012,2016,2020,2024,2028],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1965,"name":1966,"slug":1966,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1967},"65ae9a81656af204db4b0f46","pdf-security","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Fpdf-security\u002F",{"id":1969,"name":1970,"slug":1971,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0ea9","#Copyright","hash-copyright",{"id":1973,"name":1974,"slug":1975,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e75","#Decrypt PDF","hash-decrypt-pdf",{"id":1977,"name":1978,"slug":1979,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e79","#Password","hash-password",{"id":1981,"name":1982,"slug":1983,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e76","#Restrict PDF","hash-restrict-pdf",{"id":1985,"name":1986,"slug":1987,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e26","#Sanitization","hash-sanitization",{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e65","#Security","hash-security",{"id":1993,"name":1994,"slug":1995,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0ea8","#Watermark PDF","hash-watermark-pdf",{"id":1997,"name":1998,"slug":1999,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e74","#Encrypt PDF","hash-encrypt-pdf",{"id":2001,"name":2002,"slug":2003,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"67d0b2c5533c9f26b9439406","#GDPR","hash-gdpr",{"id":2005,"name":2006,"slug":2007,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"67d0b2c5533c9f26b9439407","#Compliance","hash-compliance",{"id":2009,"name":2010,"slug":2011,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"67d0b2c5533c9f26b9439408","#EU","hash-eu",{"id":2013,"name":2014,"slug":2015,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"680a7e16533c9f26b943953e","#Redact PDF","hash-redact-pdf",{"id":2017,"name":2018,"slug":2019,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"687a7471533c9f26b9439e29","#Sign PDF","hash-sign-pdf",{"id":2021,"name":2022,"slug":2023,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"687a9b7d533c9f26b9439e8d","#Digital Signature","hash-digital-signature",{"id":2025,"name":2026,"slug":2027,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"68e94c0a533c9f26b943a723","#Delete File","hash-delete-file",{"id":2029,"name":2030,"slug":2031,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"69eb8570533c9f26b943a9bd","#TDM Reserve PDF","hash-tdm-reserve-pdf",{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},"https:\u002F\u002Fcms.pdfrest.com\u002Fpdf-security-hub\u002F","\n\n\n\n\nProtect Sensitive Data and Control Access to PDF Documents\n\n\n\npdfRest's PDF Security API provides a robust toolkit for safeguarding sensitive information and controlling access to your PDF documents. With a wide range of features, you can implement comprehensive security measures to protect your valuable content from unauthorized access, modification, or distribution. Whether you need to redact PII, restrict editing permissions, add watermarks, prevent AI scraping, or implement advanced enc","PDF Security - Encrypt, Restrict, Watermark to Secure PDF Files | pdfRest","Learn how to secure and protect your PDF documents with a safe and reliable API service from pdfRest. Encrypt with password-protection, restrict access rights, & add watermarks.",{"id":2039,"uuid":2040,"title":2041,"slug":2042,"html":2043,"comment_id":2044,"feature_image":48,"featured":284,"visibility":1257,"created_at":2045,"updated_at":2046,"published_at":2047,"custom_excerpt":48,"codeinjection_head":2048,"codeinjection_foot":48,"custom_template":48,"canonical_url":2049,"authors":2050,"tags":2052,"primary_author":2106,"primary_tag":2107,"url":2108,"excerpt":2109,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":2110,"meta_description":2111,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b12e4","d10e4ac1-b516-4977-941d-38e2fde9c5af","Platform Integrations","platform-integrations-hub","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Streamline PDF Workflows with pdfRest and Low-Code \u002F No-Code Solutions\u003C\u002Fh2>\n\u003Cp>pdfRest seamlessly integrates with popular low-code and no-code platforms, empowering you to create secure and efficient PDF document workflows without extensive coding. This approach enables rapid development, deployment, and scaling to meet your evolving needs.\u003C\u002Fp>\n\n\u003Ch2>Leverage Powerful Integrations\u003C\u002Fh2>\n\u003Cp>pdfRest supports integration with a wide range of third-party services, including low-code and no-code solutions like:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fintegrate-with-microsoft-power-automate\u002F'>Microsoft Power Automate\u003C\u002Fa>:\u003C\u002Fstrong> Automate tasks and build workflows for PDF processing within the Microsoft ecosystem.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fintegrate-pdfrest-with-salesforce-apex-code\u002F'>Salesforce Apex\u003C\u002Fa>:\u003C\u002Fstrong> Extend Salesforce functionality and integrate pdfRest's PDF processing capabilities directly into your CRM.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fintegrate-pdfrest-with-zapier-automation-google-drive-storage\u002F'>Zapier\u003C\u002Fa>:\u003C\u002Fstrong> Connect pdfRest with thousands of other applications to create powerful automated workflows.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fintegrate-pdfrest-with-bubble-to-automate-pdf-workflows'>Bubble.io\u003C\u002Fa>:\u003C\u002Fstrong> Build user-friendly web applications with drag-and-drop functionality and integrate pdfRest for seamless PDF processing.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fintegrate-pdfrest-with-make-automation-google-drive-storage\u002F'>Make.com\u003C\u002Fa>:\u003C\u002Fstrong> Automate complex workflows connecting pdfRest with various applications and data sources for a unified solution.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fintegrate-pdfrest-with-n8n-automation-and-dropbox-storage\u002F'>n8n.io\u003C\u002Fa>:\u003C\u002Fstrong> Create flexible and powerful low-code workflows to connect pdfRest with over 400+ applications and services.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fgithub.com\u002Fdatalogics\u002Fpdf-rest-api-samples\u002Ftree\u002Fmain\u002FGoogle%20Apps%20Script'>Google Apps Script\u003C\u002Fa>:\u003C\u002Fstrong> Leverage Google Apps Script for custom scripting and integrate pdfRest's APIs for powerful PDF automation within Google Workspace.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>And more!\u003C\u002Fstrong> Easily integrate pdfRest with any service that can send out API Calls as standard http requests.\u003C\u002Fp>\n\u003C\u002Ful>\n\n\n\u003Cp>Unlock the power of low-code\u002Fno-code development and pdfRest's robust PDF processing capabilities. Start building secure and efficient workflows today!\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","651f10e52d4014c9499b21c3","2023-10-05T19:39:17.000+00:00","2026-09-04T17:53:46.000+00:00","2023-10-05T19:40:06.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"CollectionPage\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fplatform-integrations\u002F#collection\",\n      \"name\": \"Platform Integrations\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fplatform-integrations\u002F\",\n      \"isPartOf\": {\n        \"@type\": \"WebSite\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"mainEntity\": {\n        \"@type\": \"ItemList\",\n        \"itemListElement\": [\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 1,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fintegrate-pdfrest-with-bubble-to-automate-pdf-workflows\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 2,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fintegrate-pdfrest-with-make-automation-google-drive-storage\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 3,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fintegrate-pdfrest-with-zapier-automation-google-drive-storage\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 4,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fintegrate-pdfrest-with-n8n-automation-and-dropbox-storage\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 5,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Ftransform-pdf-files-to-markdown-for-dynamic-web-content-seo\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 6,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fdiscover-how-pdfrest-outperforms-free-open-source-pdf-tools\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 7,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fadd-generated-barcodes-to-pdf-forms\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 8,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fgenerating-summaries-of-pdf-documents-using-chatgpt\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 9,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Ftranslate-pdf-text-to-new-language-with-chatgpt\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 10,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fintegrate-with-microsoft-power-automate\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 11,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fintegrate-pdfrest-with-chatgpt-to-generate-pdf-info-summary\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 12,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fintegrate-pdfrest-with-salesforce-apex-code\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 13,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-automate-pdf-digital-signatures-for-secure-and-efficient-workflows-guide\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 14,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-automate-pdf-redaction-for-data-privacy-and-compliance-guide\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 15,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-automate-pdf-to-markdown-conversions-for-content-repurposing-and-llm-training\u002F\"\n          }\n        ]\n      },\n      \"description\": \"Integrate PDF processing workflows with low-code and no-code services using pdfRest API Tools. Connect pdfRest with Power Automate, Salesforce, Bubble.io, & more.\",\n      \"keywords\": \"Apex, Bubble, Integration, Low Code, Make, Microsoft Power Automate, No Code, Power Automate, Salesforce, Workato, Zapier, n8n\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Platform Integrations\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fplatform-integrations\u002F\"\n        }\n      ]\n    }\n  ]\n}","https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fplatform-integrations\u002F",[2051],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[2053,2054,2058,2062,2066,2070,2074,2078,2082,2086,2090,2094,2098,2102],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":2055,"name":2056,"slug":2056,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2057},"65ae9a81656af204db4b0f4f","platform-integrations","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Fplatform-integrations\u002F",{"id":2059,"name":2060,"slug":2061,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e9d","#Apex","hash-apex",{"id":2063,"name":2064,"slug":2065,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e9c","#Integration","hash-integration",{"id":2067,"name":2068,"slug":2069,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0efc","#Low Code","hash-low-code",{"id":2071,"name":2072,"slug":2073,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0efb","#Microsoft Power Automate","hash-microsoft-power-automate",{"id":2075,"name":2076,"slug":2077,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0efd","#No Code","hash-no-code",{"id":2079,"name":2080,"slug":2081,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0efe","#Power Automate","hash-power-automate",{"id":2083,"name":2084,"slug":2085,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e9b","#Salesforce","hash-salesforce",{"id":2087,"name":2088,"slug":2089,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"68b9e104533c9f26b943a1fd","#Zapier","hash-zapier",{"id":2091,"name":2092,"slug":2093,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"68b9d8fd533c9f26b943a1eb","#n8n","hash-n8n",{"id":2095,"name":2096,"slug":2097,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"68bb42e7533c9f26b943a398","#Make","hash-make",{"id":2099,"name":2100,"slug":2101,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"68cad1c0533c9f26b943a4eb","#Bubble","hash-bubble",{"id":2103,"name":2104,"slug":2105,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"68cad1f2533c9f26b943a4f4","#Workato","hash-workato",{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},"https:\u002F\u002Fcms.pdfrest.com\u002Fplatform-integrations-hub\u002F","\n\n\n\n\nStreamline PDF Workflows with pdfRest and Low-Code \u002F No-Code Solutions\n\n\npdfRest seamlessly integrates with popular low-code and no-code platforms, empowering you to create secure and efficient PDF document workflows without extensive coding. This approach enables rapid development, deployment, and scaling to meet your evolving needs.\n\n\n\n\nLeverage Powerful Integrations\n\n\npdfRest supports integration with a wide range of third-party services, including low-code and no-code solutions like:\n\n\n","Platform Integrations for Low-Code, No-Code PDF Processing | pdfRest","Integrate PDF processing workflows with low-code and no-code services using pdfRest API Tools. Connect pdfRest with Power Automate, Salesforce, Bubble.io, & more.",{"id":2113,"uuid":2114,"title":2115,"slug":2116,"html":2117,"comment_id":2118,"feature_image":48,"featured":284,"visibility":1257,"created_at":2119,"updated_at":2120,"published_at":2121,"custom_excerpt":48,"codeinjection_head":2122,"codeinjection_foot":48,"custom_template":48,"canonical_url":2123,"authors":2124,"tags":2126,"primary_author":2192,"primary_tag":2193,"url":2194,"excerpt":2195,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":2196,"meta_description":2197,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b12da","4748ab16-04dc-4a54-953a-cbbde9b077b1","Prepress Preflight Print","print","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Ensure Flawless Printing with pdfRest's Prepress Automation Solutions\u003C\u002Fh2>\n\u003C!--kg-card-end: html-->\n\u003Cfigure class=\"kg-card kg-embed-card\">\u003Ciframe width=\"200\" height=\"113\" src=\"https:\u002F\u002Fwww.youtube.com\u002Fembed\u002FD938x1ug8XI?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen=\"\" title=\"How to Automate a Print-Ready PDF Solution | pdfRest\">\u003C\u002Fiframe>\u003C\u002Ffigure>\n\u003C!--kg-card-begin: html-->\n\u003Cp>Streamline document preparation and eliminate costly printing errors with pdfRest's powerful suite of prepress and preflight tools tailored for the print industry.\u003C\u002Fp>\n\n\u003Ch2>Optimize Print Workflows and Eliminate Errors\u003C\u002Fh2>\n\u003Cp>In commercial printing, even minor PDF errors can lead to costly reprints and missed deadlines. pdfRest’s prepress tools ensure your documents are print-ready and compliant with industry standards like PDF\u002FX. Our API tools enhance your prepress with color conversions, precisely set boxes (media, crop, trim, bleed, art), and transparency flattening, helping you achieve print-ready PDFs.\u003C\u002Fp>\n\n\u003Ch2>Key Preflight Features for Developers:\u003C\u002Fh2>\n\u003Cul>\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfx\u002F'>Convert to PDF\u002FX API Tool\u003C\u002Fa>:\u003C\u002Fstrong> Achieve the print-ready standards required by printers worldwide.\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-transparencies\u002F'>Flatten Transparencies API Tool\u003C\u002Fa>:\u003C\u002Fstrong> Prevent unexpected print results by flattening transparency layers.\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F'>Convert PDF Colors API Tool\u003C\u002Fa>:\u003C\u002Fstrong> Ensure accurate color representation by converting RGB to CMYK.\n\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frasterize-pdf\u002F'>Rasterize PDF API Tool\u003C\u002Fa>:\u003C\u002Fstrong> Flatten PDF pages to raster images for simplified printing.\n\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fset-page-boxes\u002F'>Set Page Boxes API Tool\u003C\u002Fa>:\u003C\u002Fstrong> Set MediaBox, CropBox, BleedBox, TrimBox, and ArtBox.\n\u003C\u002Fli>\n\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-postscript\u002F'>PDF to PostScript API Tool\u003C\u002Fa>:\u003C\u002Fstrong> Convert PDF to PostScript for print production workflows.\n\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch2>Why Choose pdfRest for Prepress Solutions?\u003C\u002Fh2>\n\u003Cul>\n\u003Cli>\u003Cstrong>Customizable Automations:\u003C\u002Fstrong> Combine tools for transparency flattening and PDF optimization, allowing you to tailor workflows to your needs.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Industry Standards Compliance:\u003C\u002Fstrong> Our tools prepare files to meet PDF\u002FX and other complex commercial printing requirements.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Developer-Friendly API:\u003C\u002Fstrong> Easily integrate pdfRest’s API into your systems with comprehensive documentation and support.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Cost Reduction & Efficiency:\u003C\u002Fstrong> Automate the prepress process to avoid reprints and ensure print-ready PDFs from the start.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Seamless Color Management:\u003C\u002Fstrong> Convert RGB to CMYK for consistent color accuracy across all printed materials.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Quality Adobe Technology:\u003C\u002Fstrong> Powered by Adobe PDF Library and Adobe PDF Converter, technologies that power Acrobat and Distiller.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003C!--kg-card-end: html-->\n","651d77242d4014c9499b20b6","2023-10-04T14:31:00.000+00:00","2026-09-04T19:39:01.000+00:00","2023-10-04T15:46:27.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"CollectionPage\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fprepress-preflight-print\u002F#collection\",\n      \"name\": \"Prepress Preflight Print\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fprepress-preflight-print\u002F\",\n      \"isPartOf\": {\n        \"@type\": \"WebSite\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"mainEntity\": {\n        \"@type\": \"ItemList\",\n        \"itemListElement\": [\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 1,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fdiscover-how-pdfrest-outperforms-free-open-source-pdf-tools\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 2,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fresize-pdf-pages-for-consistent-archiving\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 3,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fcrop-pdf-files-to-optimize-scanned-documents\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 4,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fremove-white-space-from-pdf-files-for-professional-printing\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 5,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fflatten-pdf-pages-to-raster-images-for-seamless-printing\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 6,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fautomate-pdf-text-insertion-for-variable-data-printing\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 7,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fconvert-color-pdf-to-black-and-white-for-print\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 8,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fchoose-the-right-pdf-x-version-for-your-print-needs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 9,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fautomate-pdf-prepress-for-direct-mailing-jobs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 10,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fconvert-pdf-files-from-rgb-to-cmyk-for-print\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 11,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fstreamline-document-color-management-for-consistent-printing\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 12,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fconverting-pdf-files-to-grayscale\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 13,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fconvert-pdf-to-pdfx-to-optimize-for-print\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 14,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fflattening-pdf-transparencies-while-retaining-color-fidelity\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 15,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fflatten-transparencies-for-improved-print-performance\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 16,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Frender-pdf-pages-to-graphic-file-formats-with-accurate-color-preservation\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 17,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fmerge-multiple-types-of-files-together\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 18,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 19,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 20,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 21,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 22,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 23,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 24,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 25,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 26,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 27,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 28,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 29,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 30,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 31,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 32,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 33,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 34,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 35,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 36,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-x-in-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 37,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfx-with-net-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 38,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-x-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 39,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfx-with-javascript\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 40,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfx-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 41,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfx-with-python-2\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 42,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 43,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 44,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 45,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 46,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-php-code\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 47,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 48,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 49,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 50,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 51,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 52,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 53,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 54,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-convert-pdf-to-pdf-x-for-print-ready-documents\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 55,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-programmatically-crop-and-resize-pdf-pages-guide\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 56,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-in-net-with-c\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 57,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 58,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 59,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-javascript-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 60,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-php\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 61,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-python\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 62,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-c-code-in-net\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 63,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-curl\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 64,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-java\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 65,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-javascript-code-in-nodejs\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 66,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-php-code\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 67,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-python\u002F\"\n          }\n        ]\n      },\n      \"description\": \"Streamline your document preparation for print with pdfRest's prepress and preflight solutions, including preflight checks and optimizations.\",\n      \"keywords\": \"Black & White, CMYK, Color Management, Convert PDF Colors, Convert to PDF\u002FX, Flatten Transparencies, PDF Refrying, PDF to PostScript, PostScript, Prepress, Print, RGB, Set Page Boxes, Translucency, Transparency\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Prepress Preflight Print\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fprepress-preflight-print\u002F\"\n        }\n      ]\n    }\n  ]\n}","https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fprepress-preflight-print\u002F",[2125],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[2127,2128,2132,2136,2140,2144,2148,2152,2156,2160,2164,2168,2172,2176,2180,2184,2188],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":2129,"name":2130,"slug":2130,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2131},"65ae9a81656af204db4b0f43","prepress-preflight-print","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Fprepress-preflight-print\u002F",{"id":2133,"name":2134,"slug":2135,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e1d","#PostScript","hash-postscript",{"id":2137,"name":2138,"slug":2139,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e2d","#Print","hash-print",{"id":2141,"name":2142,"slug":2143,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e56","#Translucency","hash-translucency",{"id":2145,"name":2146,"slug":2147,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e2c","#Transparency","hash-transparency",{"id":2149,"name":2150,"slug":2151,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e80","#Color Management","hash-color-management",{"id":2153,"name":2154,"slug":2155,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f61","#Prepress","hash-prepress",{"id":2157,"name":2158,"slug":2159,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f5a","#Convert to PDF\u002FX","hash-convert-to-pdfx",{"id":2161,"name":2162,"slug":2163,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"66759dfb533c9f26b9437c06","#Convert PDF Colors","hash-convert-pdf-colors",{"id":2165,"name":2166,"slug":2167,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"670ee3cf533c9f26b943876d","#CMYK","hash-cmyk-2",{"id":2169,"name":2170,"slug":2171,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"670ee1fc533c9f26b9438759","#RGB","hash-rgb",{"id":2173,"name":2174,"slug":2175,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e2b","#Flatten Transparencies","hash-flatten-transparencies",{"id":2177,"name":2178,"slug":2179,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"671293b5533c9f26b9438922","#Black & White","hash-black-white",{"id":2181,"name":2182,"slug":2183,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"68373fba533c9f26b943992d","#Set Page Boxes","hash-set-page-boxes",{"id":2185,"name":2186,"slug":2187,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"6a9a5143d1b70dd2e2978ce2","#PDF to PostScript","hash-pdf-to-postscript",{"id":2189,"name":2190,"slug":2191,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"6a999118d1b70dd2e2978a8c","#PDF Refrying","hash-pdf-refrying",{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},"https:\u002F\u002Fcms.pdfrest.com\u002Fprint\u002F","\n\n\n\n\nEnsure Flawless Printing with pdfRest's Prepress Automation Solutions\n\n\n\n\n\nStreamline document preparation and eliminate costly printing errors with pdfRest's powerful suite of prepress and preflight tools tailored for the print industry.\n\n\n\n\nOptimize Print Workflows and Eliminate Errors\n\n\nIn commercial printing, even minor PDF errors can lead to costly reprints and missed deadlines. pdfRest’s prepress tools ensure your documents are print-ready and compliant with industry standards like PD","PDF Prepress & Preflight Print API Tools for Developers | pdfRest","Streamline your document preparation for print with pdfRest's prepress and preflight solutions, including preflight checks and optimizations.",{"id":2199,"uuid":2200,"title":2201,"slug":2202,"html":2203,"comment_id":2204,"feature_image":48,"featured":284,"visibility":1257,"created_at":2205,"updated_at":2206,"published_at":2207,"custom_excerpt":48,"codeinjection_head":2208,"codeinjection_foot":48,"custom_template":48,"canonical_url":2209,"authors":2210,"tags":2212,"primary_author":2242,"primary_tag":2243,"url":2244,"excerpt":2245,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":2246,"meta_description":2247,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b134e","1daffe00-c3b1-41fa-82b8-e29cee3adc18","Programming Languages","programming-languages-hub","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Process PDFs with Your Favorite Programming Language\u003C\u002Fh2>\n\n\u003Cp>pdfRest empowers you to seamlessly integrate its robust PDF processing capabilities into your existing workflows, regardless of your preferred programming language. Whether you're using Python, JavaScript, C#, Java, PHP, or something else, pdfRest provides the tools and resources to get started quickly and efficiently.\u003C\u002Fp>\n\n\n\u003Ch2>Robust Code Examples for PDF Solutions\u003C\u002Fh2>\n\n\u003Cp>pdfRest's \u003Ca href='https:\u002F\u002Fgithub.com\u002Fdatalogics\u002Fpdf-rest-api-samples'>GitHub Code Sample Repository\u003C\u002Fa> serves as a valuable resource for developers seeking further guidance on pdfRest integration. This repository offers a wealth of code samples and examples across various programming languages, providing practical illustrations of how to implement pdfRest's functionalities.\u003C\u002Fp>\n\n\u003Ch2>Additional pdfRest Developer Resources\u003C\u002Fh2>\n\n\u003Cul>\n  \u003Cli>\u003Cstrong>API Lab:\u003C\u002Fstrong> Test and validate with the \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F'>API Lab\u003C\u002Fa> web interface. Process files online and automatically generate custom code.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Language-specific tutorials:\u003C\u002Fstrong> Find the right \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F'>tutorial\u003C\u002Fa> to learn how to integrate pdfRest with your chosen language for a smooth development experience.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>API Reference Guide:\u003C\u002Fstrong> Use the \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fdocumentation'>API Reference Guide\u003C\u002Fa> to look up endpoints and understand how to configure pdfRest's API for specific tasks.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>Start integrating pdfRest with your chosen programming language today and unlock a world of possibilities for your PDF processing needs!\u003C\u002Fp>\n\n\u003C!--kg-card-end: html-->\n","657ca2d22d4014c9499b3921","2023-12-15T19:02:42.000+00:00","2026-09-04T17:53:42.000+00:00","2023-12-15T19:04:28.000+00:00","{\"@context\":\"https:\u002F\u002Fschema.org\",\"@graph\":[{\"@type\":\"CollectionPage\",\"@id\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fprogramming-languages\u002F#collection\",\"name\":\"Programming Languages\",\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fprogramming-languages\u002F\",\"isPartOf\":{\"@type\":\"WebSite\",\"name\":\"pdfRest\",\"url\":\"https:\u002F\u002Fpdfrest.com\u002F\"},\"mainEntity\":{\"@type\":\"ItemList\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fdiscover-how-pdfrest-outperforms-free-open-source-pdf-tools\u002F\"},{\"@type\":\"ListItem\",\"position\":2,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fgenerating-summaries-of-pdf-documents-using-chatgpt\u002F\"},{\"@type\":\"ListItem\",\"position\":3,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Ftranslate-pdf-text-to-new-language-with-chatgpt\u002F\"},{\"@type\":\"ListItem\",\"position\":4,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fintegrate-pdfrest-with-chatgpt-to-generate-pdf-info-summary\u002F\"},{\"@type\":\"ListItem\",\"position\":5,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files\u002F\"},{\"@type\":\"ListItem\",\"position\":6,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":7,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":8,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":9,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":10,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":11,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":12,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":13,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":14,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":15,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":16,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":17,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":18,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":19,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":20,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":21,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":22,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":23,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":24,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":25,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":26,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-a-pdf-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":27,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":28,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":29,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":30,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":31,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":32,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":33,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":34,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":35,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":36,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":37,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":38,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":39,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":40,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":41,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":42,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":43,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":44,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":45,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":46,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":47,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":48,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":49,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":50,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":51,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":52,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-files-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":53,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-files-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":54,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-files-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":55,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":56,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":57,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":58,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":59,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":60,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":61,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":62,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":63,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":64,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":65,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":66,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":67,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":68,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":69,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":70,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":71,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":72,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":73,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":74,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":75,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":76,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":77,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":78,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":79,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":80,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":81,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":82,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":83,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":84,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":85,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":86,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":87,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":88,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":89,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":90,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":91,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":92,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":93,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":94,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":95,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":96,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":97,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":98,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":99,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":100,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":101,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":102,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":103,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":104,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":105,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":106,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":107,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":108,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":109,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":110,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-word-to-pdf-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":111,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":112,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":113,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":114,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":115,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":116,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":117,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":118,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":119,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":120,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":121,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":122,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":123,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":124,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":125,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":126,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":127,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":128,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":129,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":130,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":131,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":132,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":133,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":134,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":135,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":136,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":137,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":138,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":139,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":140,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":141,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":142,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":143,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":144,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":145,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":146,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":147,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":148,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":149,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":150,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":151,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":152,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-image-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":153,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":154,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":155,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-java-code\u002F\"},{\"@type\":\"ListItem\",\"position\":156,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":157,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-php-code\u002F\"},{\"@type\":\"ListItem\",\"position\":158,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":159,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":160,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":161,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":162,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":163,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":164,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfa-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":165,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-x-in-java\u002F\"},{\"@type\":\"ListItem\",\"position\":166,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfx-with-net-c\u002F\"},{\"@type\":\"ListItem\",\"position\":167,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-x-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":168,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfx-with-javascript\u002F\"},{\"@type\":\"ListItem\",\"position\":169,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfx-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":170,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfx-with-python-2\u002F\"},{\"@type\":\"ListItem\",\"position\":171,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":172,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":173,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":174,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":175,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":176,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":177,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":178,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":179,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":180,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":181,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":182,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":183,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":184,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":185,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":186,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":187,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":188,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":189,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":190,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":191,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":192,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":193,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":194,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":195,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":196,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":197,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":198,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":199,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":200,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":201,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":202,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-in-php\u002F\"},{\"@type\":\"ListItem\",\"position\":203,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-in-python\u002F\"},{\"@type\":\"ListItem\",\"position\":204,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":205,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":206,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":207,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":208,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":209,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":210,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":211,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":212,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":213,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":214,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":215,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":216,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":217,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":218,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":219,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":220,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":221,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":222,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":223,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":224,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":225,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":226,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":227,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-php-code\u002F\"},{\"@type\":\"ListItem\",\"position\":228,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":229,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":230,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":231,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":232,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":233,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":234,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":235,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":236,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":237,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":238,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":239,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":240,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-in-net-with-c-code\u002F\"},{\"@type\":\"ListItem\",\"position\":241,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-curl-code\u002F\"},{\"@type\":\"ListItem\",\"position\":242,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-java-code\u002F\"},{\"@type\":\"ListItem\",\"position\":243,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-javascript-code-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":244,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":245,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":246,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-files-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":247,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-files-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":248,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":249,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":250,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":251,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":252,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-dot-net-c-sharp\u002F\"},{\"@type\":\"ListItem\",\"position\":253,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":254,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":255,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-javascript\u002F\"},{\"@type\":\"ListItem\",\"position\":256,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":257,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":258,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":259,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":260,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":261,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":262,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":263,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":264,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":265,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":266,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":267,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":268,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":269,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":270,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-dot-net-c-sharp\u002F\"},{\"@type\":\"ListItem\",\"position\":271,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":272,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":273,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-javascript\u002F\"},{\"@type\":\"ListItem\",\"position\":274,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":275,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":276,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":277,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":278,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":279,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":280,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":281,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-layers-in-pdf-files-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":282,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-layers-of-a-pdf-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":283,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":284,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":285,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":286,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":287,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":288,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":289,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-layers-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":290,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":291,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":292,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":293,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":294,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":295,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":296,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":297,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":298,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":299,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":300,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":301,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":302,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":303,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":304,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":305,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":306,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":307,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":308,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":309,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":310,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdfs-with-dot-net-c-sharp\u002F\"},{\"@type\":\"ListItem\",\"position\":311,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdf-files-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":312,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdf-files-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":313,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdf-files-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":314,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdfs-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":315,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdf-documents-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":316,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":317,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":318,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":319,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":320,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":321,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":322,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":323,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":324,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-in-net-with-c-code\u002F\"},{\"@type\":\"ListItem\",\"position\":325,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-curl-code\u002F\"},{\"@type\":\"ListItem\",\"position\":326,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-java-code\u002F\"},{\"@type\":\"ListItem\",\"position\":327,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-javascript-code-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":328,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-php-code\u002F\"},{\"@type\":\"ListItem\",\"position\":329,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-python-code\u002F\"},{\"@type\":\"ListItem\",\"position\":330,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":331,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":332,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":333,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":334,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":335,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":336,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":337,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":338,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-c-code-in-net\u002F\"},{\"@type\":\"ListItem\",\"position\":339,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":340,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":341,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-javascript-code-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":342,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-php-code\u002F\"},{\"@type\":\"ListItem\",\"position\":343,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":344,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":345,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":346,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":347,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":348,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":349,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":350,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":351,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":352,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":353,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":354,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":355,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":356,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":357,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":358,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":359,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":360,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":361,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":362,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":363,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":364,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":365,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":366,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":367,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":368,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":369,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":370,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":371,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":372,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":373,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":374,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-in-net-with-c-2\u002F\"},{\"@type\":\"ListItem\",\"position\":375,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":376,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":377,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":378,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":379,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":380,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":381,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":382,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":383,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":384,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":385,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":386,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":387,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":388,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":389,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":390,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":391,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":392,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":393,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":394,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":395,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":396,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":397,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":398,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":399,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":400,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":401,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":402,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-python\u002F\"},{\"@type\":\"ListItem\",\"position\":403,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-in-net-with-c\u002F\"},{\"@type\":\"ListItem\",\"position\":404,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-curl\u002F\"},{\"@type\":\"ListItem\",\"position\":405,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-java\u002F\"},{\"@type\":\"ListItem\",\"position\":406,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-javascript-in-nodejs\u002F\"},{\"@type\":\"ListItem\",\"position\":407,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-php\u002F\"},{\"@type\":\"ListItem\",\"position\":408,\"url\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-python\u002F\"}]},\"description\":\"Integrate powerful PDF processing capabilities into any development project. Discover code examples for a wide range of programming languages.\",\"keywords\":\".NET, Java, JavaScript, PHP, Python, cURL\"},{\"@type\":\"BreadcrumbList\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Learning\",\"item\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Programming Languages\",\"item\":\"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fprogramming-languages\u002F\"}]}]}","https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fprogramming-languages\u002F",[2211],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[2213,2214,2218,2222,2226,2230,2234,2238],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":2215,"name":2216,"slug":2216,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2217},"65ae9a81656af204db4b0f99","programming-languages","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Fprogramming-languages\u002F",{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f8d","#Python","hash-python",{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f8e","#JavaScript","hash-javascript",{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f8c","#PHP","hash-php",{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0f8f","#.NET","hash-net",{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65d8df4b533c9f26b9436590","#Java","hash-java",{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65d8e139533c9f26b94365a7","#cURL","hash-curl",{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},"https:\u002F\u002Fcms.pdfrest.com\u002Fprogramming-languages-hub\u002F","\n\n\n\n\nProcess PDFs with Your Favorite Programming Language\n\n\n\npdfRest empowers you to seamlessly integrate its robust PDF processing capabilities into your existing workflows, regardless of your preferred programming language. Whether you're using Python, JavaScript, C#, Java, PHP, or something else, pdfRest provides the tools and resources to get started quickly and efficiently.\n\n\n\n\n\nRobust Code Examples for PDF Solutions\n\n\n\npdfRest's GitHub Code Sample Repository serves as a valuable resource f","Integrate PDF Processing with Any Programming Language, JavaScript, Python, PHP, Java, C# | pdfRest","Integrate powerful PDF processing capabilities into any development project. Discover code examples for a wide range of programming languages.",{"id":2249,"uuid":2250,"title":2251,"slug":2252,"html":2253,"comment_id":2254,"feature_image":48,"featured":284,"visibility":1257,"created_at":2255,"updated_at":2256,"published_at":2257,"custom_excerpt":48,"codeinjection_head":2258,"codeinjection_foot":48,"custom_template":48,"canonical_url":2259,"authors":2260,"tags":2262,"primary_author":2284,"primary_tag":2285,"url":2286,"excerpt":2287,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":2288,"meta_description":2289,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b12e5","1a0663f3-8c0f-49e3-ae2c-283275646286","Self-Hosting","self-hosting-hub","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Self-Host pdfRest API for Enhanced Control and Security\u003C\u002Fh2>\n\n\u003Cp>pdfRest offers flexible deployment options to meet your specific needs. Choose between our \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fproducts\u002Fpdf-toolkit-self-hosted-api\u002F'>Self-Hosted API\u003C\u002Fa> for deployment within your own AWS VPC or our \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fproducts\u002Fpdf-toolkit-container-api\u002F'>Container API\u003C\u002Fa> for on-premises or private cloud deployment.\u003C\u002Fp>\n\n\u003Ch2>Key Benefits for Self-Hosting pdfRest\u003C\u002Fh2>\n\u003Cul>\n  \u003Cli>\u003Cstrong>Enhanced Security:\u003C\u002Fstrong> Maintain full control over your PDF data and processing workflows.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Compliance Adherence:\u003C\u002Fstrong> Ensure compliance with industry regulations and internal security standards.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Customization Flexibility:\u003C\u002Fstrong> Tailor your PDF processing environment to meet your specific needs.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Private Deployment:\u003C\u002Fstrong> Host the API within your own AWS VPC or on-premises environment for added security and control.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Regulatory Compliance for PDF Processing\u003C\u002Fh2>\n\u003Cp>pdfRest's Self-Hosted API and Container API solutions are designed to help you meet a variety of regulatory compliance requirements, including:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Cstrong>HIPAA:\u003C\u002Fstrong> Protect patient health information (PHI) with enhanced security measures and compliance controls.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>GDPR:\u003C\u002Fstrong> Ensure compliance with EU data privacy regulations, including data subject rights and data breach notification requirements.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>PCI DSS:\u003C\u002Fstrong> Protect sensitive cardholder data with robust security measures and compliance controls.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>And more:\u003C\u002Fstrong> Self-hosting pdfRest can help you meet a wide range of industry-specific regulations and standards.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>Take control of your PDF processing workflows and ensure optimal security and compliance with pdfRest's Self-Hosted API solution or Container API.\u003C\u002Fp>\n\n\u003C!--kg-card-end: html-->\n","651f11c92d4014c9499b21e8","2023-10-05T19:43:05.000+00:00","2026-09-04T17:53:45.000+00:00","2023-10-05T19:43:36.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"CollectionPage\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fself-hosting\u002F#collection\",\n      \"name\": \"Self-Hosting\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fself-hosting\u002F\",\n      \"isPartOf\": {\n        \"@type\": \"WebSite\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"mainEntity\": {\n        \"@type\": \"ItemList\",\n        \"itemListElement\": [\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 1,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fself-host-your-pdf-processing-api-on-premises-with-container-deployment\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 2,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fbest-fit-pdf-toolkit-integration-for-any-application-or-workflow\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 3,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fcontrol-your-backend-with-pdfrest-api-toolkit-self-hosted\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 4,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fconnect-to-a-pdfrest-self-hosted-ec2-from-windows\u002F\"\n          },\n          {\n            \"@type\": \"ListItem\",\n            \"position\": 5,\n            \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-modify-pdfrest-cloud-api-code-for-compatibility-with-self-hosted-api\u002F\"\n          }\n        ]\n      },\n      \"description\": \"Host and manage a dedicated deployment of pdfRest API service in AWS or on-premises with Docker Container. Meet regulatory compliance needs by maintaining full control.\",\n      \"keywords\": \"AWS, Container, SDK, Self-Hosted\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Self-Hosting\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fself-hosting\u002F\"\n        }\n      ]\n    }\n  ]\n}","https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fself-hosting\u002F",[2261],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[2263,2264,2268,2272,2276,2280],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":2265,"name":2266,"slug":2266,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2267},"65ae9a81656af204db4b0f51","self-hosting","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Fself-hosting\u002F",{"id":2269,"name":2270,"slug":2271,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e64","#AWS","hash-aws",{"id":2273,"name":2274,"slug":2275,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e71","#SDK","hash-sdk",{"id":2277,"name":2278,"slug":2279,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"65ae9a81656af204db4b0e63","#Self-Hosted","hash-self-hosted",{"id":2281,"name":2282,"slug":2283,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"67180876533c9f26b9438a07","#Container","hash-container",{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},"https:\u002F\u002Fcms.pdfrest.com\u002Fself-hosting-hub\u002F","\n\n\n\n\nSelf-Host pdfRest API for Enhanced Control and Security\n\n\n\npdfRest offers flexible deployment options to meet your specific needs. Choose between our Self-Hosted API for deployment within your own AWS VPC or our Container API for on-premises or private cloud deployment.\n\n\n\n\nKey Benefits for Self-Hosting pdfRest\n\n\n * Enhanced Security: Maintain full control over your PDF data and processing workflows.\n * Compliance Adherence: Ensure compliance with industry regulations and internal security ","Self-Hosted PDF API, AWS & On-Premises Container | pdfRest","Host and manage a dedicated deployment of pdfRest API service in AWS or on-premises with Docker Container. Meet regulatory compliance needs by maintaining full control.",{"learningHeader":2291,"solutionsHeader":2311,"tutorialsHeader":2342,"getStartedContent":2364,"contentHubs":2457},{"id":2292,"uuid":2293,"title":97,"slug":2294,"html":2295,"comment_id":2296,"feature_image":48,"featured":284,"visibility":1257,"created_at":2297,"updated_at":2298,"published_at":2299,"custom_excerpt":48,"codeinjection_head":48,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":2300,"authors":2304,"primary_author":2306,"primary_tag":2307,"url":2308,"excerpt":2309,"reading_time":215,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":2310,"meta_description":2309,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1331","76dead4d-6083-4cc9-8e4a-e38d92842934","learning-header","\u003Cp>Discover solutions for all of your PDF processing challenges, and follow step-by-step tutorials to integrate pdfRest API Tools.\u003C\u002Fp>","655ced982d4014c9499b2fb0","2023-11-21T17:49:12.000+00:00","2023-12-20T21:02:09.000+00:00","2023-11-21T17:49:41.000+00:00",[2301],{"id":2302,"name":2294,"slug":2294,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2303},"65ae9a81656af204db4b0f88","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Flearning-header\u002F",[2305],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":2302,"name":2294,"slug":2294,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2303},"https:\u002F\u002Fcms.pdfrest.com\u002Flearning-header\u002F","Discover solutions for all of your PDF processing challenges, and follow step-by-step tutorials to integrate pdfRest API Tools.","Learning | pdfRest",{"id":2312,"uuid":2313,"title":2314,"slug":2315,"html":2316,"comment_id":2317,"feature_image":48,"featured":284,"visibility":1257,"created_at":2318,"updated_at":2319,"published_at":2320,"custom_excerpt":48,"codeinjection_head":48,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":2321,"authors":2334,"primary_author":2336,"primary_tag":2337,"url":2338,"excerpt":2339,"reading_time":215,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":2340,"meta_description":2341,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b109e","3916a43e-5cd4-4aaa-9f52-b42bc5beba87","Solutions","solutions","\u003Cp>Explore the many ways pdfRest can align your documents with your business objectives.\u003C\u002Fp>","632de5c262bc54020b543ee3","2022-09-23T16:58:42.000+00:00","2024-02-13T15:25:42.000+00:00","2022-09-23T17:10:07.000+00:00",[2322,2325,2329],{"id":2323,"name":2315,"slug":2315,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2324},"65ae9a81656af204db4b0e0b","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Fsolutions\u002F",{"id":2326,"name":2327,"slug":2327,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2328},"65ae9a81656af204db4b0e0c","solutions-header","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Fsolutions-header\u002F",{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},"65ae9a81656af204db4b0f89","seo-meta","Used to identify pages which hold metadata for SEO SERP listings.","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Fseo-meta\u002F",[2335],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":2323,"name":2315,"slug":2315,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2324},"https:\u002F\u002Fcms.pdfrest.com\u002Fsolutions\u002F","Explore the many ways pdfRest can align your documents with your business objectives.","PDF Workflow Solutions and Integrations | pdfRest","You have PDF processing challenges, we have Solutions. Learn how the pdfRest API aligns your documents with your business objectives.",{"id":2343,"uuid":2344,"title":2345,"slug":2346,"html":2347,"comment_id":2348,"feature_image":48,"featured":284,"visibility":1257,"created_at":2349,"updated_at":2350,"published_at":2351,"custom_excerpt":48,"codeinjection_head":48,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":2352,"authors":2357,"primary_author":2359,"primary_tag":2360,"url":2361,"excerpt":2362,"reading_time":215,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":2363,"meta_description":2362,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b12f0","2d6b2fd6-b27e-4912-9d83-a23e693d3676","Tutorials","guides-header","\u003Cp>Learn how to process PDF documents with the programming languages, tools, and frameworks that best fit your development project.\u003C\u002Fp>","653ad6c42d4014c9499b2532","2023-10-26T21:14:44.000+00:00","2026-08-31T17:58:57.000+00:00","2023-10-26T21:15:01.000+00:00",[2353],{"id":2354,"name":2355,"slug":2355,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2356},"65ae9a81656af204db4b0f63","tutorials-header","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Ftutorials-header\u002F",[2358],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":2354,"name":2355,"slug":2355,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2356},"https:\u002F\u002Fcms.pdfrest.com\u002Fguides-header\u002F","Learn how to process PDF documents with the programming languages, tools, and frameworks that best fit your development project.","Tutorials | pdfRest",[2365,2394,2415,2437],{"id":2366,"uuid":2367,"title":2368,"slug":2369,"html":2370,"comment_id":2371,"feature_image":48,"featured":284,"visibility":1257,"created_at":2372,"updated_at":2373,"published_at":2374,"custom_excerpt":48,"codeinjection_head":48,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":2375,"authors":2384,"primary_author":2390,"primary_tag":2391,"url":2392,"excerpt":2393,"reading_time":215,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1199","48e7f14c-393a-4698-984f-c067657542ff","Maximize with Enterprise","paid-plan-5","\u003Cp>Upgrade to the Enterprise plan for maximum file size uploads, flexible file storage, and customized cloud hosting solutions. Let us design the perfect backend to power your PDF processing.\u003C\u002Fp>","6436e8612d4014c9499af168","2023-04-12T17:20:33.000+00:00","2023-04-18T20:05:27.000+00:00","2023-04-12T17:20:55.000+00:00",[2376,2380],{"id":2377,"name":2378,"slug":2378,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2379},"65ae9a81656af204db4b0e09","tool-get-started","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Ftool-get-started\u002F",{"id":2381,"name":2382,"slug":2382,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2383},"65ae9a81656af204db4b0e9a","paid","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Fpaid\u002F",[2385],{"id":2386,"name":2387,"slug":2388,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":2389},"65ae9a7f656af204db4b0d8d","Jackson Meyer","jackson","https:\u002F\u002Fcms.pdfrest.com\u002Fauthor\u002Fjackson\u002F",{"id":2386,"name":2387,"slug":2388,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":2389},{"id":2377,"name":2378,"slug":2378,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2379},"https:\u002F\u002Fcms.pdfrest.com\u002Fpaid-plan-5\u002F","Upgrade to the Enterprise plan for maximum file size uploads, flexible file storage, and customized cloud hosting solutions. Let us design the perfect backend to power your PDF processing.",{"id":2395,"uuid":2396,"title":37,"slug":2397,"html":2398,"comment_id":2399,"feature_image":48,"featured":284,"visibility":1257,"created_at":2400,"updated_at":2401,"published_at":2402,"custom_excerpt":48,"codeinjection_head":48,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":2403,"authors":2409,"primary_author":2411,"primary_tag":2412,"url":2413,"excerpt":2414,"reading_time":215,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1198","58508c8a-68d5-4e2c-93e0-67185701129c","starter-plan","\u003Cp>Your Starter plan is perfect for testing and prototyping.  When you're ready to launch PDF processing in your website, application, or workflow, remember to upgrade your plan for unlimited access.\u003C\u002Fp>","6436e83c2d4014c9499af15b","2023-04-12T17:19:56.000+00:00","2023-04-18T18:45:22.000+00:00","2023-04-12T17:20:27.000+00:00",[2404,2405],{"id":2377,"name":2378,"slug":2378,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2379},{"id":2406,"name":2407,"slug":2407,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2408},"65ae9a81656af204db4b0e99","starter","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Fstarter\u002F",[2410],{"id":2386,"name":2387,"slug":2388,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":2389},{"id":2386,"name":2387,"slug":2388,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":2389},{"id":2377,"name":2378,"slug":2378,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2379},"https:\u002F\u002Fcms.pdfrest.com\u002Fstarter-plan\u002F","Your Starter plan is perfect for testing and prototyping.  When you're ready to launch PDF processing in your website, application, or workflow, remember to upgrade your plan for unlimited access.",{"id":2416,"uuid":2417,"title":2418,"slug":2419,"html":2420,"comment_id":2421,"feature_image":48,"featured":284,"visibility":1257,"created_at":2422,"updated_at":2423,"published_at":2424,"custom_excerpt":48,"codeinjection_head":48,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":2425,"authors":2431,"primary_author":2433,"primary_tag":2434,"url":2435,"excerpt":2436,"reading_time":215,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1197","c56a4332-b9c9-4bbe-a191-98cac66ddba9","Start Prototyping Your Solution","guest-plan","\u003Cp>Sign up for a free Starter plan, and test your integration with up to 300 API Calls each month.  No credit card required, no catch.  When you're ready to scale,  find the best-fit plan to meet your needs.\u003C\u002Fp>","6436e7ff2d4014c9499af14e","2023-04-12T17:18:55.000+00:00","2023-04-14T21:37:16.000+00:00","2023-04-12T17:19:50.000+00:00",[2426,2427],{"id":2377,"name":2378,"slug":2378,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2379},{"id":2428,"name":2429,"slug":2429,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2430},"65ae9a81656af204db4b0e98","guest","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Fguest\u002F",[2432],{"id":2386,"name":2387,"slug":2388,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":2389},{"id":2386,"name":2387,"slug":2388,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":2389},{"id":2377,"name":2378,"slug":2378,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2379},"https:\u002F\u002Fcms.pdfrest.com\u002Fguest-plan\u002F","Sign up for a free Starter plan, and test your integration with up to 300 API Calls each month.  No credit card required, no catch.  When you're ready to scale,  find the best-fit plan to meet your needs.",{"id":2438,"uuid":2439,"title":25,"slug":2440,"html":2441,"comment_id":2442,"feature_image":48,"featured":284,"visibility":1257,"created_at":2443,"updated_at":2444,"published_at":2445,"custom_excerpt":48,"codeinjection_head":48,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":2446,"authors":2452,"primary_author":2454,"primary_tag":2455,"url":2456,"excerpt":26,"reading_time":215,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b107e","80773b70-0a58-4e31-8d34-ade7a0c99d55","get-started-today","\u003Cp>Create your FREE API Key to start processing PDFs in seconds, only possible with pdfRest.\u003C\u002Fp>","632242973ca424020bf08779","2022-09-14T21:07:35.000+00:00","2023-04-18T19:36:43.000+00:00","2022-09-14T21:07:48.000+00:00",[2447,2448],{"id":2377,"name":2378,"slug":2378,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2379},{"id":2449,"name":2450,"slug":2450,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2451},"65ae9a81656af204db4b0e97","default","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Fdefault\u002F",[2453],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":2377,"name":2378,"slug":2378,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2379},"https:\u002F\u002Fcms.pdfrest.com\u002Fget-started-today\u002F",[2458,2476,2487,2510,2526,2544,2559,2574,2584,2595,2613,2626,2648,2672,2692,2715,2729],{"id":1251,"uuid":1252,"title":1253,"slug":1254,"html":1255,"comment_id":1256,"feature_image":48,"featured":284,"visibility":1257,"created_at":1258,"updated_at":1259,"published_at":1260,"custom_excerpt":48,"codeinjection_head":1261,"codeinjection_foot":48,"custom_template":48,"canonical_url":1262,"authors":2459,"tags":2461,"primary_author":2474,"primary_tag":2475,"url":1323,"excerpt":1324,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":1325,"meta_description":1326,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},[2460],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[2462,2463,2464,2465,2466,2467,2468,2469,2470,2471,2472,2473],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1275,"name":1276,"slug":1276,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1277},{"id":1279,"name":1280,"slug":1281,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1286,"name":1287,"slug":1288,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1290,"name":1291,"slug":1292,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1294,"name":1295,"slug":1296,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1298,"name":1299,"slug":1300,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1302,"name":1303,"slug":1304,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1306,"name":1307,"slug":1308,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1310,"name":1311,"slug":1312,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1314,"name":1315,"slug":1316,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1318,"name":1319,"slug":1320,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1328,"uuid":1329,"title":1330,"slug":1331,"html":1332,"comment_id":1333,"feature_image":48,"featured":284,"visibility":1257,"created_at":1334,"updated_at":1335,"published_at":1336,"custom_excerpt":48,"codeinjection_head":1337,"codeinjection_foot":48,"custom_template":48,"canonical_url":1338,"authors":2477,"tags":2479,"primary_author":2485,"primary_tag":2486,"url":1361,"excerpt":1362,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":1363,"meta_description":1364,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},[2478],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[2480,2481,2482,2483,2484],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1344,"name":1345,"slug":1345,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1346},{"id":1348,"name":1349,"slug":1350,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1352,"name":1353,"slug":1354,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1356,"name":1357,"slug":1358,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1366,"uuid":1367,"title":1368,"slug":1369,"html":1370,"comment_id":1371,"feature_image":48,"featured":284,"visibility":1257,"created_at":1372,"updated_at":1373,"published_at":1374,"custom_excerpt":48,"codeinjection_head":1375,"codeinjection_foot":48,"custom_template":48,"canonical_url":1376,"authors":2488,"tags":2490,"primary_author":2508,"primary_tag":2509,"url":1447,"excerpt":1448,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":1449,"meta_description":1450,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},[2489],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[2491,2492,2493,2494,2495,2496,2497,2498,2499,2500,2501,2502,2503,2504,2505,2506,2507],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1382,"name":1383,"slug":1383,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1384},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1398,"name":1399,"slug":1400,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1402,"name":1403,"slug":1404,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1406,"name":1407,"slug":1408,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1410,"name":1411,"slug":1412,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1414,"name":1415,"slug":1416,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1418,"name":1419,"slug":1420,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1422,"name":1423,"slug":1424,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1426,"name":1427,"slug":1428,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1430,"name":1431,"slug":1432,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1434,"name":1435,"slug":1436,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1438,"name":1439,"slug":1440,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1442,"name":1443,"slug":1444,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1452,"uuid":1453,"title":1454,"slug":1455,"html":1456,"comment_id":1457,"feature_image":48,"featured":284,"visibility":1257,"created_at":1458,"updated_at":1459,"published_at":1460,"custom_excerpt":48,"codeinjection_head":1461,"codeinjection_foot":48,"custom_template":48,"canonical_url":1462,"authors":2511,"tags":2513,"primary_author":2524,"primary_tag":2525,"url":1505,"excerpt":1506,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":1507,"meta_description":1508,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},[2512],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[2514,2515,2516,2517,2518,2519,2520,2521,2522,2523],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1468,"name":1469,"slug":1469,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1470},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1476,"name":1477,"slug":1478,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1488,"name":1489,"slug":1490,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1492,"name":1493,"slug":1494,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1496,"name":1497,"slug":1498,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1500,"name":1501,"slug":1502,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1510,"uuid":1511,"title":1512,"slug":1513,"html":1514,"comment_id":1515,"feature_image":48,"featured":284,"visibility":1257,"created_at":1516,"updated_at":1517,"published_at":1518,"custom_excerpt":48,"codeinjection_head":1519,"codeinjection_foot":48,"custom_template":48,"canonical_url":1520,"authors":2527,"tags":2529,"primary_author":2542,"primary_tag":2543,"url":1571,"excerpt":1572,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":1573,"meta_description":1574,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},[2528],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[2530,2531,2532,2533,2534,2535,2536,2537,2538,2539,2540,2541],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1526,"name":1527,"slug":1527,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1528},{"id":1530,"name":1531,"slug":1532,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1534,"name":1535,"slug":1536,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1538,"name":1539,"slug":1540,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1542,"name":1543,"slug":1544,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1546,"name":1547,"slug":1548,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1550,"name":1551,"slug":1552,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1554,"name":1555,"slug":1556,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1558,"name":1559,"slug":1560,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1562,"name":1563,"slug":1564,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1566,"name":1567,"slug":1568,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1576,"uuid":1577,"title":1578,"slug":1579,"html":1580,"comment_id":1581,"feature_image":48,"featured":284,"visibility":1257,"created_at":1582,"updated_at":1459,"published_at":1583,"custom_excerpt":48,"codeinjection_head":1584,"codeinjection_foot":48,"custom_template":48,"canonical_url":1585,"authors":2545,"tags":2547,"primary_author":2557,"primary_tag":2558,"url":1624,"excerpt":1625,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":1626,"meta_description":1627,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},[2546],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[2548,2549,2550,2551,2552,2553,2554,2555,2556],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1591,"name":1592,"slug":1592,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1593},{"id":1595,"name":1596,"slug":1597,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1599,"name":1600,"slug":1601,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1603,"name":1604,"slug":1605,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1607,"name":1608,"slug":1609,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1611,"name":1612,"slug":1613,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1615,"name":1616,"slug":1617,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1619,"name":1620,"slug":1621,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1629,"uuid":1630,"title":1631,"slug":1632,"html":1633,"comment_id":1634,"feature_image":48,"featured":284,"visibility":1257,"created_at":1635,"updated_at":1636,"published_at":1637,"custom_excerpt":48,"codeinjection_head":1638,"codeinjection_foot":48,"custom_template":48,"canonical_url":1639,"authors":2560,"tags":2562,"primary_author":2572,"primary_tag":2573,"url":1678,"excerpt":1679,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":1680,"meta_description":1681,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},[2561],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[2563,2564,2565,2566,2567,2568,2569,2570,2571],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1645,"name":1646,"slug":1646,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1647},{"id":1649,"name":1650,"slug":1651,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1657,"name":1658,"slug":1659,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1661,"name":1662,"slug":1663,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1665,"name":1666,"slug":1667,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1669,"name":1670,"slug":1671,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1673,"name":1674,"slug":1675,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1683,"uuid":1684,"title":1685,"slug":1686,"html":1687,"comment_id":1688,"feature_image":48,"featured":284,"visibility":1257,"created_at":1689,"updated_at":1335,"published_at":1690,"custom_excerpt":48,"codeinjection_head":1691,"codeinjection_foot":48,"custom_template":48,"canonical_url":1692,"authors":2575,"tags":2577,"primary_author":2582,"primary_tag":2583,"url":1711,"excerpt":1712,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":1713,"meta_description":1714,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},[2576],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[2578,2579,2580,2581],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1698,"name":1699,"slug":1699,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1700},{"id":1702,"name":1703,"slug":1704,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1706,"name":1707,"slug":1708,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1716,"uuid":1717,"title":1718,"slug":1719,"html":1720,"comment_id":1721,"feature_image":48,"featured":284,"visibility":1257,"created_at":1722,"updated_at":1723,"published_at":1724,"custom_excerpt":48,"codeinjection_head":1725,"codeinjection_foot":48,"custom_template":48,"canonical_url":1726,"authors":2585,"tags":2587,"primary_author":2593,"primary_tag":2594,"url":1749,"excerpt":1750,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":1751,"meta_description":1752,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},[2586],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[2588,2589,2590,2591,2592],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1732,"name":1733,"slug":1733,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1734},{"id":1736,"name":1737,"slug":1738,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1740,"name":1741,"slug":1742,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1744,"name":1745,"slug":1746,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1754,"uuid":1755,"title":1756,"slug":1757,"html":1758,"comment_id":1759,"feature_image":48,"featured":284,"visibility":1257,"created_at":1760,"updated_at":1761,"published_at":1762,"custom_excerpt":48,"codeinjection_head":1763,"codeinjection_foot":48,"custom_template":48,"canonical_url":1764,"authors":2596,"tags":2598,"primary_author":2611,"primary_tag":2612,"url":1819,"excerpt":1820,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":1821,"meta_description":1822,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},[2597],{"id":1767,"name":1768,"slug":1769,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1770},[2599,2600,2601,2602,2603,2604,2605,2606,2607,2608,2609,2610],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1774,"name":1775,"slug":1775,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1776},{"id":1778,"name":1779,"slug":1780,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1782,"name":1783,"slug":1784,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1786,"name":1787,"slug":1788,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1790,"name":1791,"slug":1792,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1794,"name":1795,"slug":1796,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1798,"name":1799,"slug":1800,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1802,"name":1803,"slug":1804,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1806,"name":1807,"slug":1808,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1810,"name":1811,"slug":1812,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1814,"name":1815,"slug":1816,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1767,"name":1768,"slug":1769,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1770},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1824,"uuid":1825,"title":1826,"slug":1827,"html":1828,"comment_id":1824,"feature_image":48,"featured":284,"visibility":1257,"created_at":1829,"updated_at":1830,"published_at":1831,"custom_excerpt":48,"codeinjection_head":1832,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"authors":2614,"tags":2616,"primary_author":2624,"primary_tag":2625,"url":1863,"excerpt":1864,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":1865,"meta_description":1866,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},[2615],{"id":1767,"name":1768,"slug":1769,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1770},[2617,2618,2619,2620,2621,2622,2623],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1838,"name":1839,"slug":1839,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1840},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1846,"name":1847,"slug":1848,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1854,"name":1855,"slug":1856,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1858,"name":1859,"slug":1860,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1767,"name":1768,"slug":1769,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1770},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1868,"uuid":1869,"title":1870,"slug":1871,"html":1872,"comment_id":1873,"feature_image":48,"featured":284,"visibility":1257,"created_at":1874,"updated_at":1723,"published_at":1875,"custom_excerpt":48,"codeinjection_head":1876,"codeinjection_foot":48,"custom_template":48,"canonical_url":1877,"authors":2627,"tags":2629,"primary_author":2646,"primary_tag":2647,"url":1944,"excerpt":1945,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":1946,"meta_description":1947,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},[2628],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[2630,2631,2632,2633,2634,2635,2636,2637,2638,2639,2640,2641,2642,2643,2644,2645],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1883,"name":1884,"slug":1884,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1885},{"id":1887,"name":1888,"slug":1889,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1891,"name":1892,"slug":1893,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1895,"name":1896,"slug":1897,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1899,"name":1900,"slug":1901,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1903,"name":1904,"slug":1905,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1907,"name":1908,"slug":1909,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1911,"name":1912,"slug":1913,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1915,"name":1916,"slug":1917,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1919,"name":1920,"slug":1921,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1923,"name":1924,"slug":1925,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1927,"name":1928,"slug":1929,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1931,"name":1932,"slug":1933,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1935,"name":1936,"slug":1937,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1939,"name":1940,"slug":1941,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1949,"uuid":1950,"title":1951,"slug":1952,"html":1953,"comment_id":1954,"feature_image":48,"featured":284,"visibility":1257,"created_at":1955,"updated_at":1956,"published_at":1957,"custom_excerpt":48,"codeinjection_head":1958,"codeinjection_foot":48,"custom_template":48,"canonical_url":1959,"authors":2649,"tags":2651,"primary_author":2670,"primary_tag":2671,"url":2034,"excerpt":2035,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":2036,"meta_description":2037,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},[2650],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[2652,2653,2654,2655,2656,2657,2658,2659,2660,2661,2662,2663,2664,2665,2666,2667,2668,2669],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":1965,"name":1966,"slug":1966,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1967},{"id":1969,"name":1970,"slug":1971,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1973,"name":1974,"slug":1975,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1977,"name":1978,"slug":1979,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1981,"name":1982,"slug":1983,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1985,"name":1986,"slug":1987,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1993,"name":1994,"slug":1995,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1997,"name":1998,"slug":1999,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2001,"name":2002,"slug":2003,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2005,"name":2006,"slug":2007,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2009,"name":2010,"slug":2011,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2013,"name":2014,"slug":2015,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2017,"name":2018,"slug":2019,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2021,"name":2022,"slug":2023,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2025,"name":2026,"slug":2027,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2029,"name":2030,"slug":2031,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":2039,"uuid":2040,"title":2041,"slug":2042,"html":2043,"comment_id":2044,"feature_image":48,"featured":284,"visibility":1257,"created_at":2045,"updated_at":2046,"published_at":2047,"custom_excerpt":48,"codeinjection_head":2048,"codeinjection_foot":48,"custom_template":48,"canonical_url":2049,"authors":2673,"tags":2675,"primary_author":2690,"primary_tag":2691,"url":2108,"excerpt":2109,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":2110,"meta_description":2111,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},[2674],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[2676,2677,2678,2679,2680,2681,2682,2683,2684,2685,2686,2687,2688,2689],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":2055,"name":2056,"slug":2056,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2057},{"id":2059,"name":2060,"slug":2061,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2063,"name":2064,"slug":2065,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2067,"name":2068,"slug":2069,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2071,"name":2072,"slug":2073,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2075,"name":2076,"slug":2077,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2079,"name":2080,"slug":2081,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2083,"name":2084,"slug":2085,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2087,"name":2088,"slug":2089,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2091,"name":2092,"slug":2093,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2095,"name":2096,"slug":2097,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2099,"name":2100,"slug":2101,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2103,"name":2104,"slug":2105,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":2113,"uuid":2114,"title":2115,"slug":2116,"html":2117,"comment_id":2118,"feature_image":48,"featured":284,"visibility":1257,"created_at":2119,"updated_at":2120,"published_at":2121,"custom_excerpt":48,"codeinjection_head":2122,"codeinjection_foot":48,"custom_template":48,"canonical_url":2123,"authors":2693,"tags":2695,"primary_author":2713,"primary_tag":2714,"url":2194,"excerpt":2195,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":2196,"meta_description":2197,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},[2694],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[2696,2697,2698,2699,2700,2701,2702,2703,2704,2705,2706,2707,2708,2709,2710,2711,2712],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":2129,"name":2130,"slug":2130,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2131},{"id":2133,"name":2134,"slug":2135,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2137,"name":2138,"slug":2139,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2141,"name":2142,"slug":2143,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2145,"name":2146,"slug":2147,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2149,"name":2150,"slug":2151,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2153,"name":2154,"slug":2155,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2157,"name":2158,"slug":2159,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2161,"name":2162,"slug":2163,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2165,"name":2166,"slug":2167,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2169,"name":2170,"slug":2171,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2173,"name":2174,"slug":2175,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2177,"name":2178,"slug":2179,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2181,"name":2182,"slug":2183,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2185,"name":2186,"slug":2187,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2189,"name":2190,"slug":2191,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":2199,"uuid":2200,"title":2201,"slug":2202,"html":2203,"comment_id":2204,"feature_image":48,"featured":284,"visibility":1257,"created_at":2205,"updated_at":2206,"published_at":2207,"custom_excerpt":48,"codeinjection_head":2208,"codeinjection_foot":48,"custom_template":48,"canonical_url":2209,"authors":2716,"tags":2718,"primary_author":2727,"primary_tag":2728,"url":2244,"excerpt":2245,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":2246,"meta_description":2247,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},[2717],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[2719,2720,2721,2722,2723,2724,2725,2726],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":2215,"name":2216,"slug":2216,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2217},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":2249,"uuid":2250,"title":2251,"slug":2252,"html":2253,"comment_id":2254,"feature_image":48,"featured":284,"visibility":1257,"created_at":2255,"updated_at":2256,"published_at":2257,"custom_excerpt":48,"codeinjection_head":2258,"codeinjection_foot":48,"custom_template":48,"canonical_url":2259,"authors":2730,"tags":2732,"primary_author":2739,"primary_tag":2740,"url":2286,"excerpt":2287,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":2288,"meta_description":2289,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},[2731],{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},[2733,2734,2735,2736,2737,2738],{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"id":2265,"name":2266,"slug":2266,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2267},{"id":2269,"name":2270,"slug":2271,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2273,"name":2274,"slug":2275,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2277,"name":2278,"slug":2279,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2281,"name":2282,"slug":2283,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1265,"name":1266,"slug":1267,"profile_image":48,"cover_image":48,"bio":48,"website":48,"location":48,"facebook":48,"twitter":48,"meta_title":48,"meta_description":48,"url":1268},{"id":1271,"name":1272,"slug":1272,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1273},{"data":2742,"meta":2838},{"id":5,"createdAt":6,"updatedAt":7,"publishedAt":8,"stateful_cta":2743,"documentId":43,"seo":2763,"api_tool_buckets":2776,"nav":2785,"footer_developers":2806,"footer_products":2826},{"pro":2744,"default":2748,"premium":2751,"starter":2755,"enterprise":2759},{"links":2745,"title":18,"description":19},[2746,2747],{"to":13,"label":14},{"to":16,"label":17},{"links":2749,"title":25,"description":26},[2750],{"label":23,"action":24},{"links":2752,"title":18,"description":19},[2753,2754],{"to":13,"label":14},{"to":16,"label":17},{"links":2756,"title":37,"description":38},[2757,2758],{"to":34,"label":35},{"to":16,"label":17},{"links":2760,"title":18,"description":19},[2761,2762],{"to":13,"label":14},{"to":16,"label":17},{"id":45,"metaTitle":46,"metaDescription":47,"canonicalUrl":48,"structured_data":2764},{"@graph":2765,"@context":85},[2766,2771,2773],{"@id":52,"url":53,"logo":2767,"name":57,"@type":58,"sameAs":2768,"knowsAbout":2769,"description":71,"parentOrganization":2770},{"url":55,"@type":56},[60,61,62],[64,65,66,67,68,69,70],{"url":73,"name":74,"@type":58},{"@id":76,"url":53,"name":57,"@type":77,"publisher":2772},{"@id":52},{"@id":80,"url":53,"name":46,"@type":81,"about":2774,"isPartOf":2775,"description":84},{"@id":52},{"@id":76},[2777,2778,2779,2780,2781,2782,2783,2784],{"id":209,"name":210,"description":211,"createdAt":212,"updatedAt":213,"publishedAt":214,"rank":215,"documentId":216},{"id":5,"name":273,"description":274,"createdAt":275,"updatedAt":276,"publishedAt":277,"rank":5,"documentId":278},{"id":295,"name":504,"description":505,"createdAt":506,"updatedAt":507,"publishedAt":508,"rank":295,"documentId":509},{"id":394,"name":665,"description":666,"createdAt":667,"updatedAt":668,"publishedAt":669,"rank":320,"documentId":670},{"id":369,"name":811,"description":812,"createdAt":813,"updatedAt":814,"publishedAt":815,"rank":345,"documentId":816},{"id":320,"name":934,"description":935,"createdAt":936,"updatedAt":937,"publishedAt":938,"rank":369,"documentId":939},{"id":345,"name":1055,"description":1056,"createdAt":1057,"updatedAt":1058,"publishedAt":1059,"rank":394,"documentId":1060},{"id":419,"name":1153,"description":1154,"createdAt":1155,"updatedAt":1156,"publishedAt":1157,"rank":419,"documentId":1158},[2786,2787,2788,2789,2797,2804,2805],{"id":88,"label":89,"description":48,"to":13,"icon":48,"external":48,"target":48,"children":48,"__component":90},{"id":92,"label":93,"description":48,"to":94,"icon":48,"external":48,"target":48,"children":48,"__component":90},{"id":96,"label":97,"description":48,"to":98,"icon":48,"external":48,"target":48,"children":48,"__component":90},{"id":100,"label":101,"description":48,"to":102,"icon":48,"external":48,"target":48,"children":2790,"__component":90},[2791,2796],{"to":102,"label":105,"children":2792,"description":119},[2793,2794,2795],{"to":108,"label":109,"description":110},{"to":112,"label":113,"description":114},{"to":116,"label":117,"description":118},{"to":121,"label":122,"target":123,"external":124,"description":125},{"id":127,"label":128,"description":48,"to":16,"icon":48,"external":48,"target":48,"children":2798,"__component":90},[2799],{"to":16,"label":105,"children":2800,"description":119},[2801,2802,2803],{"to":133,"label":109,"exactHash":124,"description":110},{"to":135,"label":113,"exactHash":124,"description":118},{"to":137,"label":117,"exactHash":124,"description":118},{"id":139,"label":140,"description":48,"to":141,"icon":48,"external":48,"target":123,"children":48,"__component":90},{"id":143,"label":144,"description":48,"to":145,"icon":48,"external":48,"target":123,"children":48,"__component":90},[2807,2811,2816,2823],{"id":148,"label":149,"description":48,"to":48,"icon":48,"external":48,"target":48,"children":2808,"__component":90},[2809,2810],{"to":152,"label":153,"target":123,"external":124},{"to":155,"label":156,"target":123,"external":124},{"id":158,"label":159,"description":48,"to":48,"icon":48,"external":48,"target":48,"children":2812,"__component":90},[2813,2814,2815],{"to":162,"label":109,"target":123,"external":124},{"to":164,"label":117,"target":123,"external":124},{"to":166,"label":113,"target":123,"external":124},{"id":168,"label":169,"description":48,"to":48,"icon":48,"external":48,"target":48,"children":2817,"__component":90},[2818,2819,2820,2821,2822],{"to":13,"label":89},{"to":173,"label":174,"target":123,"external":124},{"to":176,"label":177,"target":123,"external":124},{"to":179,"label":180,"target":123,"external":124},{"to":182,"label":183,"target":123,"external":124},{"id":185,"label":144,"description":48,"to":48,"icon":48,"external":48,"target":48,"children":2824,"__component":90},[2825],{"to":145,"label":188,"target":123,"external":124},[2827,2833],{"id":191,"label":105,"description":48,"to":48,"icon":48,"external":48,"target":48,"children":2828,"__component":90},[2829,2830,2831,2832],{"to":108,"label":109},{"to":116,"label":117},{"to":112,"label":113},{"to":16,"label":128},{"id":198,"label":122,"description":48,"to":48,"icon":48,"external":48,"target":48,"children":2834,"__component":90},[2835,2836,2837],{"to":121,"label":201,"target":123,"external":124},{"to":203,"label":204,"target":123,"external":124},{"to":206,"label":128,"target":123,"external":124},{},{"posts":2840,"meta":2960},[2841,2876,2906,2933],{"id":2842,"uuid":2843,"title":2844,"slug":2845,"html":2846,"comment_id":2842,"feature_image":2847,"featured":284,"visibility":1257,"created_at":2848,"updated_at":2849,"published_at":2850,"custom_excerpt":2851,"codeinjection_head":2852,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":2853,"primary_tag":2873,"url":2874,"excerpt":2851,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":2875,"meta_description":2851,"email_subject":48,"frontmatter":48,"feature_image_alt":2844,"feature_image_caption":48},"6841c6a1533c9f26b9439af3","df82f327-1304-4f86-8db0-f714fcd72ed5","Discover How pdfRest Outperforms Free Open-Source PDF Tools","discover-how-pdfrest-outperforms-free-open-source-pdf-tools","\n\u003C!--kg-card-begin: html-->\n\u003Cp>Developing applications that handle PDF documents can be a complex endeavor. While numerous open-source PDF tools offer a seemingly free entry point for \u003Cstrong>PDF processing API\u003C\u002Fstrong> integration, developers often encounter significant challenges related to setup, maintenance, scalability, and feature limitations. For businesses seeking reliable, efficient, and secure \u003Cstrong>PDF manipulation solutions\u003C\u002Fstrong> without the hidden costs and complexities, pdfRest emerges as the superior choice.\u003C\u002Fp>\n\n\u003Cp>This article explores common pain points associated with popular open-source PDF tools and demonstrates why pdfRest provides a more robust and streamlined approach to integrating powerful PDF capabilities into your applications, leading to \u003Cstrong>faster PDF development\u003C\u002Fstrong> and reduced operational overhead.\u003C\u002Fp>\n\n\u003Chr>\n\n\u003Ch2>The Hidden Costs and Complexities of Open-Source PDF Tools\u003C\u002Fh2>\n\n\u003Cp>Many open-source PDF libraries and applications, while powerful in their own right, come with inherent challenges that can quickly outweigh their initial \"free\" price tag:\u003C\u002Fp>\n\n\u003Cul>\n    \u003Cli>\u003Cstrong>Setup and Configuration Overhead:\u003C\u002Fstrong> Getting tools like \u003Cstrong>MuPDF\u003C\u002Fstrong>, \u003Cstrong>Apache PDFBox\u003C\u002Fstrong>, \u003Cstrong>Ghostscript\u003C\u002Fstrong>, \u003Cstrong>PDFium\u003C\u002Fstrong>, \u003Cstrong>Tesseract OCR\u003C\u002Fstrong>, or \u003Cstrong>LibreOffice\u003C\u002Fstrong> integrated into your environment often requires deep technical expertise, extensive configuration, and dependency management. This consumes valuable developer time that could be spent on core product development, significantly impacting your \u003Cstrong>PDF processing setup time\u003C\u002Fstrong>.\u003C\u002Fli>\n    \u003Cli>\u003Cstrong>Maintenance and Updates:\u003C\u002Fstrong> Staying current with security patches, bug fixes, and new features for \u003Cstrong>PyPDF\u003C\u002Fstrong>, \u003Cstrong>PDF.js\u003C\u002Fstrong>, \u003Cstrong>Xpdf\u003C\u002Fstrong>, or \u003Cstrong>Qpdf\u003C\u002Fstrong> demands continuous effort. This responsibility falls entirely on your team, diverting resources and introducing potential vulnerabilities if neglected, adding to your \u003Cstrong>PDF library maintenance\u003C\u002Fstrong> burden.\u003C\u002Fli>\n    \u003Cli>\u003Cstrong>Scalability and Performance:\u003C\u002Fstrong> Open-source tools are often designed for single-machine or limited-scale operations. Achieving high-throughput processing for concurrent requests or large volumes of PDFs, as needed for tools like \u003Cstrong>StirlingPDF\u003C\u002Fstrong>, can necessitate significant infrastructure investment and optimization work to handle \u003Cstrong>scaling PDF operations\u003C\u002Fstrong>.\u003C\u002Fli>\n    \u003Cli>\u003Cstrong>Reliability and Error Handling:\u003C\u002Fstrong> While robust, open-source projects can sometimes have less predictable behavior or more cryptic error messages compared to a managed API service. Debugging issues across different environments can be time-consuming, impacting your overall \u003Cstrong>reliable PDF API\u003C\u002Fstrong> needs.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Lack of Dedicated Support:\u003C\u002Fstrong> Unlike commercial APIs, open-source projects typically rely on community forums or volunteer efforts for support. When you encounter a critical bug or a complex implementation challenge with tools like \u003Cstrong>MuPDF\u003C\u002Fstrong> or \u003Cstrong>Ghostscript\u003C\u002Fstrong>, getting timely, expert assistance can be difficult or impossible, leading to prolonged debugging times and project delays for your \u003Cstrong>PDF API troubleshooting\u003C\u002Fstrong>.\u003C\u002Fli>\n    \u003Cli>\u003Cstrong>Feature Gaps and Customization:\u003C\u002Fstrong> While comprehensive, specific advanced PDF functionalities (e.g., precise page box manipulation, complex pre-press settings) might require extensive custom coding or combining multiple tools, leading to brittle solutions and extended \u003Cstrong>PDF development challenges\u003C\u002Fstrong>.\u003C\u002Fli>\n    \u003Cli>\u003Cstrong>OCR Limitations:\u003C\u002Fstrong> While \u003Cstrong>Tesseract OCR\u003C\u002Fstrong> provides powerful character recognition, developers often face complex challenges in integrating it for complete \u003Cstrong>PDF OCR conversion\u003C\u002Fstrong>. This typically involves writing significant custom code for \u003Cstrong>PDF parsing\u003C\u002Fstrong>, precise image extraction from document pages, performing OCR on images, and then meticulously re-embedding the searchable text layer back into the PDF. This manual integration process can be time-consuming and prone to errors when aiming to make \u003Cstrong>scanned PDFs searchable via API\u003C\u002Fstrong>.\u003C\u002Fli>\n    \u003Cli>\u003Cstrong>Web-Based Limitations:\u003C\u002Fstrong> \u003Cstrong>PDF.js\u003C\u002Fstrong> excels at client-side PDF rendering but isn't designed for robust server-side \u003Cstrong>PDF processing\u003C\u002Fstrong> or advanced \u003Cstrong>PDF manipulation tasks\u003C\u002Fstrong>.\u003C\u002Fli>\n    \u003Cli>\u003Cstrong>Proprietary vs. Open:\u003C\u002Fstrong> Tools like \u003Cstrong>PDF Lib\u003C\u002Fstrong> might be powerful but can come with licensing models that introduce new costs or complexities compared to an API subscription, impacting your \u003Cstrong>commercial PDF API vs open source\u003C\u002Fstrong> considerations.\u003C\u002Fli>\n\n\u003Chr>\n\n\u003Ch2>The pdfRest Advantage: Cloud-Based Simplicity, Power, and Scalability\u003C\u002Fh2>\n\n\u003Cp>pdfRest addresses these challenges by offering a comprehensive, cloud-based \u003Cstrong>PDF API platform\u003C\u002Fstrong>. Instead of managing complex installations and dependencies, you make simple REST API calls to perform powerful \u003Cstrong>PDF operations\u003C\u002Fstrong>.\u003C\u002Fp>\n\n\u003Cp>Here's why pdfRest is a better solution for your \u003Cstrong>PDF processing\u003C\u002Fstrong> needs:\u003C\u002Fp>\n\n\u003Ch3>Instant Integration, Zero Setup\u003C\u002Fh3>\n        \u003Cul>\n            \u003Cli>Unlike \u003Cstrong>MuPDF\u003C\u002Fstrong>, \u003Cstrong>Apache PDFBox\u003C\u002Fstrong>, or \u003Cstrong>Ghostscript\u003C\u002Fstrong>, there's no software to install, configure, or maintain. You simply integrate with our REST API using standard HTTP requests from any programming language. This drastically reduces development time and infrastructure overhead for your \u003Cstrong>PDF API integration\u003C\u002Fstrong>.\u003C\u002Fli>\n            \u003Cli>Forget grappling with obscure compilation errors or dependency conflicts that plague many open-source setups.\u003C\u002Fli>\n        \u003C\u002Ful>\n\u003Ch3>Unmatched Reliability and Scalability\u003C\u002Fh3>\n        \u003Cul>\n            \u003Cli>With pdfRest, you gain access to a highly scalable and resilient infrastructure. Our platform handles the underlying complexity of concurrent requests and large file volumes, ensuring consistent performance for all your \u003Cstrong>PDF processing\u003C\u002Fstrong> tasks.\u003C\u002Fli>\n            \u003Cli>No more worrying about optimizing \u003Cstrong>StirlingPDF\u003C\u002Fstrong> instances or scaling your own servers to meet demand. We manage the infrastructure so you don't have to, guaranteeing \u003Cstrong>scalable PDF operations\u003C\u002Fstrong> with a \u003Ca href='https:\u002F\u002Fstatus.pdfrest.com\u002F'>near-100% uptime track-record\u003C\u002Fa>.\u003C\u002Fli>\n        \u003C\u002Ful>\n    \u003Ch3>Comprehensive Features and Precision\u003C\u002Fh3>\n        \u003Cul>\n            \u003Cli>pdfRest provides granular control over all aspects of \u003Cstrong>PDF manipulation\u003C\u002Fstrong>, including precise optimizations for print and archival, complex forms processing, as well as specialized conversions for document editing and LLM training. This goes beyond the basic functionalities of many simple open-source tools.\u003C\u002Fli>\n            \u003Cli>We leverage robust Adobe PDF processing technology, ensuring industry-standard accuracy that can be challenging to replicate with diverse open-source components, making pdfRest a \u003Cstrong>reliable PDF API\u003C\u002Fstrong>.\u003C\u002Fli>\n        \u003C\u002Ful>\n    \u003Ch3>Reduced Maintenance and Operational Costs\u003C\u002Fh3>\n        \u003Cul>\n            \u003Cli>Our team handles all updates, security patches, and infrastructure management. You receive a consistently updated and secure service without any manual intervention, greatly reducing your \u003Cstrong>PDF library maintenance\u003C\u002Fstrong> burden.\u003C\u002Fli>\n            \u003Cli>This eliminates the hidden costs of developer time spent on maintaining open-source libraries like \u003Cstrong>PyPDF\u003C\u002Fstrong> or \u003Cstrong>PDF.js\u003C\u002Fstrong>.\u003C\u002Fli>\n        \u003C\u002Ful>\n    \u003Ch3>Focus on Core Business Logic\u003C\u002Fh3>\n        \u003Cul>\n            \u003Cli>By offloading \u003Cstrong>PDF processing\u003C\u002Fstrong> to pdfRest, your development team can focus on building innovative features for your application, rather than becoming PDF experts or troubleshooting open-source library issues, thereby accelerating \u003Cstrong>developer productivity\u003C\u002Fstrong>.\u003C\u002Fli>\n        \u003C\u002Ful>\n    \u003Ch3>Simplified OCR and Searchability\u003C\u002Fh3>\n        \u003Cul>\n            \u003Cli>Integrating OCR with tools like \u003Cstrong>Tesseract OCR\u003C\u002Fstrong> requires handling image extraction, OCR execution, and re-embedding the text layer. pdfRest simplifies this into a single API call, making \u003Cstrong>scanned PDFs searchable\u003C\u002Fstrong> and enabling easy \u003Cstrong>PDF OCR conversion\u003C\u002Fstrong> without the heavy lifting.\u003C\u002Fli>\n        \u003C\u002Ful>\n    \u003Ch3>API-First Approach for Automation\u003C\u002Fh3>\n        \u003Cul>\n            \u003Cli>Unlike desktop applications like \u003Cstrong>LibreOffice\u003C\u002Fstrong> (which primarily offer manual UI interactions), pdfRest is built from the ground up for programmatic \u003Cstrong>PDF automation\u003C\u002Fstrong>. This is essential for building scalable, integrated \u003Cstrong>PDF workflow automation\u003C\u002Fstrong> solutions.\u003C\u002Fli>\n          \u003C\u002Ful>\n        \u003Ch3>Direct Developer Support\u003C\u002Fh3>\n        \u003Cul>\n            \u003Cli> The pdfRest development team is ready to assist you in overcoming any obstacles. We provide support for integration troubleshooting and PDF processing challenges. You can \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fsupport\u002F'>contact us\u003C\u002Fa> to speak directly with a knowledgeable developer with PDF expertise.\u003C\u002Fli>\n        \u003C\u002Ful>\n   \n\n\u003Chr>\n\n\u003Ch2>Conclusion\u003C\u002Fh2>\n\n\u003Cp>While open-source PDF tools play a vital role in the ecosystem, they often come with a significant total cost of ownership when considering development, integration, maintenance, and scalability. pdfRest offers a modern, efficient, and cost-effective alternative, providing a powerful and reliable \u003Cstrong>PDF processing backend\u003C\u002Fstrong> that frees your team to innovate faster. Make the smarter choice for your \u003Cstrong>PDF workflows\u003C\u002Fstrong> and discover the simplicity and power of pdfRest, the \u003Cstrong>best PDF API for developers\u003C\u002Fstrong> seeking robust and efficient solutions.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2025\u002F06\u002FSolution-Discover-How-pdfRest-Outperforms-Open-Source-PDF-Tools.png","2025-06-05T16:32:33.000+00:00","2026-09-02T18:26:11.000+00:00","2025-06-10T21:34:32.000+00:00","Avoid hidden costs, setup hassles, and scaling issues of open-source PDF tools. Get reliable, secure, and scalable PDF processing for your applications with pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"Article\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fdiscover-how-pdfrest-outperforms-free-open-source-pdf-tools\u002F#article\",\n      \"headline\": \"Discover How pdfRest Outperforms Free Open-Source PDF Tools\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fdiscover-how-pdfrest-outperforms-free-open-source-pdf-tools\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fdiscover-how-pdfrest-outperforms-free-open-source-pdf-tools\u002F\",\n      \"datePublished\": \"2025-06-10T21:34:32.000Z\",\n      \"dateModified\": \"2025-06-10T22:10:18.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Avoid hidden costs, setup hassles, and scaling issues of open-source PDF tools. Get reliable, secure, and scalable PDF processing for your applications with pdfRest.\",\n      \"image\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2025\u002F06\u002FSolution-Discover-How-pdfRest-Outperforms-Open-Source-PDF-Tools.png\",\n      \"keywords\": \"Archival, Compress PDF, Conversion, Extract, Forms, Integration, Microsoft Office, Optimization, Performance, Print, Rendering, Report, Security, Validate, cURL\",\n      \"articleSection\": \"Solutions\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Solutions\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"Discover How pdfRest Outperforms Free Open-Source PDF Tools\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fdiscover-how-pdfrest-outperforms-free-open-source-pdf-tools\u002F\"\n        }\n      ]\n    }\n  ]\n}",[2854,2858,2859,2860,2861,2862,2863,2864,2865,2866,2867,2868,2869,2870,2871,2872],{"id":2855,"name":2856,"slug":2856,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2857},"65ae9a81656af204db4b0e0d","solutions-post","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Fsolutions-post\u002F",{"id":1744,"name":1745,"slug":1746,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1702,"name":1703,"slug":1704,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1356,"name":1357,"slug":1358,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1550,"name":1551,"slug":1552,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1615,"name":1616,"slug":1617,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1736,"name":1737,"slug":1738,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1782,"name":1783,"slug":1784,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1891,"name":1892,"slug":1893,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2063,"name":2064,"slug":2065,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2137,"name":2138,"slug":2139,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2855,"name":2856,"slug":2856,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2857},"https:\u002F\u002Fcms.pdfrest.com\u002Fdiscover-how-pdfrest-outperforms-free-open-source-pdf-tools\u002F","Discover How pdfRest Outperforms Free Open-Source PDF Tools | pdfRest",{"id":2877,"uuid":2878,"title":2879,"slug":2880,"html":2881,"comment_id":2882,"feature_image":2883,"featured":284,"visibility":1257,"created_at":2884,"updated_at":2885,"published_at":2886,"custom_excerpt":2887,"codeinjection_head":2888,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":2889,"primary_tag":2901,"url":2902,"excerpt":2887,"reading_time":394,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":2903,"meta_description":2904,"email_subject":48,"frontmatter":48,"feature_image_alt":2905,"feature_image_caption":48},"65ae9a86656af204db4b1245","84a34fd9-29d8-4160-b91f-222680ab5041","Integrate pdfRest with ChatGPT to Generate PDF Info Summary","integrate-pdfrest-with-chatgpt-to-generate-pdf-info-summary","\u003Ch2 id=\"the-role-of-ai-in-document-processing\">The Role of AI in Document Processing\u003C\u002Fh2>\n\u003Cp>Along with most developers and technology enthusiasts, we've tracked the progress of AI as it has taken leaps forward over the last few years. The technology has reached an exciting and critical point where it can now provide significant functional value to organizations. While services like OpenAI's \u003Ca href=\"https:\u002F\u002Fplatform.openai.com\u002Foverview\">ChatGPT\u003C\u002Fa> are now available to solve complex problems using the power of Large Language Models (LLMs), this only covers one side of any major problem-solving equation, as these services require input to be provided in the form of text prompts. This leads to a fundamental question, \"Where does the input text come from?\"\u003C\u002Fp>\n\u003Ch2 id=\"pairing-pdfrest-and-chatgpt-for-enhanced-document-interaction\">Pairing pdfRest and ChatGPT for Enhanced Document Interaction\u003C\u002Fh2>\n\u003Cp>At pdfRest, we're excited to dive into this question and share some creative ideas for pairing a document processing toolkit, like pdfRest, with an LLM AI service, like ChatGPT, to unlock data from digital documents and create powerful synergy between these services. Join us on an inspirational journey below as we take you step-by-step through a functional solution to integrate the pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F\">Query PDF\u003C\u002Fa> API Tool with OpenAI's ChatGPT API to generate simple, human-readable summaries of complex PDF document metadata and conditional information!\u003C\u002Fp>\n\u003Ch2 id=\"testing-chatgpt-integration\">Testing ChatGPT Integration\u003C\u002Fh2>\n\u003Cp>Before jumping straight into development, we manually passed some input along to ChatGPT's web interface. We weren't initially sure about its ability to read and parse meaning from the JSON format returned by our Query PDF tool. After sending a quick test document to the Query PDF \u003Ccode>\u002Fpdf-info\u003C\u002Fcode> endpoint, we passed the JSON output over to ChatGPT. The first test looked something like this:\u003C\u002Fp>\n\u003Cblockquote>\n\u003Cp>From a standard JSON input, turn the following data into a short summary assuming it describes a PDF Document.\u003C\u002Fp>\n\u003C\u002Fblockquote>\n\u003Cpre style=\"background-color:#0C0C0C;\">{\n    \"tagged\": false,\n    \"image_only\": false,\n    \"title\": \"Character Sheet\",\n    \"subject\": \"What is a subject anyway\",\n    \"author\": \"One of us\",\n    \"producer\": \"Adobe PDF Library 8.0\",\n    \"creator\": \"Adobe InDesign CS3 (5.0.4)\",\n    \"creation_date\": \"2011-06-03T18:22:56\",\n    \"modified_date\": \"2022-12-01T15:30:27\",\n    \"keywords\": \"fantasy, character, people\",\n    \"doc_language\": \"None\",\n    \"page_count\": 2,\n    \"contains_annotations\": true,\n    \"contains_signature\": false,\n    \"pdf_version\": \"1.6.0\",\n    \"file_size\": 684444,\n    \"filename\": \"color_sheet.pdf\",\n}\n\u003C\u002Fpre>\n\u003Cp>ChatGPT responded with the following:\u003C\u002Fp>\n\u003Cblockquote>\n\u003Cp>The JSON input provides details about a PDF document titled \"Character Sheet\" with 2 pages. The document is not tagged, does not contain only images, and has a file size of 684444 bytes. It was authored by \"One of us\" and created using \"Adobe InDesign CS3 (5.0.4)\" on June 3, 2011, at 18:22:56. The most recent modification was on December 1, 2022, at 15:30:27. The document is not limited to a specific language, but its subject is \"What is a subject anyway.\" It is related to keywords such as \"fantasy,\" \"character,\" and \"people.\"\u003Cbr>\u003Cbr>\nAdditionally, the PDF contains annotations and does not have any digital signatures. The PDF version used is \"1.6.0.\" The filename associated with the PDF is \"color_sheet.pdf,\" and it was produced using \"Adobe PDF Library 8.0.\"\u003C\u002Fp>\n\u003C\u002Fblockquote>\n\u003Cp>To our great excitement, it worked! You may notice that along with the JSON output from Query PDF, we also included a prompt to tell ChatGPT what to expect from the input and what to deliver in its output. This \"base\" prompt looked like this:\u003C\u002Fp>\n\u003Cblockquote>\n\u003Cp>From a standard JSON input, turn the following data into a short summary assuming it describes a PDF Document.\u003C\u002Fp>\n\u003C\u002Fblockquote>\n\u003Cp>ChatGPT has been trained on so much information that it can recognize structure and infer meaning, even from data formats such as JSON. Because of this, it has no problem synthesizing a coherent, helpful summary of the detailed PDF metadata and conditional info. The value of this capability is clear - it is now possible to automatically abstract away the complexities of parsing JSON output for meaning and construct a summarized paragraph that a general audience can understand.\u003C\u002Fp>\n\u003Ch3 id=\"proof-of-concept\">Proof of Concept\u003C\u002Fh3>\n\u003Cp>With promising results from our manual testing, we moved on to develop a programmatic proof of concept using both the pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fproducts\u002Fcloud-api\u002F\">Cloud API\u003C\u002Fa> and the OpenAI API. pdfRest is compatible with all major programming languages, and \u003Ca href=\"https:\u002F\u002Fplatform.openai.com\u002Fdocs\u002Flibraries\u002Fpython-library\">OpenAI's documentation\u003C\u002Fa>  provides packages for both Python and JavaScript, so for this example we decided to work with Python.\u003C\u002Fp>\n\u003Cp>To get started, we signed up for an API Key with each service:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fgetstarted\u002F\">pdfRest Get Started\u003C\u002Fa>\u003C\u002Fli>\n\u003Cli>\u003Ca href=\"https:\u002F\u002Fplatform.openai.com\u002Fsignup?launch\">OpenAI Sign Up\u003C\u002Fa>\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>Then we installed the ChatGPT Python package, ensuring it worked as expected. Next, we found pdfRest code samples for the \u003Ccode>\u002Fpdf-info\u003C\u002Fcode> endpoint from the official \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics\u002Fpdf-rest-api-samples\">pdfRest API Samples GitHub Repository\u003C\u002Fa>. With very little modification, we ended up with the following code:\u003C\u002Fp>\n\u003Cpre style=\"background-color:#0C0C0C;\">\nimport openai\nfrom requests_toolbelt import MultipartEncoder\nimport requests\n\nopenai.api_key = \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\" # place your OpenAI API Key here\n\npdf_info_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-info'\nquery_prompt = 'From a standard JSON input, turn the following data into a one paragraph summary assuming it describes a PDF Document. \\n\\n' # default prompt to get info from the \u002Fpdf-info output\nfile_name = 'some_file.pdf' # file name of the PDF to send to \u002Fpdf-info\n \n# The \u002Fpdf-info endpoint can take a single PDF file or id as input.\nmp_encoder_pdfInfo = MultipartEncoder(\n    fields={\n        'file': (\n            file_name, \n            open('\u002FPATH\u002FTO\u002FFILE\u002F'+file_name, 'rb'), \n            'application\u002Fpdf'\n        ),\n        'queries': 'tagged,image_only,title,subject,author,producer,creator,creation_date,modified_date,keywords,doc_language,page_count,contains_annotations,contains_signature,pdf_version,file_size,filename',\n    }\n)\n \n# Let's set the headers that the pdf-info endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdfInfo.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nresponse = requests.post(pdf_info_endpoint_url, data=mp_encoder_pdfInfo, headers=headers)\n \nif response.ok:\n    response_json = response.json()\n\n    # We can remove the unnecessary fields returned by \u002Fpdf-info, such as inputId and allQueriesProcessed\n    # since they don't describe information about the document, just the request\n    del response_json['allQueriesProcessed'] \n    del response_json['inputId']\n    \n    # Append the query_prompt to the beginning of our JSON output returned from \u002Fpdf-info\n    query_string = query_prompt + str(response_json)\n\n    # Send the query off to ChatGPT using the gpt-3.5-turbo model\n    chat_completion = openai.ChatCompletion.create(model=\"gpt-3.5-turbo\", messages=[{\"role\": \"user\", \"content\": query_string}])\n\n    # Print the output to console on returning successfully\n    print(chat_completion.choices[0].message.content)\n    \nelse:\n    print(response.text)\n\n\u003C\u002Fpre>\n\u003Ch3 id=\"breaking-down-the-code\">Breaking Down the Code\u003C\u002Fh3>\n\u003Cp>If you take a quick glance at the pdfRest Python sample code for the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics\u002Fpdf-rest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-info.py\">pdf-info endpoint\u003C\u002Fa>, you'll see that we've preserved the basic structure of the sample code with only minor changes. As this code is self-documented with clear comments, we won't dive into all of the implementation details here.\u003C\u002Fp>\n\u003Cp>Taking a look at the ChatGPT component, you'll notice the \"base\" prompt that we referenced earlier. Through trial and error, we found the input that gave us the most consistent formatting results is as follows:\u003C\u002Fp>\n\u003Cblockquote>\n\u003Cp>From a standard JSON input, turn the following data into a one paragraph summary assuming it describes a PDF Document.\u003C\u002Fp>\n\u003C\u002Fblockquote>\n\u003Cp>There are several important words and phrases in this prompt. First, we specify that the input data the AI can expect is \u003Cstrong>formatted according to standard JSON specifications\u003C\u002Fstrong>. Next, we specify to output \u003Cstrong>\"a one paragraph summary.\"\u003C\u002Fstrong> Without this, we found that ChatGPT produces inconsistent formatting, sometimes presented as a paragraph and other times a bullet point list. Finally, we specify that ChatGPT \u003Cstrong>can assume the data describes a PDF Document.\u003C\u002Fstrong> We have to remember that the only context ChatGPT has is what we provide, and since it doesn't have the \u003Cem>actual\u003C\u002Fem> PDF document, \u003Cem>we\u003C\u002Fem> need to let it know that's what this JSON is referencing.\u003C\u002Fp>\n\u003Cp>Another notable section of code appears here:\u003C\u002Fp>\n\u003Cpre style=\"background-color:#0C0C0C;\">\nif response.ok:\n    response_json = response.json()\n\n    # We can remove the unnecessary fields returned by \u002Fpdf-info, such as inputId and allQueriesProcessed\n    # since they don't describe information about the document, just the request\n    del response_json['allQueriesProcessed'] \n    del response_json['inputId']\n    \n    # Append the query_prompt to the beginning of our JSON output returned from \u002Fpdf-info\n    query_string = query_prompt + str(response_json)\n\n    # Send the query off to ChatGPT using the gpt-3.5-turbo model\n    chat_completion = openai.ChatCompletion.create(model=\"gpt-3.5-turbo\", messages=[{\"role\": \"user\", \"content\": query_string}])\n\n    # Print the output to console on returning successfully\n    print(chat_completion.choices[0].message.content)\n\n\u003C\u002Fpre>\n\u003Cp>As noted in the code's comments, we remove two fields returned by the Query PDF tool that are unnecessary for file summarization: \u003Ccode>allQueriesProcessed\u003C\u002Fcode> and \u003Ccode>inputId\u003C\u002Fcode>. Next, we simply append the previously covered \"base\" prompt, stored in the \u003Ccode>query_prompt\u003C\u002Fcode> variable, to the \u003Ccode>response_json\u003C\u002Fcode>, that's been converted to a string.\u003C\u002Fp>\n\u003Cp>All that's left is to send our prepared text to OpenAI's API, specifying that we want to use the \u003Ccode>gpt-3.5-turbo\u003C\u002Fcode> model (since it's quicker, cheaper, and specializes in dialogue, which is perfect for our application). After a moment, we receive the output back from ChatGPT, and we access the string output by navigating down the returned object to the \u003Ccode>message.content\u003C\u002Fcode>. For our purpose, that's all we care about. Finally, we print the result to the command line.  That's it - in about 50 lines of code, our end-to-end proof of concept is complete!\u003C\u002Fp>\n\u003Ch3 id=\"whats-next\">What's Next?\u003C\u002Fh3>\n\u003Cp>ChatGPT has plenty of tricks up its sleeve, and we are not limited to generating paragraph summaries of PDF details. We can ask ChatGPT to do all sorts of things with our Query PDF results.  As a quick example, we asked it instead to generate a \u003Cem>limerick\u003C\u002Fem> based on the same JSON. This is what ChatGPT gave us:\u003C\u002Fp>\n\u003Cblockquote>\n\u003Cp>There once was a PDF so fine,\u003Cbr>\nCalled \"Character Sheet\", it did shine.\u003Cbr>\nCreated by InDesign,\u003Cbr>\nWith keywords divine,\u003Cbr>\nTwo pages, annotations it did entwine.\u003C\u002Fp>\n\u003C\u002Fblockquote>\n\u003Cp>pdfRest is also working to support more advanced AI-based digital document workflows - check back soon for announcements about new text extraction solutions that will support extracting PDF text content to send straight to ChatGPT or other AI services for summarization, interpretation, and analysis.\u003C\u002Fp>\n\u003Cp>Do you have other ideas or requirements for integrating digitial document workflows with AI technologies?  \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fsupport\u002F\">Let us know\u003C\u002Fa>, and we'll be happy to help you on your journey!\u003C\u002Fp>\n","64c416c02d4014c9499b0967","https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2023\u002F07\u002FSolution-Integrate-pdfRest-with-ChatGPT-to-Generate-PDF-Info-Summary.png","2023-07-28T19:28:00.000+00:00","2026-09-02T18:26:20.000+00:00","2023-07-28T21:16:05.000+00:00","Learn How to Leverage pdfRest Query PDF with OpenAI's ChatGPT LLM to Easily Create Human-readable Summaries of PDF Metadata and Document Conditions","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"Article\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fintegrate-pdfrest-with-chatgpt-to-generate-pdf-info-summary\u002F#article\",\n      \"headline\": \"Integrate pdfRest with ChatGPT to Generate PDF Info Summary\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fintegrate-pdfrest-with-chatgpt-to-generate-pdf-info-summary\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fintegrate-pdfrest-with-chatgpt-to-generate-pdf-info-summary\u002F\",\n      \"datePublished\": \"2023-07-28T21:16:05.000Z\",\n      \"dateModified\": \"2025-02-11T19:21:22.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn How to Leverage pdfRest Query PDF with OpenAI's ChatGPT LLM to Easily Create Human-readable Summaries of PDF Metadata and Document Conditions\",\n      \"image\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2023\u002F07\u002FSolution-Integrate-pdfRest-with-ChatGPT-to-Generate-PDF-Info-Summary.png\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Query PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-info API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fquery-pdf\"\n        }\n      ],\n      \"keywords\": \"AI, ChatGPT, Integration, OpenAI, PDF Info, Python, Query PDF, Summary, Text\",\n      \"articleSection\": \"Solutions\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Solutions\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"Integrate pdfRest with ChatGPT to Generate PDF Info Summary\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fintegrate-pdfrest-with-chatgpt-to-generate-pdf-info-summary\u002F\"\n        }\n      ]\n    }\n  ]\n}",[2890,2891,2892,2893,2894,2895,2896,2897,2898,2899,2900],{"id":2855,"name":2856,"slug":2856,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2857},{"id":1279,"name":1280,"slug":1281,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1286,"name":1287,"slug":1288,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1290,"name":1291,"slug":1292,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1352,"name":1353,"slug":1354,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1348,"name":1349,"slug":1350,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1275,"name":1276,"slug":1276,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1277},{"id":2063,"name":2064,"slug":2065,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1294,"name":1295,"slug":1296,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2855,"name":2856,"slug":2856,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2857},"https:\u002F\u002Fcms.pdfrest.com\u002Fintegrate-pdfrest-with-chatgpt-to-generate-pdf-info-summary\u002F","Integrate pdfRest with ChatGPT to Generate PDF Info Summary | pdfRest","Leverage pdfRest Query PDF with OpenAI's ChatGPT LLM to Easily Create Human-readable Summaries of PDF Metadata and Document Conditions","A PDF is sent to pdfRest for investigation under a magnifying glass then sent to a ChatGPT bot for further analysis",{"id":2907,"uuid":2908,"title":2909,"slug":2910,"html":2911,"comment_id":2912,"feature_image":2913,"featured":284,"visibility":1257,"created_at":2914,"updated_at":2915,"published_at":2916,"custom_excerpt":2917,"codeinjection_head":2918,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":2919,"primary_tag":2929,"url":2930,"excerpt":2917,"reading_time":369,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":2931,"meta_description":2917,"email_subject":48,"frontmatter":48,"feature_image_alt":2932,"feature_image_caption":48},"65ae9a86656af204db4b12f5","93f3000e-3dcf-44e7-abbe-6e5bf70d1063","Generating Summaries of PDF Documents using ChatGPT","generating-summaries-of-pdf-documents-using-chatgpt","\u003Ch2>Leveraging AI for Efficient PDF Summarization\u003C\u002Fh2>\n\u003Cp>ChatGPT and other Large Language Models (LLMs), like Google's Bard, excel at processing and analyzing vast amounts of text at speeds beyond human capability. Businesses can leverage this speed from AI services to efficiently and effectively summarize the contents of PDF documents to gain a number of valuable advantages, including:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Cstrong>Efficiency and Time-Saving\u003C\u002Fstrong>: Manually summarizing lengthy PDF documents can be time-consuming and tedious. Using a text summarization service can automate this process, significantly reducing the time it takes to extract key information from these documents. This can free up employees to focus on more strategic tasks.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Accuracy and Consistency\u003C\u002Fstrong>: Text summarization services utilize advanced algorithms and natural language processing techniques to identify the most important information and generate concise summaries. These services can often produce more accurate and consistent summaries than manual efforts, reducing the risk of errors or omissions.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Scalability and Large Volume Processing\u003C\u002Fstrong>: When dealing with large volumes of PDF documents, manually summarizing each document becomes impractical. Text summarization services can handle large batches of documents efficiently, making it easier to process and analyze large datasets.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Knowledge Management and Information Retrieval\u003C\u002Fstrong>: Summarizing documents can make it easier to organize and store information, making it more readily searchable and accessible. This can improve knowledge management and information retrieval, allowing employees to quickly find relevant information when needed.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Decision-Making and Strategic Planning\u003C\u002Fstrong>: By quickly extracting key information from documents, businesses can make more informed decisions based on accurate and up-to-date data. This can improve strategic planning and decision-making processes.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch2>Integrating pdfRest and ChatGPT for Advanced Summarization\u003C\u002Fh2>\n\u003Cp>In order to use AI services to summarize PDF documents, you'll need to start with a reliable solution for extracting the text out of your documents. Join us as we share a step-by-step demonstration for integrating pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F\">Extract Text\u003C\u002Fa> API Tool into your AI workflows, creating a practical solution that generates a summary of an entire document's contents.\u003Cbr>\n\u003Cbr>\u003Cbr>\u003C\u002Fp>\n\u003Ch3 id=\"api-keys\">API Keys\u003C\u002Fh3>\n\u003Cp>First, you'll need to sign up for API keys to send calls to each service:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fgetstarted\">pdfRest Get Started\u003C\u002Fa>\u003C\u002Fli>\n\u003Cli>\u003Ca href=\"https:\u002F\u002Fplatform.openai.com\u002Fsignup?launch\">OpenAI Sign Up\u003C\u002Fa>\u003Cbr>\n\u003Cbr>\u003Cbr>\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch3 id=\"extracting-the-text-with-pdfrest\">Extracting the Text with pdfRest\u003C\u002Fh3>\n\u003Cp>Next, configure code to send API calls to the pdfRest \u003Ccode>\u002Fextracted-text\u003C\u002Fcode> endpoint:\u003C\u002Fp>\n\u003Cpre>extract_text_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fextracted-text'\n\n# The \u002Fextracted-text endpoint can take a single PDF file or id as input.\nmp_encoder_extractText = MultipartEncoder(\n    fields={\n        'file': (\n            file_name,\n            open(file_path + file_name, 'rb'),\n            'application\u002Fpdf'\n        )\n    }\n)\n\n\n# Let's set the headers that the \u002Fextracted-text endpoint expects. Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_extractText.content_type,\n    'Api-Key': pdfRest_api_key\n}\n\n# Send the POST request to the \u002Fextracted-text endpoint\nresponse = requests.post(extract_text_endpoint_url, data=mp_encoder_extractText, headers=headers)\n\u003C\u002Fpre>\n\u003Cbr>\n\u003Ch3 id=\"summarizing-the-text-with-chatgpt\">Summarizing the Text with ChatGPT\u003C\u002Fh3>\n\u003Cp>Once you get a response from the pdfRest service, chain the contents of the document off to ChatGPT for summarization. OpenAI offers many different models to use, and this can be adjusted based on your needs.\u003C\u002Fp>\n\u003Cp>For this example, we used the new \u003Ccode>gpt-4-1106-preview\u003C\u002Fcode> model, as it offers a much larger 128,000 token context. This larger context allows for documents to be summarized in fewer calls to OpenAI's service, and is sufficient for most medium-to-large sized documents.\u003C\u002Fp>\n\u003Cpre>if response.ok:\n    print(\"Building prompt...\")\n    response_json = response.json()\n\n    # To get the full text of the document, we grab the fullText attribute out of the resulting JSON\n    fullText = response_json[\"fullText\"]\n\n    # In order to keep track of where we are in the document, we're going to split the resulting string into a list, delimited by spaces.\n    fullTextArray = fullText.split()\n\n    # Append the query_prompt to the beginning of our JSON output returned from \u002Fextracted-text\n    query_string = query_prompt\n\n    # This logic sets up a loop that will continue until all the contents of the document have been processed, keeping track of any summaries returned by ChatGPT.\n    shouldLoop = True\n    summaryList = []\n    i = 0\n    while shouldLoop:\n        shouldLoop = False\n        while len(enc.encode(query_string)) &lt; MAX_CONTEXT_SIZE and i &lt; len(fullTextArray):\n            query_string += fullTextArray[i] + \" \"\n            i += 1\n            shouldLoop = True\n\n        # For visual feedback, just printing out how much of the document has been processed by each request being sent\n        print(f\"Got to element #{i} out of {len(fullTextArray)}. \\n\")\n\n        # Send the query off to ChatGPT using the gpt-4-1106-preview model (also known as GPT 4 turbo)\n        chat_completion = completion_with_backoff(model=\"gpt-4-1106-preview\",\n                                                  messages=[{\"role\": \"user\", \"content\": query_string}])\n\n        # Reset query_string back to the default value of query_prompt\n        query_string = query_prompt\n\n        # Add the newly returned summary to the summaryList\n        summaryList.append(chat_completion.choices[0].message.content)\n\n        # If either of these conditions happen, we should break from the loop\n        if len(enc.encode(query_string)) &gt; MAX_CONTEXT_SIZE or i &gt;= len(fullTextArray):\n            break\n\u003C\u002Fpre>\n\u003Cbr>\n\u003Cp>Finally, check to see if the document was processed in one go. If it wasn't, compile the summaries and generate a singular, more cohesive summary:\u003C\u002Fp>\n\u003Cpre># If it took multiple summaries to process the entire document, compile the summaries and summarize them again into a more cohesive singular summary.\n    if len(summaryList) &gt; 1:\n        summary_string = \"\"\n        for summary in summaryList:\n            summary_string += \" \" + summary\n\n        summary_query = (\"Assuming the following text is a compilation of summaries about the contents of a single PDF \"\n                         \"document, create a detailed comprehensive summary of the given text. \\n\\n\") + summary_string\n        final_chat_completion = completion_with_backoff(model=\"gpt-4-1106-preview\",\n                                                        messages=[{\"role\": \"user\", \"content\": summary_query}])\n\n        print(\"\\n\" + final_chat_completion.choices[0].message.content + \"\\n\")\n    elif len(summaryList) == 1:\n        print(\"\\n\" + summaryList[0] + \"\\n\")\n\u003C\u002Fpre>\n\u003Cbr>\n\u003Cp>If you intend on processing very large documents, or using a model with a smaller allowed context (such as \u003Ccode>gpt-3.5-turbo\u003C\u002Fcode>), it can be useful to include helper functions to allow for the chat completion to backoff, since OpenAI employs rate limits on the number of tokens you can send in a certain window of time:\u003C\u002Fp>\n\u003Cpre># Helper function that allows larger documents to process without hitting the rate limits of ChatGPT\n@retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6))\ndef completion_with_backoff(**kwargs):\n    return openai.ChatCompletion.create(**kwargs)\n\u003C\u002Fpre>\n\u003Cbr>\n\u003Cp>You can find the full code example in our \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics\u002Fpdf-rest-api-samples\u002Ftree\u002Fmain\u002FChatGPT\u002FAdvanced%20Integrations\u002FGenerate%20PDF%20Text%20Summary\">GitHub repository\u003C\u002Fa>.\u003Cbr>\n\u003Cbr>\u003Cbr>\u003C\u002Fp>\n\u003Ch3 id=\"example-output\">Example Output\u003C\u002Fh3>\n\u003Cp>We used the steps above to extract text from a PDF containing the complete \u003Ca href=\"https:\u002F\u002Fconstitutioncenter.org\u002Fmedia\u002Ffiles\u002Fconstitution.pdf\">Constitution of the United States of America\u003C\u002Fa> with pdfRest and summarize the text with ChatGPT.  Here was the final summarization output:\u003C\u002Fp>\n\u003Cblockquote>\n\u003Cp>The document contains the full text of the Declaration of Independence and the United States Constitution, including the Bill of Rights and subsequent amendments. The Declaration of Independence, adopted on July 4, 1776, articulates the Enlightenment principles of individual rights and government by consent, declaring the American colonies' independence from Britain. The Constitution, which began implementation on March 4, 1789, structures the federal government into three branches, enumerates its powers, and provides a system of checks and balances.\u003Cbr>\n\u003Cbr>\u003Cbr>\nThe Constitution's first three articles establish the legislative (Congress), executive (President), and judicial (Federal Courts) branches. It also addresses states' powers, procedural rules, and provisions for amendments. The first ten amendments, known as the Bill of Rights (ratified on December 15, 1791), safeguard freedoms such as speech, assembly, and religion; protections against arbitrary arrest and seizure; and rights to fair trials and due process.\u003Cbr>\n\u003Cbr>\u003Cbr>\nSuccessive amendments cover various rights and government functions, including abolishing slavery (13th Amendment), defining citizenship and equal protection (14th Amendment), women's suffrage (19th Amendment), voting rights for 18-year-olds (26th Amendment), and terms for Congressional pay adjustments (27th Amendment). The document concludes with historical dates and a message affirming the importance of returning to fundamental principles to preserve free government.\u003C\u002Fp>\n\u003C\u002Fblockquote>\n\u003Ch3 id=\"conclusion\">Conclusion\u003C\u002Fh3>\n\u003Cp>Your business may benefit from an advanced PDF summarization workflow to save time and money, learn quickly and accurately, and support data-driven decision-making. pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F\">Extract Text\u003C\u002Fa> API Tool pairs perfectly with OpenAI's ChatGPT API to summarize PDF document text. Give the above example a try, and \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fsupport\u002F\">let us know\u003C\u002Fa> if there's anything we can do to help.\u003C\u002Fp>\n\n\u003C!--kg-card-begin: html-->\n\u003Cbr\u002F>\n\u003Ctable width='100%' border='0' cellpadding='10' cellspacing='10' style='background-color:#350566;'>\n\t\u003Ctr>\n        \u003Ctd width='100%' style='text-align:center'>\n            \u003Cbr\u002F>\n            \u003Cdiv style='margin: 0 auto; width: 110px'>\n            \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F\">\n                \u003Cimg width='110px' src=\"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2023\u002F10\u002Fextract-text-2.svg\" alt=\"Extract Text\" style=\"margin: 0;\">\u003C\u002Fa>\n            \u003C\u002Fdiv>\n            \u003Cbr>\n            \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F\">\u003Cb>Extract Text\u003C\u002Fb>\u003C\u002Fa>\n            \u003Cbr\u002F>\u003Cbr\u002F>\n        \u003C\u002Ftd>\n    \u003C\u002Ftr>\n\u003C\u002Ftable>\n\u003Cbr\u002F>\n\u003C!--kg-card-end: html-->\n","65452cde2d4014c9499b26a1","https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2023\u002F11\u002FSolution-Generating-Summaries-of-PDF-Documents-using-ChatGPT.png","2023-11-03T17:24:46.000+00:00","2026-09-02T18:26:18.000+00:00","2023-11-08T20:19:08.000+00:00","Learn how to use pdfRest with ChatGPT to Extract Text from a PDF and Summarize the Complete Document","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"Article\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fgenerating-summaries-of-pdf-documents-using-chatgpt\u002F#article\",\n      \"headline\": \"Generating Summaries of PDF Documents using ChatGPT\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fgenerating-summaries-of-pdf-documents-using-chatgpt\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fgenerating-summaries-of-pdf-documents-using-chatgpt\u002F\",\n      \"datePublished\": \"2023-11-08T20:19:08.000Z\",\n      \"dateModified\": \"2025-01-29T21:11:50.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest with ChatGPT to Extract Text from a PDF and Summarize the Complete Document\",\n      \"image\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2023\u002F11\u002FSolution-Generating-Summaries-of-PDF-Documents-using-ChatGPT.png\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Extract Text API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fextracted-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-text\"\n        }\n      ],\n      \"keywords\": \"AI, ChatGPT, Extract Text, Integration, OpenAI, Python, Summary, Text\",\n      \"articleSection\": \"Solutions\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Solutions\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"Generating Summaries of PDF Documents using ChatGPT\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Fgenerating-summaries-of-pdf-documents-using-chatgpt\u002F\"\n        }\n      ]\n    }\n  ]\n}",[2920,2921,2922,2923,2924,2925,2926,2927,2928],{"id":2855,"name":2856,"slug":2856,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2857},{"id":1279,"name":1280,"slug":1281,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1286,"name":1287,"slug":1288,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1290,"name":1291,"slug":1292,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1476,"name":1477,"slug":1478,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1294,"name":1295,"slug":1296,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2063,"name":2064,"slug":2065,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2855,"name":2856,"slug":2856,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2857},"https:\u002F\u002Fcms.pdfrest.com\u002Fgenerating-summaries-of-pdf-documents-using-chatgpt\u002F","Generating Summaries of PDF Documents using ChatGPT | pdfRest","A PDF leads to a long text file which leads to a robot with the OpenAI logo and finally to a short form text file",{"id":2934,"uuid":2935,"title":2936,"slug":2937,"html":2938,"comment_id":2939,"feature_image":2940,"featured":284,"visibility":1257,"created_at":2941,"updated_at":2942,"published_at":2943,"custom_excerpt":2944,"codeinjection_head":2945,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":2946,"primary_tag":2956,"url":2957,"excerpt":2944,"reading_time":369,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":2958,"meta_description":2944,"email_subject":48,"frontmatter":48,"feature_image_alt":2959,"feature_image_caption":48},"65ae9a86656af204db4b12f3","c45e2387-eb5b-4b49-b75e-f98e79bc8280","Translate PDF Text to New Language with ChatGPT","translate-pdf-text-to-new-language-with-chatgpt","\u003Ch2 id=\"the-importance-of-pdf-text-translation\">The Importance of PDF Text Translation\u003C\u002Fh2>\n\u003Cp>Translating PDF documents into different languages allows businesses to communicate with their customers and partners in their preferred language. For example, a business can translate its customer support documentation into different languages so that its customers can easily find the information they need.\u003C\u002Fp>\n\u003Ch2 id=\"legal-and-market-expansion-benefits-of-translation\">Legal and Market Expansion Benefits of Translation\u003C\u002Fh2>\n\u003Cp>PDF text translation is especially important in countries where businesses are required to provide certain documents, such as contracts and invoices, in the local language. Translating PDF documents into different languages allows businesses to comply with these legal requirements.\u003C\u002Fp>\n\u003Cp>Businesses can also use translated PDF documents to reach new markets and increase sales. For example, a business can translate its marketing materials into different languages to target new customers in other countries.\u003C\u002Fp>\n\u003Ch2 id=\"example-translating-extracted-text-from-a-pdf\">Example: Translating Extracted Text from a PDF\u003C\u002Fh2>\n\u003Cp>Let's step through an example of translating extracted text from a PDF file using pdfRest and OpenAI's ChatGPT.\u003Cbr>\n\u003Cbr>\u003C\u002Fp>\n\u003Ch3 id=\"environment\">Environment\u003C\u002Fh3>\n\u003Cp>For convenience, we will set up an environment running \u003Ca href=\"https:\u002F\u002Fjupyter.org\u002F\">Jupyter\u003C\u002Fa>. One way to do that is to create a Python environment and activate it:\u003C\u002Fp>\n\u003Cpre>python -m venv .venv\n. .\u002F.venv\u002Fbin\u002Factivate\u003C\u002Fpre>\n\u003Cp>Then install Jupyter.\u003C\u002Fp>\n\u003Cp>\u003Ccode>python -m pip install jupyter\u003C\u002Fcode>\u003C\u002Fp>\n\u003Cp>You'll also need to install the other Python packages required by these sample notebooks. Those are in a file called \u003Ccode>requirements.txt\u003C\u002Fcode>, available in our \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics\u002Fpdf-rest-api-samples\u002Ftree\u002Fmain\u002FChatGPT\u002FAdvanced%20Integrations\">GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003Cp>\u003Ccode>python -m pip install -r requirements.txt\u003C\u002Fcode>\u003C\u002Fp>\n\u003Cp>Run Jupyter, opening this notebook.\u003C\u002Fp>\n\u003Cp>\u003Ccode>jupyter notebook extract-and-translate.ipynb\u003C\u002Fcode>\u003Cbr>\n\u003Cbr>\u003C\u002Fp>\n\u003Ch3 id=\"api-keys\">API keys\u003C\u002Fh3>\n\u003Cp>You'll need to sign up for API keys in order to use this example:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fgetstarted\">pdfRest Get Started\u003C\u002Fa>\u003C\u002Fli>\n\u003Cli>\u003Ca href=\"https:\u002F\u002Fplatform.openai.com\u002Fsignup?launch\">OpenAI Sign Up\u003C\u002Fa>\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>Create a file called \u003Ccode>.env\u003C\u002Fcode> in the same directory as this notebook, and places the keys into it, like this:\u003C\u002Fp>\n\u003Cpre>OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\nPDFREST_API_KEY=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\u003C\u002Fpre>\n\u003Cp>First, we will start by importing some Python modules that we need, and acquiring API keys.\u003C\u002Fp>\n\u003Cpre>import os\nfrom pathlib import Path\n\nimport openai\nimport requests\nfrom dotenv import load_dotenv\nfrom IPython.display import display_markdown\nfrom requests_toolbelt import MultipartEncoder\n\nload_dotenv()\n\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\npdfrest_api_key = os.getenv(\"PDFREST_API_KEY\")\n\nREQUEST_TIMEOUT = 30\u003C\u002Fpre>\n\u003Cbr>\n\u003Ch3 id=\"extracting-the-text\">Extracting the text\u003C\u002Fh3>\n\u003Cp>Below, we'll define a function that extracts the text from a PDF document represented by a path on disk. It will get the full text by page, returning the JSON data from the endpoint.\u003C\u002Fp>\n\u003Cpre>def extract_text(document: Path) -&gt; dict:\n    \"\"\"Extract text on a page-by-page basis from a document, and\n    return the extracted text\"\"\"\n\n    extract_endpoint_url = \"https:\u002F\u002Fapi.pdfrest.com\u002Fextracted-text\"\n\n    # Define the file to upload, and request full text on a per-page basis\n    request_data = [\n        (\"file\", (document.name, document.open(mode=\"rb\"), \"application\u002Fpdf\")),\n        (\"full_text\", \"by_page\"),\n    ]\n\n    mp_encoder_upload = MultipartEncoder(fields=request_data)\n\n    # Let's set the headers that the upload endpoint expects.\n    # Since MultipartEncoder is used, the 'Content-Type' header gets set to\n    # 'multipart\u002Fform-data' via the content_type attribute below.\n    headers = {\n        \"Accept\": \"application\u002Fjson\",\n        \"Content-Type\": mp_encoder_upload.content_type,\n        \"Api-Key\": pdfrest_api_key,\n    }\n\n    print(\"Sending POST request to extract text endpoint...\")\n    response = requests.post(\n        extract_endpoint_url,\n        data=mp_encoder_upload,\n        headers=headers,\n        timeout=REQUEST_TIMEOUT,\n    )\n\n    # Print the response status code and raise an exception if the request fails\n    print(\"Response status code: \" + str(response.status_code))\n    response.raise_for_status()\n\n    return response.json()\u003C\u002Fpre>\n\u003Cbr>\n\u003Ch3 id=\"translationchatbot\">TranslationChatbot\u003C\u002Fh3>\n\u003Cp>Let's define a chatbot whose main purpose is translation. This is a Python class, which makes a persistent object that can be used for a continuing conversation.\u003C\u002Fp>\n\u003Cp>We start with a system instruction. The system instruction indicates to OpenAI what the purpose of the conversation is, what role it should take, and any additional instructions.\u003C\u002Fp>\n\u003Cp>When translating, we also prepend the material to be translated with an instruction to translate to English.\u003C\u002Fp>\n\u003Cp>Each interaction is recorded in \u003Ccode>self.messages\u003C\u002Fcode>, which contains content and a role:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Ccode>system\u003C\u002Fcode> means that the content is a system instruction. System instructions are usually present at the start of a conversation, but are typically not presented to the user, for instance, in ChatGPT.\u003C\u002Fli>\n\u003Cli>\u003Ccode>user\u003C\u002Fcode> means that the content is part of the conversation that was uttered by the user.\u003C\u002Fli>\n\u003Cli>\u003Ccode>assistant\u003C\u002Fcode> means that the content is a reply from the AI.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>This class makes it easy to have a conversation with GPT-4. We call \u003Ccode>translate_text()\u003C\u002Fcode> to supply text to be translated, and \u003Ccode>chat()\u003C\u002Fcode> if we want to continue the conversation.\u003C\u002Fp>\n\u003Cpre>class TranslationChatbot:\n    \"\"\"A chatbot that specializes in translation, but can have a continuing conversation.\"\"\"\n\n    SYSTEM_INSTRUCTION = \"\"\"\n    You are a helpful translator. Given an input text, translate\n    it to the requested language. If there are any ambiguities,\n    or things that couldn't be translated, please\n    mention them after the translation.\n\n    The output can use Markdown for formatting.\n    \"\"\"\n\n    TRANSLATION_INSTRUCTION = \"\"\"\n    Please translate the following to English:\n\n    \"\"\"\n\n    def __init__(self):\n        self.messages = [\n            {\"content\": self.SYSTEM_INSTRUCTION, \"role\": \"system\"},\n        ]\n\n    def get_openai_response(self, new_message):\n        \"\"\"Request chat completion from OpenAI, and update the messages with the reply. Returns the response from OpenAI.\"\"\"\n        self.messages.append(new_message)\n        response = openai.ChatCompletion.create(\n            model=\"gpt-4\",\n            temperature=0,\n            messages=self.messages,\n        )\n        message = response[\"choices\"][0][\"message\"]\n        self.messages.append(message)\n        return response\n\n    def translate_text(self, text: str) -&gt; str:\n        \"\"\"Translate text, and return OpenAI's reply.\"\"\"\n\n        response = self.get_openai_response(\n            {\"content\": f\"{self.TRANSLATION_INSTRUCTION}{text}\", \"role\": \"user\"}\n        )\n        message = response[\"choices\"][0][\"message\"]\n        return message[\"content\"]\n\n    def converse(self, text: str) -&gt; str:\n        \"\"\"Add a message to the conversation, and return OpenAI's reply.\"\"\"\n        response = self.get_openai_response({\"content\": text, \"role\": \"user\"})\n        message = response[\"choices\"][0][\"message\"]\n        return message[\"content\"]\n\n    def chat(self, text: str) -&gt; str:\n        \"\"\"A simple method for chatting. OpenAI returns results formatted with Markdown,\n        and may contain text styling and lists.\"\"\"\n        display_markdown(self.converse(text), raw=True)\u003C\u002Fpre>\n\u003Cbr>\n\u003Ch3 id=\"extract-the-text\">Extract the text\u003C\u002Fh3>\n\u003Cp>Here, we simply call \u003Ccode>extract_text()\u003C\u002Fcode> with the path to the input document. In this case, the PDF file contains Article 1 of the \u003Ca href=\"https:\u002F\u002Fwww.ohchr.org\u002Fen\u002Fhuman-rights\u002Funiversal-declaration\u002F\">Universal Declaration of Human Rights\u003C\u002Fa> in Greek.\u003C\u002Fp>\n\u003Cp>After that, we get the text of the first page. As you can see from the code, the \u003Ccode>fullText\u003C\u002Fcode> dictionary contains an array \u003Ccode>pages\u003C\u002Fcode> which contains each page. The code gets the first page, indexed by \u003Ccode>0\u003C\u002Fcode>, and retrieves the \u003Ccode>text\u003C\u002Fcode> from it.\u003C\u002Fp>\n\u003Cpre>extracted_text = extract_text(Path(\"pdf\u002FUDHR_Article_1_Greek.pdf\"))\npage_1_text = extracted_text[\"fullText\"][\"pages\"][0][\"text\"]\u003C\u002Fpre>\n\u003Cp>Sending POST request to extract text endpoint...\u003Cbr>\nResponse status code: 200\u003Cbr>\n\u003Cbr>\u003C\u002Fp>\n\u003Ch3 id=\"using-the-translationchatbot\">Using the TranslationChatbot\u003C\u002Fh3>\n\u003Cp>Create a \u003Ccode>TranslationChatbot\u003C\u002Fcode>. Use it to translate the text, and ask it to translate the text of the page.\u003C\u002Fp>\n\u003Cp>The chatbot retains the history of the conversation, so that we can make further inquiries about the text that was translated.\u003C\u002Fp>\n\u003Cp>Since this code is running in the context of a Jupyter notebook, we use \u003Ccode>display_markdown()\u003C\u002Fcode> to print output with style attached. GPT-4 also provides Markdown formatted content, so if the response has any lists or tables in it, they will render nicely.\u003C\u002Fp>\n\u003Cpre>chatbot = TranslationChatbot()\ndisplay_markdown(f\"**Text before translation:** {page_1_text}\", raw=True)\ntranslated_text = chatbot.translate_text(page_1_text)\ndisplay_markdown(f\"**Text after translation:** {translated_text}\", raw=True)\u003C\u002Fpre>\n\u003Cp>\u003Cb>Text before translation:\u003C\u002Fb> ΑΡΘΡΟ 1 ' Ολοι οι άνθρωποι γεννιούνται ελεύθεροι και ίσοι στην αξιοπρέπεια και τα δικαιώματα. Είναι προικισμένοι με λογική και συνείδηση, και οφείλουν να συμπεριφέρονται μεταξύ τους με πνεύμα αδελφοσύνης.\u003C\u002Fp>\n\u003Cp>\u003Cb>Text after translation:\u003C\u002Fb> ARTICLE 1: All human beings are born free and equal in dignity and rights. They are endowed with reason and conscience and should act towards one another in a spirit of brotherhood.\u003Cbr>\n\u003Cbr>\u003C\u002Fp>\n\u003Ch3 id=\"conclusion\">Conclusion\u003C\u002Fh3>\n\u003Cp>You may wish to consider translating your PDF documents into different languages to reach new markets, improve customer service, and comply with legal requirements. pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F\">Extract Text\u003C\u002Fa> API Tool pairs perfectly with OpenAI's ChatGPT API to translate PDF document text to new languages. Give the above example a try, and \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fsupport\u002F\">let us know\u003C\u002Fa> if there's anything we can do to help.\u003C\u002Fp>\n\n\u003C!--kg-card-begin: html-->\n\u003Cbr\u002F>\n\u003Ctable width='100%' border='0' cellpadding='10' cellspacing='10' style='background-color:#350566;'>\n\t\u003Ctr>\n        \u003Ctd width='100%' style='text-align:center'>\n            \u003Cbr\u002F>\n            \u003Cdiv style='margin: 0 auto; width: 110px'>\n            \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F\">\n                \u003Cimg width='110px' src=\"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2023\u002F10\u002Fextract-text-2.svg\" alt=\"Extract Text\" style=\"margin: 0;\">\u003C\u002Fa>\n            \u003C\u002Fdiv>\n            \u003Cbr>\n            \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F\">\u003Cb>Extract Text\u003C\u002Fb>\u003C\u002Fa>\n            \u003Cbr\u002F>\u003Cbr\u002F>\n        \u003C\u002Ftd>\n    \u003C\u002Ftr>\n\u003C\u002Ftable>\n\u003Cbr\u002F>\n\u003C!--kg-card-end: html-->\n","65443e5e2d4014c9499b25cb","https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2023\u002F11\u002FSolution-Translate-PDF-Text-to-New-Language-with-ChatGPT.png","2023-11-03T00:27:10.000+00:00","2026-09-02T18:26:35.000+00:00","2023-11-03T02:10:23.000+00:00","Learn how to leverage pdfRest Extract Text with OpenAI's ChatGPT LLM to translate PDF text to different languages","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"Article\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Ftranslate-pdf-text-to-new-language-with-chatgpt\u002F#article\",\n      \"headline\": \"Translate PDF Text to New Language with ChatGPT\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Ftranslate-pdf-text-to-new-language-with-chatgpt\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Ftranslate-pdf-text-to-new-language-with-chatgpt\u002F\",\n      \"datePublished\": \"2023-11-03T02:10:23.000Z\",\n      \"dateModified\": \"2025-02-11T19:22:58.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to leverage pdfRest Extract Text with OpenAI's ChatGPT LLM to translate PDF text to different languages\",\n      \"image\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2023\u002F11\u002FSolution-Translate-PDF-Text-to-New-Language-with-ChatGPT.png\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Extract Text API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fextracted-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-text\"\n        }\n      ],\n      \"keywords\": \"ChatGPT, Extract, Extract Text, Integration, OpenAI, Python, Text, Translation\",\n      \"articleSection\": \"Solutions\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Solutions\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"Translate PDF Text to New Language with ChatGPT\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Fsolutions\u002Ftranslate-pdf-text-to-new-language-with-chatgpt\u002F\"\n        }\n      ]\n    }\n  ]\n}",[2947,2948,2949,2950,2951,2952,2953,2954,2955],{"id":2855,"name":2856,"slug":2856,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2857},{"id":1290,"name":1291,"slug":1292,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1286,"name":1287,"slug":1288,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1476,"name":1477,"slug":1478,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1298,"name":1299,"slug":1300,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2063,"name":2064,"slug":2065,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2855,"name":2856,"slug":2856,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2857},"https:\u002F\u002Fcms.pdfrest.com\u002Ftranslate-pdf-text-to-new-language-with-chatgpt\u002F","Translate PDF Text to New Language with ChatGPT | pdfRest","Text from a PDF is passed to a robot with the OpenAI logo, who performs language translation",{"pagination":2961},{"page":5,"limit":2962,"pages":5,"total":345,"next":48,"prev":48},"all",{"posts":2964,"meta":11945},[2965,2988,3007,3026,3044,3064,3081,3099,3117,3135,3152,3170,3187,3207,3226,3245,3265,3284,3304,3321,3340,3358,3376,3395,3413,3432,3450,3469,3487,3505,3524,3541,3559,3576,3594,3611,3629,3649,3668,3687,3707,3727,3747,3764,3782,3799,3817,3835,3853,3873,3892,3912,3930,3948,3968,3986,4005,4024,4041,4059,4079,4102,4125,4146,4167,4188,4209,4229,4249,4268,4288,4307,4326,4346,4366,4387,4407,4428,4449,4468,4488,4506,4526,4545,4565,4587,4609,4630,4651,4673,4694,4716,4737,4758,4780,4801,4823,4842,4861,4881,4900,4920,4939,4959,4978,4997,5017,5036,5056,5073,5093,5113,5133,5153,5172,5190,5209,5227,5246,5264,5282,5302,5321,5341,5360,5379,5399,5419,5440,5461,5482,5503,5523,5546,5568,5590,5612,5634,5657,5675,5694,5713,5732,5751,5770,5789,5810,5829,5850,5871,5891,5911,5930,5950,5969,5988,6009,6029,6050,6070,6090,6111,6131,6150,6168,6186,6204,6222,6242,6259,6278,6296,6314,6333,6352,6373,6393,6413,6434,6454,6475,6495,6514,6533,6551,6570,6588,6609,6629,6649,6669,6690,6711,6732,6752,6773,6793,6813,6834,6854,6872,6888,6908,6929,6950,6972,6993,7014,7037,7058,7080,7097,7115,7133,7151,7169,7187,7207,7227,7245,7264,7283,7301,7319,7339,7356,7374,7392,7412,7435,7458,7478,7499,7520,7542,7560,7579,7598,7616,7635,7653,7674,7695,7714,7733,7754,7773,7792,7810,7828,7847,7865,7884,7903,7921,7940,7958,7977,7996,8014,8031,8049,8066,8084,8101,8121,8141,8161,8180,8200,8219,8238,8256,8273,8291,8309,8328,8347,8367,8388,8407,8427,8447,8467,8488,8509,8530,8551,8572,8591,8610,8629,8648,8668,8687,8708,8728,8747,8768,8789,8810,8829,8846,8863,8881,8898,8915,8933,8951,8970,8988,9006,9025,9044,9064,9080,9096,9113,9129,9149,9168,9186,9206,9225,9245,9262,9281,9300,9317,9335,9352,9371,9388,9406,9424,9443,9464,9482,9498,9516,9532,9548,9566,9585,9604,9621,9640,9660,9680,9697,9715,9732,9749,9766,9782,9802,9822,9841,9860,9880,9899,9920,9941,9961,9980,9999,10019,10041,10061,10081,10102,10122,10143,10162,10181,10200,10219,10237,10256,10273,10291,10308,10325,10342,10360,10381,10401,10422,10442,10463,10484,10502,10519,10537,10554,10571,10589,10609,10626,10643,10663,10683,10702,10723,10743,10764,10784,10805,10826,10846,10865,10885,10904,10923,10943,10960,10978,10995,11012,11030,11047,11065,11081,11099,11116,11132,11149,11167,11183,11200,11217,11234,11250,11272,11295,11316,11338,11361,11384,11405,11425,11446,11466,11486,11507,11527,11546,11564,11582,11601,11621,11640,11658,11675,11693,11712,11730,11749,11767,11786,11804,11822,11841,11858,11876,11893,11910,11928],{"id":2966,"uuid":2967,"title":2968,"slug":2969,"html":2970,"comment_id":2971,"feature_image":48,"featured":284,"visibility":1257,"created_at":2972,"updated_at":2973,"published_at":2972,"custom_excerpt":2974,"codeinjection_head":2975,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":2976,"primary_tag":2985,"url":2986,"excerpt":2974,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":2987,"meta_description":2974,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1384","40ad3048-bdca-400e-b52d-c56a464adcaf","How to Add Attachments to PDF Files in .NET with C#","how-to-add-attachments-to-pdf-files","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Add Attachments to PDF with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F'>Add to PDF API Tool\u003C\u002Fa> allows users to programmatically add attachments to PDF documents. This tutorial will guide you through the process of sending an API call to Add to PDF using C#. Imagine you have an application where users can download PDF reports and you want to include related documents, such as source data in an XML file, as an attachment to the PDF.\u003C\u002FP>\n\n\u003Cp>This functionality can enhance the user experience by providing all relevant information bundled together in a single file.\u003C\u002Fp>\n\n\u003Ch2>Add Attachments to PDF with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf-with-added-attachment\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArray2 = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n        var byteAryContent2 = new ByteArrayContent(byteArray2);\n        multipartContent.Add(byteAryContent2, \"file_to_attach\", \"file_name\");\n        byteAryContent2.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fxml\"); \u002F\u002F Update content type\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-added-attachment.cs\">pdf-rest-api-samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This code snippet shows how to make a multipart\u002Fform-data POST request to the pdfRest API to attach a file to a PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>This line initializes an HttpClient instance with the base address set to the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>This line adds your API key to the request headers for authentication purposes.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\u003C\u002Fpre>\n\n\u003Cp>Here, the code reads the bytes of the PDF file you want to add attachments to and adds it to the multipart content with the appropriate content type.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray2 = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\nvar byteAryContent2 = new ByteArrayContent(byteArray2);\nmultipartContent.Add(byteAryContent2, \"file_to_attach\", \"file_name\");\nbyteAryContent2.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fxml\");\n\u003C\u002Fpre>\n\n\u003Cp>Similarly, this snippet reads the bytes of the file you wish to attach and adds it to the multipart content, specifying its content type.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\n\u003C\u002Fpre>\n\n\u003Cp>This line sends the assembled request to the pdfRest API and awaits the response.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you have successfully made an API call to add attachments to a PDF document using C#. This can be particularly useful for applications that need to distribute or archive documents with their associated data or supplementary materials.\u003C\u002Fp>\n\n\u003Cp>You are encouraged to demo all of the pdfRest API Tools in the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\u003C\u002Fa> and refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa> for more details.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-added-attachment.cs\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","65aae039132b360925362324","2024-01-19T20:48:57.000+00:00","2026-09-02T18:19:48.000+00:00","Learn how to use .NET to add an attachment to a PDF by calling Add to PDF API Tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files\u002F#article\",\n      \"headline\": \"How to Add Attachments to PDF Files in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files\u002F\",\n      \"datePublished\": \"2024-01-19T20:48:57.000Z\",\n      \"dateModified\": \"2026-09-02T18:08:59.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use .NET to add an attachment to a PDF by calling Add to PDF API Tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-attachment API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Add to PDF, Optimization\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Attachments to PDF Files in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files\u002F\"\n        }\n      ]\n    }\n  ]\n}",[2977,2981,2982,2983,2984],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"65ae9a81656af204db4b0f62","tutorial-post","https:\u002F\u002Fcms.pdfrest.com\u002Ftag\u002Ftutorial-post\u002F",{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1891,"name":1892,"slug":1893,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-attachments-to-pdf-files\u002F","How to Add Attachments to PDF Files, Tutorial | pdfRest",{"id":2989,"uuid":2990,"title":2991,"slug":2992,"html":2993,"comment_id":2989,"feature_image":48,"featured":284,"visibility":1257,"created_at":2994,"updated_at":2995,"published_at":2995,"custom_excerpt":2996,"codeinjection_head":2997,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":2998,"primary_tag":3004,"url":3005,"excerpt":2996,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3006,"meta_description":2996,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a9750ca533c9f26b943b741","ac0095c2-d4bd-4925-a7f0-d53c2679efea","How to Add Attachments to PDF Files with cURL","how-to-add-attachments-to-pdf-files-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Cp>In this tutorial, we'll walk through how to add attachments to PDF files using cURL and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\">Add to PDF API Tool\u003C\u002Fa>. The complete shell command stays visible, and each pdfRest-specific field is explained before you adapt the Add Attachments to PDF request to your own workflow.\u003C\u002Fp>\n\n\u003Ch2>Why Add Attachments to PDF Files with cURL?\u003C\u002Fh2>\n\n\u003Cp>PDF attachments allow one document to carry related source material without placing that material on a visible page. This is useful when people need the PDF presentation while another system needs the original data or supporting evidence.\u003C\u002Fp>\n\n\u003Cp>Consider an invoicing workflow that produces a readable PDF and an XML record for automated accounting. A cURL step can embed the XML inside the invoice PDF so both representations move through approval, delivery, and storage as one package.\u003C\u002Fp>\n\n\u003Cp>The request uploads the main PDF through \u003Ccode>file\u003C\u002Fcode> and the supporting document through \u003Ccode>file_to_attach\u003C\u002Fcode>. pdfRest returns a new PDF resource; it does not overwrite either uploaded input.\u003C\u002Fp>\n\n\u003Ch2>cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\ncurl -X POST \"$API_URL\u002Fpdf-with-added-attachment\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"file_to_attach=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\"\u003C\u002Fpre>\n\n\u003Cp>Source for Add Attachments to PDF: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-added-attachment.sh\">View the cURL sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Choose the pdfRest service region\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>The Add Attachments to PDF example routes to the US service through the active URL, while the commented hostname provides the EU option. Keep every Add Attachments to PDF input and generated resource ID in the same region.\u003C\u002Fp>\n\n\u003Ch3>Build the authenticated multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"$API_URL\u002Fpdf-with-added-attachment\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\u003C\u002Fpre>\n\n\u003Cp>This POST targets the endpoint used by Add Attachments to PDF. For the Add Attachments to PDF request, \u003Ccode>Accept\u003C\u002Fcode> asks for JSON, \u003Ccode>Content-Type\u003C\u002Fcode> identifies the multipart payload, and \u003Ccode>Api-Key\u003C\u002Fcode> authenticates the call.\u003C\u002Fp>\n\n\u003Ch3>Upload the input file data\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"file_to_attach=@\u002Fpath\u002Fto\u002Ffile\" \\\u003C\u002Fpre>\n\n\u003Cp>The two file fields have different roles, so preserving descriptive filenames helps recipients recognize the PDF and its embedded attachment.\u003C\u002Fp>\n\n\u003Ch3>Set the operation-specific fields\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\u003C\u002Fpre>\n\n\u003Cp>For Add Attachments to PDF, the \u003Ccode>output\u003C\u002Fcode> field supplies the requested base name for the generated resource. Any additional fields shown here control behavior specific to this operation.\u003C\u002Fp>\n\n\u003Ch3>Read the generated resource response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"$API_URL\u002Fpdf-with-added-attachment\" \\\u003C\u002Fpre>\n\n\u003Cp>A successful Add Attachments to PDF call returns JSON describing the generated resource, including its output ID and download information. Preserve the Add Attachments to PDF result needed by the next workflow step before the configured retention period expires.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You now have a cURL request that combines a PDF and a supporting file into one portable result. The same pattern can package invoice XML, audit evidence, source documents, or other records that should remain connected to the visible PDF.\u003C\u002Fp>\n\n\u003Cp>When you bring this into an application, verify attachment names and media types in the PDF viewers your users depend on. Save the generated file before its retention period expires, and delete temporary resources when the package no longer needs to remain available.\u003C\u002Fp>\n\n\u003Cp>Continue exploring the Add Attachments to PDF workflow in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the complete Add Attachments to PDF request contract, accepted values, defaults, and limitations, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\u002F\">Add to PDF API Tool documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: The Add Attachments to PDF example above uploads a file with multipart form data. For source content already stored in pdfRest, the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-added-attachment.sh\">Add Attachments to PDF JSON payload example\u003C\u002Fa> shows the resource-ID request shape.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T22:25:14.000+00:00","2026-09-03T17:04:35.000+00:00","Learn how to attach a supporting file to a PDF with cURL and keep human-readable and machine-readable content together.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-curl\u002F#article\",\n      \"headline\": \"How to Add Attachments to PDF Files with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-curl\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to attach a supporting file to a PDF with cURL and keep human-readable and machine-readable content together.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-attachment API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Add to PDF, Attachment, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Attachments to PDF Files with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[2999,3000,3001,3002,3003],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1907,"name":1908,"slug":1909,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-attachments-to-pdf-files-with-curl\u002F","How to Add Attachments to PDF Files with cURL, Tutorial | pdfRest",{"id":3008,"uuid":3009,"title":3010,"slug":3011,"html":3012,"comment_id":3008,"feature_image":48,"featured":284,"visibility":1257,"created_at":3013,"updated_at":3014,"published_at":3015,"custom_excerpt":3016,"codeinjection_head":3017,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3018,"primary_tag":3023,"url":3024,"excerpt":3016,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3025,"meta_description":3016,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c54533c9f26b943b476","0b31de19-2c68-467f-ac47-adf814670f4e","How to Add Attachments to PDF Files with Java","how-to-add-attachments-to-pdf-files-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>In this tutorial, we'll walk through how to add attachments to PDF files with Java using the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\">Add to PDF API Tool\u003C\u002Fa>. The code supplies the source PDF and attachment as separate multipart parts, then receives a new PDF resource that contains both. You'll see how the request is assembled and how to work with the response returned when you add attachments to PDF files.\u003C\u002Fp>\n\n\u003Ch2>Why Add Attachments to PDF Files with Java?\u003C\u002Fh2>\n\n\u003Cp>A claims platform may need to keep an XML decision record or original evidence beside the readable PDF. Embedding the source as an attachment keeps the related material together without changing the visible pages.\u003C\u002Fp>\n\n\u003Cp>The Java request sends the PDF as \u003Ccode>file\u003C\u002Fcode> and the supporting document as \u003Ccode>file_to_attach\u003C\u002Fcode>. Both are multipart file parts, so callers should preserve meaningful filenames and media types.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONObject;\n\npublic class PDFWithAddedAttachment {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify the path to your file attachment here, or as the second argument when running the\n  \u002F\u002F program.\n  private static final String DEFAULT_ATTACHMENT_PATH = \"\u002Fpath\u002Fto\u002Ffile.xml\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile, attachmentFile;\n    if (args.length > 1) {\n      inputFile = new File(args[0]);\n      attachmentFile = new File(args[1]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n      attachmentFile = new File(DEFAULT_ATTACHMENT_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    final RequestBody attachmentFileRequestBody =\n        RequestBody.create(attachmentFile, MediaType.parse(\"application\u002Fxml\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"file_to_attach\", attachmentFile.getName(), attachmentFileRequestBody)\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf-with-added-attachment\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPDFWithAddedAttachment.java\">Java sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The import block uses OkHttp for transport, dotenv for loading \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode>, and \u003Ccode>org.json\u003C\u002Fcode> for structured request or response data.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify the path to your file attachment here, or as the second argument when running the\n  \u002F\u002F program.\n  private static final String DEFAULT_ATTACHMENT_PATH = \"\u002Fpath\u002Fto\u002Ffile.xml\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile, attachmentFile;\n    if (args.length > 1) {\n      inputFile = new File(args[0]);\n      attachmentFile = new File(args[1]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\u003C\u002Fpre>\n\n\u003Cp>Two default paths identify the PDF and its attachment, and two command-line arguments can replace them at runtime; dotenv supplies the API key independently of both files.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody attachmentFileRequestBody =\n        RequestBody.create(attachmentFile, MediaType.parse(\"application\u002Fxml\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"file_to_attach\", attachmentFile.getName(), attachmentFileRequestBody)\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf-with-added-attachment\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The Java request sends the PDF as \u003Ccode>file\u003C\u002Fcode> and the supporting document as \u003Ccode>file_to_attach\u003C\u002Fcode>. Both are multipart file parts, so callers should preserve meaningful filenames and media types. This payload builder leaves boundary construction to OkHttp so the header remains synchronized with the serialized content.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf-with-added-attachment\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\u003C\u002Fpre>\n\n\u003Cp>The outbound call posts the multipart content to pdfRest and keeps deployment-region changes independent of the rest of the Java code.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>The returned-data block prints the HTTP status and JSON body so generated resource IDs or API error details are visible.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we walked through how to add attachments to PDF files with Java. With that foundation, you can use this pattern for invoice XML, audit evidence, source documents, or machine-readable records that must travel with a human-readable PDF.\u003C\u002Fp>\n\n\u003Cp>As you adapt this example for production, preserve meaningful attachment filenames and media types so recipients can identify embedded material. Test the output in the PDF viewers your users rely on, and delete temporary source and output resources when the package no longer needs to remain available.\u003C\u002Fp>\n\n\u003Cp>To continue exploring the Add Attachments to PDF operation, visit \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For complete request fields, defaults, and limitations, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\u002F\">Add to PDF API Tool documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: The Add Attachments to PDF example above uses multipart form data; when a prior API call returned the input ID, use the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPDFWithAddedAttachment.java\">JSON payload example\u003C\u002Fa> as a guide.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T17:33:08.000+00:00","2026-09-02T18:26:36.000+00:00","2026-09-01T21:57:31.000+00:00","Add supporting files to a PDF with Java and retain both documents in one portable package.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-java\u002F#article\",\n      \"headline\": \"How to Add Attachments to PDF Files with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:31.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:31.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Add supporting files to a PDF with Java and retain both documents in one portable package.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-attachment API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Add to PDF, Java\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Attachments to PDF Files with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3019,3020,3021,3022],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-attachments-to-pdf-files-with-java\u002F","Add Attachments to PDF Files with Java | pdfRest",{"id":3027,"uuid":3028,"title":3029,"slug":3030,"html":3031,"comment_id":3027,"feature_image":48,"featured":284,"visibility":1257,"created_at":3032,"updated_at":3014,"published_at":3032,"custom_excerpt":3033,"codeinjection_head":3034,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3035,"primary_tag":3041,"url":3042,"excerpt":3033,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3043,"meta_description":3033,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65c1570e533c9f26b9435e4a","376788a6-bcb2-4160-9dd7-fd54f826a26c","How to Add Attachments to PDF Files with JavaScript in NodeJS","how-to-add-attachments-to-pdf-files-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Add Attachments to PDF with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F'>Add to PDF API Tool\u003C\u002Fa> is a powerful resource for developers who need to manipulate PDF files programmatically. This tool allows you to add file attachments to PDF documents. In this tutorial, we will learn how to send an API call to Add to PDF using JavaScript.\u003C\u002Fp> \n\n\u003Cp>This functionality is particularly useful in scenarios where you need to bundle non-PDF files with a PDF document, such as attaching source data files to a report or including supplementary materials with an eBook.\u003C\u002Fp>\n\n\u003Ch2>Add Attachments to PDF with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F**\n * This request demonstrates how to add a file attachment to a PDF.\n *\u002F\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('file_to_attach', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('output', 'pdfrest_pdf_with_added_attachment');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-added-attachment', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-added-attachment.js\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code provided demonstrates how to use JavaScript to make an API call to the pdfRest service in order to add a file attachment to a PDF document.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\u003C\u002Fpre>\n\n\u003Cp>This snippet includes the required modules: 'axios' for making HTTP requests, 'form-data' for constructing multipart\u002Fform-data payloads, and 'fs' for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('file_to_attach', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('output', 'pdfrest_pdf_with_added_attachment');\n\u003C\u002Fpre>\n\n\u003Cp>This creates a new FormData object and appends the PDF file, the file to attach, and the desired output name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-added-attachment',\n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\n\u003C\u002Fpre>\n\n\u003Cp>This configures the axios request with the HTTP method, URL, headers (including the API key), and the data payload.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\u003C\u002Fpre>\n\n\u003Cp>This sends the request and logs the response data or catches any errors that occur during the request.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we have successfully made an API call to add a file attachment to a PDF document using JavaScript. This is a fundamental example of how to interact with the pdfRest API to enhance and modify PDF documents programmatically. Users are encouraged to demo all of the pdfRest API Tools in the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\u003C\u002Fa> and refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-added-attachment.js\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-05T21:45:50.000+00:00","Learn how to use JavaScript to call the Add to PDF API tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Add Attachments to PDF Files with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-02-05T21:45:50.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:54.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use JavaScript to call the Add to PDF API tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-attachment API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Add to PDF, JavaScript, Optimization\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Attachments to PDF Files with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3036,3037,3038,3039,3040],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1891,"name":1892,"slug":1893,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-attachments-to-pdf-files-with-javascript-in-nodejs\u002F","How to Add Attachments to PDF Files with JavaScript in NodeJS, Tutorial | pdfRest",{"id":3045,"uuid":3046,"title":3047,"slug":3048,"html":3049,"comment_id":3045,"feature_image":48,"featured":284,"visibility":1257,"created_at":3050,"updated_at":3051,"published_at":3050,"custom_excerpt":3052,"codeinjection_head":3053,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3054,"primary_tag":3060,"url":3061,"excerpt":3052,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3062,"meta_description":3063,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65c2b98c533c9f26b9436093","7acef89b-f465-45fc-88bc-016aa5042911","How to Add Attachments to PDF Files with PHP","how-to-add-attachments-to-pdf-files-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Add Attachments to PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\">Add to PDF API Tool\u003C\u002Fa> is a powerful resource that allows developers to programmatically add attachments to PDF documents. This tutorial will demonstrate how to make an API call to the Add to PDF endpoint using PHP.\u003C\u002Fp>\n\n\u003Cp>A real-world example of using Add to PDF might include attaching related documents to a PDF report, such as source data files, additional references, or supplementary materials for a presentation.\u003C\u002Fp>\n\n\u003Ch2>Add Attachments to PDF with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'file_to_attach',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_pdf_with_added_attachment'\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-added-attachment', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\u003C\u002Fcontent-type>\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-added-attachment.php\">GitHub - datalogics\u002Fpdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code above demonstrates how to send a multipart\u002Fform-data POST request to the pdfRest API to add an attachment to a PDF file:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\u003C\u002Fpre>\n\n\u003Cp>This includes the necessary classes from the Guzzle HTTP client library to send HTTP requests and handle file streams.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The API key is provided in the headers for authentication purposes.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$options = [\n  'multipart' => [\n    \u002F\u002F ...multipart array contents...\n  ]\n];\n\u003C\u002Fpre>\n\n\u003Cp>The options array contains the multipart form data, which includes the main PDF file, the file to attach, and output options.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-added-attachment', $headers);\n$res = $client->sendAsync($request, $options)->wait();\n\u003C\u002Fpre>\n\n\u003Cp>A POST request is created and sent asynchronously. The response is waited on and then the body of the response, which should be the processed PDF, is outputted.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial walked through the process of making an API call to the pdfRest Add to PDF endpoint using PHP and the Guzzle HTTP client. By following the steps outlined above, you can add attachments to PDF documents programmatically.\u003C\u002Fp>\n\n\u003Cp>To explore and demo all of the pdfRest API Tools, visit the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\u003C\u002Fa>. For more detailed information on the API, refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-added-attachment.php\">GitHub - datalogics\u002Fpdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-06T22:58:20.000+00:00","2026-09-10T20:19:11.000+00:00","Learn how to use PHP to add attachments to PDF files by calling Add to PDF API tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-php\u002F#article\",\n      \"headline\": \"How to Add Attachments to PDF Files with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-php\u002F\",\n      \"datePublished\": \"2024-02-06T22:58:20.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:53.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use PHP to add attachments to PDF files by calling Add to PDF API tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-attachment API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Add to PDF, Optimization, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Attachments to PDF Files with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3055,3056,3057,3058,3059],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1891,"name":1892,"slug":1893,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-attachments-to-pdf-files-with-php\u002F","How to Add Attachments to PDF Files with PHP, Tutorial | pdfRest","Unlock PDF attachment capabilities in PHP with pdfRest's Add to PDF API tool. Seamlessly enhance your PDF workflow.",{"id":3065,"uuid":3066,"title":3067,"slug":3068,"html":3069,"comment_id":3065,"feature_image":48,"featured":284,"visibility":1257,"created_at":3070,"updated_at":3071,"published_at":3070,"custom_excerpt":3052,"codeinjection_head":3072,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3073,"primary_tag":3078,"url":3079,"excerpt":3052,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3080,"meta_description":3052,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65c54b57533c9f26b943612e","aa5c8fba-b22f-4f57-8514-c77ea4c18f81","How to Add Attachments to PDF Files with Python","how-to-add-attachments-to-pdf-files-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Add Attachments to PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F'>Add to PDF API Tool\u003C\u002Fa> is a powerful resource for developers who need to programmatically add attachments to PDF documents. This tutorial will guide you through the process of sending an API call to Add to PDF using Python. For instance, if you're generating reports that require supplementary documents (like source data or additional references) to be bundled together for distribution, the Add to PDF API can automate this process, saving time and reducing the potential for errors.\u003C\u002Fp>\n\n\u003Ch2>Add Attachments to PDF with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\npdf_with_added_attachment_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-added-attachment'\n\nmp_encoder_pdfWithAddedAttachment = MultipartEncoder(\n    fields={\n        'file': ('file_name', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'file_to_attach': ('file_name', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fxml'), # Update content type\n        'output' : 'example_out',\n    }\n)\n\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdfWithAddedAttachment.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to pdf-with-added-attachment endpoint...\")\nresponse = requests.post(pdf_with_added_attachment_endpoint_url, data=mp_encoder_pdfWithAddedAttachment, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-added-attachment.py\">pdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code provided makes a POST request to the pdfRest Add to PDF API endpoint. Let's break down the key components:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_pdfWithAddedAttachment = MultipartEncoder(\n    fields={\n        'file': ('file_name', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'file_to_attach': ('file_name', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fxml'),\n        'output' : 'example_out',\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>This block creates a \u003Ccode>MultipartEncoder\u003C\u002Fcode> object with three fields:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Ccode>file\u003C\u002Fcode>: The PDF file to which you want to add an attachment. Replace \u003Ccode>'\u002Fpath\u002Fto\u002Ffile'\u003C\u002Fcode> with the actual file path.\u003C\u002Fli>\n\u003Cli>\u003Ccode>file_to_attach\u003C\u002Fcode>: The file you want to attach to the PDF. Update the content type (e.g., 'application\u002Fxml') to match the file's type.\u003C\u002Fli>\n\u003Cli>\u003Ccode>output\u003C\u002Fcode>: The desired name for the output file.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdfWithAddedAttachment.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\n\u003C\u002Fpre>\n\n\u003Cp>Here, headers for the request are set up, including the API key which you must replace with your own.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(pdf_with_added_attachment_endpoint_url, data=mp_encoder_pdfWithAddedAttachment, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This line sends the POST request to the specified endpoint with the data and headers configured above.\u003C\u002Fp>\n\n\u003Cp>The rest of the code handles the response, printing out the status code and the response content, formatted as JSON if the request was successful.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you've learned how to send an API call to add attachments to a PDF using Python. This capability is essential for automating document workflows and integrating PDF functionalities into your applications.\u003C\u002Fp>\n\n\u003Cp>Feel free to demo all of the pdfRest API Tools in the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\u003C\u002Fa> and refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa> for more information.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-added-attachment.py\">pdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-08T21:44:55.000+00:00","2026-09-02T18:26:37.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-python\u002F#article\",\n      \"headline\": \"How to Add Attachments to PDF Files with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-python\u002F\",\n      \"datePublished\": \"2024-02-08T21:44:55.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:51.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use PHP to add attachments to PDF files by calling Add to PDF API tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-attachment API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Add to PDF, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Attachments to PDF Files with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-attachments-to-pdf-files-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3074,3075,3076,3077],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-attachments-to-pdf-files-with-python\u002F","How to Add Attachments to PDF Files with Python, Tutorial | pdfRest",{"id":3082,"uuid":3083,"title":3084,"slug":3085,"html":3086,"comment_id":3082,"feature_image":48,"featured":284,"visibility":1257,"created_at":3087,"updated_at":3088,"published_at":3087,"custom_excerpt":3089,"codeinjection_head":3090,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3091,"primary_tag":3096,"url":3097,"excerpt":3089,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3098,"meta_description":3089,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"66071376533c9f26b9436e78","73197296-cc5d-422c-abd7-dce9778e979b","How to Add Images to PDF Files in .NET with C#","how-to-add-images-to-pdf-files-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Add Images to PDF with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F'>Add to PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to automate the process of manipulating PDF files. This API allows you to programmatically add images to PDF documents, which can be useful for generating reports, creating personalized documents, or simply enhancing the visual aspect of your PDFs.\u003C\u002Fp>\n  \n\u003Cp>This tutorial will guide you through the steps of sending an API call to the Add to PDF endpoint using C#.\u003C\u002Fp>\n\n\u003Cp>In the real world, you might use the Add to PDF feature to embed company logos, signatures, or product images into invoices, contracts, or brochures. For example, a real estate agency might use it to add photos of properties to their PDF brochures, or a legal firm might embed signed pages into contract PDFs. This functionality is essential for businesses looking to streamline their document workflows and maintain a high level of professionalism in their digital documents.\u003C\u002Fp>\n\n\u003Ch2>Add Images to PDF with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf-with-added-image\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArray2 = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n        var byteAryContent2 = new ByteArrayContent(byteArray2);\n        multipartContent.Add(byteAryContent2, \"image_file\", \"file_name\");\n        byteAryContent2.Headers.TryAddWithoutValidation(\"Content-Type\", \"image\u002Fpng\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"1\"));\n        multipartContent.Add(byteArrayOption, \"page\");\n\n        var byteArrayOption2 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"0\"));\n        multipartContent.Add(byteArrayOption2, \"x\");\n        var byteArrayOption3 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"0\"));\n        multipartContent.Add(byteArrayOption3, \"y\");\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-added-image.cs\">pdf-rest-api-samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided C# code demonstrates how to make a multipart\u002Fform-data POST request to the pdfRest API to add an image to a PDF file. Let's break down the key components:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>This initializes a new instance of the HttpClient class and sets the base address for the API calls to the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>An API key is added to the request headers for authentication. Replace the placeholder with your actual pdfRest API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n\u003C\u002Fpre>\n\n\u003Cp>This creates a new instance of MultipartFormDataContent, which will hold the PDF and image files, as well as additional options.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">multipartContent.Add(byteAryContent, \"file\", \"file_name\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\u003C\u002Fpre>\n\n\u003Cp>The PDF file content is added to the multipart form data. The \"file\" key is used for the PDF, and the Content-Type is set to \"application\u002Fpdf\".\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">multipartContent.Add(byteAryContent2, \"image_file\", \"file_name\");\nbyteAryContent2.Headers.TryAddWithoutValidation(\"Content-Type\", \"image\u002Fpng\");\n\u003C\u002Fpre>\n\n\u003Cp>Similarly, the image file content is added with the key \"image_file\", and its Content-Type is set based on the image format (in this case, \"image\u002Fpng\").\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">multipartContent.Add(byteArrayOption, \"page\");\nmultipartContent.Add(byteArrayOption2, \"x\");\nmultipartContent.Add(byteArrayOption3, \"y\");\n\u003C\u002Fpre>\n\n\u003Cp>Additional options are added to specify the page number and the x, y coordinates on the page where the image should be placed. These are encoded as byte arrays and added to the multipart content.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\n\u003C\u002Fpre>\n\n\u003Cp>The request is sent asynchronously, and the response is awaited.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>The content of the response is read as a string, which contains the result of the API call.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial has demonstrated how to use C# to make an API call to the pdfRest Add to PDF endpoint to add an image to a PDF file. By following these steps, you can integrate this functionality into your own applications and automate the process of enhancing PDF documents with images.\u003C\u002Fp>\n\n\u003Cp>To explore further and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For comprehensive documentation and additional details on the API endpoints, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. For code samples using JSON payloads, visit the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-added-image.cs\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-29T19:16:06.000+00:00","2026-09-02T18:26:38.000+00:00","Learn how to use .NET to add an image to a PDF by calling Add to PDF API Tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Add Images to PDF Files in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-03-29T19:16:06.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:35.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use .NET to add an image to a PDF by calling Add to PDF API Tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-image API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Add to PDF\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Images to PDF Files in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3092,3093,3094,3095],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-images-to-pdf-files-in-net-with-c\u002F","How to Add Images to PDF Files in .NET with C#, Tutorial | pdfRest",{"id":3100,"uuid":3101,"title":3102,"slug":3103,"html":3104,"comment_id":3100,"feature_image":48,"featured":284,"visibility":1257,"created_at":3105,"updated_at":3106,"published_at":3105,"custom_excerpt":3107,"codeinjection_head":3108,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3109,"primary_tag":3114,"url":3115,"excerpt":3107,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3116,"meta_description":3107,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65fdff2b533c9f26b9436cb4","eb7597b4-2f7c-4820-9b63-85c0c02f9ca0","How to Add Images to PDF Files with cURL","how-to-add-images-to-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Add Images to PDF Files with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F'>Add to PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to automate the process of adding images to PDF documents. This tool is part of the pdfRest suite of APIs, which provide a range of functionalities for PDF manipulation and conversion. In this tutorial, we will demonstrate how to use cURL, a command-line tool for making HTTP requests, to call the Add to PDF API endpoint. cURL is widely supported and can be used on almost any platform, making it a versatile choice for interacting with web APIs like pdfRest.\u003C\u002Fp>\n\n\u003Cp>Imagine you're developing an application that generates reports and you need to add your company logo or relevant images to the PDFs before they are sent to clients. The Add to PDF API allows you to do just that programmatically, ensuring that each document is branded consistently without manual intervention. This can save time and reduce errors, especially when dealing with a large volume of documents.\u003C\u002Fp>\n\n\u003Ch2>Add Images to PDF Files with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-added-image\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"image_file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\" \\\n  -F \"x=10\" \\\n  -F \"y=10\" \\\n  -F \"page=1\"\n\u003C\u002Fpre>\n\n\u003Cp>Reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-added-image.sh\">pdfRest API cURL Samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code provided is a cURL command that makes a POST request to the pdfRest Add to PDF API endpoint. Let's break down the key components of this request:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-added-image\"\n\u003C\u002Fpre>\n\n\u003Cp>This line specifies the HTTP method (POST) and the API endpoint URL.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\n-H \"Content-Type: multipart\u002Fform-data\"\n-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>-H\u003C\u002Fcode> flag adds HTTP headers to the request. The \"Accept\" header tells the server the client expects JSON in response. The \"Content-Type\" header indicates that the request body will be sent as multipart\u002Fform-data, which is necessary for uploading files. The \"Api-Key\" header is where you would include your unique API key provided by pdfRest.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\n-F \"image_file=@\u002Fpath\u002Fto\u002Ffile\"\n-F \"output=example_out\"\n-F \"x=10\"\n-F \"y=10\"\n-F \"page=1\"\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>-F\u003C\u002Fcode> flag is used to specify each part of the multipart request. The \"file\" is the path to the PDF file you want to modify, and \"image_file\" is the path to the image you want to add. The \"output\" field specifies the base name for the output file. The \"x\" and \"y\" fields set the coordinates where the image will be placed on the PDF page (measured in PDF Units, where 1 PDF Unit = 1\u002F72\"). The \"page\" field specifies the page number where the image should be added.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps in this tutorial, you've learned how to make an API call to pdfRest's Add to PDF endpoint using cURL. This capability enables you to automate the process of adding images to PDF documents, which can be integrated into various workflows and applications.\u003C\u002Fp>\n\n\u003Cp>For further exploration and to demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. You can also find more detailed information in the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. For code samples using JSON payloads, you can visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-added-image.sh\">pdfRest API cURL Samples with JSON Payload\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-22T21:59:07.000+00:00","2026-09-02T18:26:39.000+00:00","Learn how to add images to PDF using pdfRest Add to PDF API Tool with cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Add Images to PDF Files with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-with-curl\u002F\",\n      \"datePublished\": \"2024-03-22T21:59:07.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:36.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to add images to PDF using pdfRest Add to PDF API Tool with cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-image API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Add to PDF, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Images to PDF Files with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3110,3111,3112,3113],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-images-to-pdf-with-curl\u002F","How to Add Images to PDF Files with cURL, Tutorial | pdfRest",{"id":3118,"uuid":3119,"title":3120,"slug":3121,"html":3122,"comment_id":3118,"feature_image":48,"featured":284,"visibility":1257,"created_at":3123,"updated_at":3124,"published_at":3123,"custom_excerpt":3125,"codeinjection_head":3126,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3127,"primary_tag":3132,"url":3133,"excerpt":3125,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3134,"meta_description":3125,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6607132e533c9f26b9436e6a","69557d8f-4d1d-49a0-bc20-b865f4d58e2a","How to Add Images to PDF Files with Java","how-to-add-images-to-pdf-files-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Add Images to PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F'>Add to PDF API Tool\u003C\u002Fa> provides a convenient way to programmatically add images to PDF documents. By using this API, developers can automate the process of manipulating PDF files, which can be particularly useful when dealing with large volumes of documents or when customizing documents on-the-fly.\u003C\u002Fp> \n  \n\u003Cp>This tutorial will guide you through the process of sending an API call to Add to PDF using Java, showcasing how to integrate this functionality into Java applications.\u003C\u002Fp>\n\n\u003Cp>Consider a real-world scenario where a company needs to add their logo to a batch of invoices generated as PDFs, or a user wants to embed scanned signatures into contracts. The Add to PDF API tool simplifies these tasks by allowing users to programmatically insert images into specific locations within a PDF, saving time and reducing the risk of manual errors.\u003C\u002Fp>\n\n\u003Ch2>Add Images to PDF with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class PDFWithAddedImage {\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify the path to your image file here, or as the second argument when running the\n  \u002F\u002F program.\n  private static final String DEFAULT_IMAGE_PATH = \"\u002Fpath\u002Fto\u002Ffile.xml\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile, imageFile;\n    if (args.length > 1) {\n      inputFile = new File(args[0]);\n      imageFile = new File(args[1]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n      imageFile = new File(DEFAULT_IMAGE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    final RequestBody imageFileRequestBody =\n        RequestBody.create(imageFile, MediaType.parse(\"application\u002Fpng\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"image_file\", imageFile.getName(), imageFileRequestBody)\n            .addFormDataPart(\"page\", \"1\")\n            .addFormDataPart(\"x\", \"0\")\n            .addFormDataPart(\"y\", \"0\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-added-image\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Code source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPDFWithAddedImage.java\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The Java code provided above demonstrates how to make a multipart API call to the pdfRest Add to PDF endpoint. Let's break down the key components:\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\u003C\u002Fpre>\n\n\u003Cp>This line initializes the Dotenv library to load the API key from a .env file or an environment variable. It gracefully handles missing or malformed .env files.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">RequestBody requestBody = new MultipartBody.Builder()\n  .setType(MultipartBody.FORM)\n  .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n  .addFormDataPart(\"image_file\", imageFile.getName(), imageFileRequestBody)\n  .addFormDataPart(\"page\", \"1\")\n  .addFormDataPart(\"x\", \"0\")\n  .addFormDataPart(\"y\", \"0\")\n  .build();\n\u003C\u002Fpre>\n\n\u003Cp>This snippet constructs the multipart request body. It includes the PDF file, the image file, and the parameters specifying the page number and the (x, y) coordinates where the image will be placed on the PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Request request = new Request.Builder()\n  .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n  .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-added-image\")\n  .post(requestBody)\n  .build();\n\u003C\u002Fpre>\n\n\u003Cp>This creates the HTTP request with the necessary headers, including the API key, and specifies the POST method with the previously built request body.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Response response = client.newCall(request).execute();\n\u003C\u002Fpre>\n\n\u003Cp>This line sends the HTTP request to the pdfRest API and captures the response. The response code and body are then printed out, with the body being formatted as pretty JSON.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you've learned how to use Java to make an API call to pdfRest's Add to PDF endpoint to add an image to a PDF document. By understanding how to construct and send a multipart request, you can now integrate this functionality into your own Java applications for various document processing tasks.\u003C\u002Fp>\n\n\u003Cp>To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPDFWithAddedImage.java\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-29T19:14:54.000+00:00","2026-09-02T18:26:40.000+00:00","Learn how to use Java to add an image to a PDF by calling Add to PDF API Tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-with-java\u002F#article\",\n      \"headline\": \"How to Add Images to PDF Files with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-with-java\u002F\",\n      \"datePublished\": \"2024-03-29T19:14:54.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:36.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use Java to add an image to a PDF by calling Add to PDF API Tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-image API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Add to PDF, Java\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Images to PDF Files with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3128,3129,3130,3131],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-images-to-pdf-files-with-java\u002F","How to Add Images to PDF Files with Java, Tutorial | pdfRest",{"id":3136,"uuid":3137,"title":3138,"slug":3139,"html":3140,"comment_id":3136,"feature_image":48,"featured":284,"visibility":1257,"created_at":3141,"updated_at":3124,"published_at":3141,"custom_excerpt":3142,"codeinjection_head":3143,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3144,"primary_tag":3149,"url":3150,"excerpt":3142,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3151,"meta_description":3142,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"660712a4533c9f26b9436e56","e176a78e-92d3-4225-9e34-13c3699eadbd","How to Add Images to PDF Files with JavaScript in NodeJS","how-to-add-images-to-pdf-files-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Add Images to PDF with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F'>Add to PDF API Tool\u003C\u002Fa> offers a powerful way to programmatically enhance PDF documents by adding images to them. This tutorial will guide you through the process of sending an API call to Add to PDF using JavaScript, a popular language for web development. By leveraging JavaScript alongside the pdfRest API, developers can seamlessly integrate PDF manipulation capabilities into their web applications or services.\u003C\u002Fp>\n\n\u003Cp>Imagine you are developing a web application for event management. Users can upload their event brochures and add sponsor logos directly onto the brochure PDFs. Using the Add to PDF API, you can automate this process, allowing users to position logos on specific pages and at precise locations within their brochures, all without needing any manual PDF editing tools.\u003C\u002Fp>\n\n\u003Ch2>Add Images to PDF with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F**\n * This request demonstrates how to apply an image to a PDF. Horizontal and vertical offsets of the image are measured in PDF units. (1 inch = 72 PDF units)\n *\u002F\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('image_file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('x', '0');\ndata.append('y', '0');\ndata.append('page', '1');\ndata.append('output', 'pdfrest_pdf_with_added_image');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-added-image', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Code provided is sourced from \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-added-image.js\">pdf-rest-api-samples\u003C\u002Fa> on GitHub.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code provided above demonstrates how to send a multipart request to the pdfRest API to add an image to a PDF document. Let's break down the key parts:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\u003C\u002Fpre>\n\n\u003Cp>This initializes the required modules: \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests, \u003Ccode>FormData\u003C\u002Fcode> for creating multipart\u002Fform-data payloads, and \u003Ccode>fs\u003C\u002Fcode> for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('image_file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('x', '0');\ndata.append('y', '0');\ndata.append('page', '1');\ndata.append('output', 'pdfrest_pdf_with_added_image');\n\u003C\u002Fpre>\n\n\u003Cp>Here, a new \u003Ccode>FormData\u003C\u002Fcode> object is created and populated with the PDF file, image file, and parameters such as the x and y offsets (measured in PDF units), the page number to add the image to, and the desired output filename.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-added-image', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>config\u003C\u002Fcode> object contains the settings for the \u003Ccode>axios\u003C\u002Fcode> request, including the API endpoint URL, the API key for authentication, and the form data payload.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>axios\u003C\u002Fcode> library is used to send the request and process the response. If successful, the response data is logged to the console; otherwise, the error is logged.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've learned how to use JavaScript to make an API call to pdfRest's Add to PDF endpoint, allowing us to add an image to a PDF document. This capability can be integrated into various applications to automate and enhance document workflows.\u003C\u002Fp>\n\n\u003Cp>Feel free to explore and demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further details on the API and its capabilities, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-added-image.js\">pdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-29T19:12:36.000+00:00","Learn how to use JavaScript in NodeJS to add an image to a PDF by calling Add to PDF API Tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Add Images to PDF Files with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-03-29T19:12:36.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:36.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use JavaScript in NodeJS to add an image to a PDF by calling Add to PDF API Tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-image API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Add to PDF, JavaScript\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Images to PDF Files with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3145,3146,3147,3148],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-images-to-pdf-files-with-javascript-in-nodejs\u002F","How to Add Images to PDF Files with JavaScript in NodeJS, Tutorial | pdfRest",{"id":3153,"uuid":3154,"title":3155,"slug":3156,"html":3157,"comment_id":3153,"feature_image":48,"featured":284,"visibility":1257,"created_at":3158,"updated_at":3159,"published_at":3158,"custom_excerpt":3160,"codeinjection_head":3161,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3162,"primary_tag":3167,"url":3168,"excerpt":3160,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3169,"meta_description":3160,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"660710bb533c9f26b9436e4c","e45b6fec-9209-4392-9418-85d39f717da2","How to Add Images to PDF Files with PHP","how-to-add-images-to-pdf-files-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Add Images to PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F'>Add to PDF API Tool\u003C\u002Fa> provides a simple and powerful way to manipulate PDF documents programmatically. This tutorial will demonstrate how to send an API call to the Add to PDF endpoint using PHP, which allows developers to seamlessly integrate PDF processing capabilities into their applications. The Add to PDF API Tool is particularly useful for automating the task of adding images or other content to PDF files without the need for manual intervention or complex software.\u003C\u002Fp>\n\n\u003Cp>A real-world example of why a user might use the Add to PDF API could be an online printing service that needs to add branding or watermarks to PDF documents before sending them to print. Another scenario could be an invoicing system where company logos or product images need to be dynamically added to PDF invoices based on customer orders. Utilizing the Add to PDF API, these tasks can be automated, saving time and reducing errors.\u003C\u002Fp>\n\n\u003Ch2>Add Images to PDF with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">\nrequire 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'image_file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'x',\n      'contents' => '72'\n    ],\n    [\n      'name' => 'y',\n      'contents' => '72'\n    ],\n    [\n      'name' => 'page',\n      'contents' => '1'\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_pdf_with_added_image'\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-added-image', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\n\u003C\u002Fpre>\n\n\u003Cp>This code is sourced from the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-added-image.php\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided PHP code uses the Guzzle HTTP client to make a POST request to the \u003Ccode>https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-added-image\u003C\u002Fcode> endpoint. The request is constructed with several key components:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Cstrong>Headers:\u003C\u002Fstrong> The 'Api-Key' header is used for authentication with the pdfRest API.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Multipart:\u003C\u002Fstrong> The 'multipart' array contains the payload for the request. It includes the main PDF file, the image file to be added, and parameters such as X and Y coordinates, page number, and output options.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>File:\u003C\u002Fstrong> The 'file' part contains the main PDF file to be processed. The 'contents' key uses the \u003Ccode>Utils::tryFopen\u003C\u002Fcode> function to read the file, and 'filename' specifies the file path.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Image File:\u003C\u002Fstrong> Similarly, the 'image_file' part includes the image to be added to the PDF. It also specifies the file path and content type.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>X and Y Coordinates:\u003C\u002Fstrong> These define the position where the image will be placed on the PDF page.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Page:\u003C\u002Fstrong> This specifies the page number where the image should be added.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Output:\u003C\u002Fstrong> This option determines the naming convention for the processed PDF file.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>The \u003Ccode>Request\u003C\u002Fcode> object is created with the 'POST' method, the API endpoint, and the headers. The \u003Ccode>$client->sendAsync\u003C\u002Fcode> method sends the request asynchronously and waits for the response, which is then outputted to the screen.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've accomplished sending a multipart API call to the Add to PDF endpoint of the pdfRest API using PHP. The code example demonstrates how to add an image to a PDF document programmatically. Users can now explore other capabilities of the pdfRest API and integrate them into their applications for a wide range of PDF processing needs.\u003C\u002Fp>\n\n\u003Cp>To learn more and experiment with the full range of pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed documentation and additional resources, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-added-image.php\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-29T19:04:27.000+00:00","2026-09-02T18:26:41.000+00:00","Learn how to use PHP to add an image to a PDF by calling Add to PDF API Tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-with-php\u002F#article\",\n      \"headline\": \"How to Add Images to PDF Files with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-with-php\u002F\",\n      \"datePublished\": \"2024-03-29T19:04:27.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:36.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use PHP to add an image to a PDF by calling Add to PDF API Tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-image API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Add to PDF, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Images to PDF Files with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3163,3164,3165,3166],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-images-to-pdf-files-with-php\u002F","How to Add Images to PDF Files with PHP, Tutorial | pdfRest",{"id":3171,"uuid":3172,"title":3173,"slug":3174,"html":3175,"comment_id":3171,"feature_image":48,"featured":284,"visibility":1257,"created_at":3176,"updated_at":3159,"published_at":3176,"custom_excerpt":3177,"codeinjection_head":3178,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3179,"primary_tag":3184,"url":3185,"excerpt":3177,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3186,"meta_description":3177,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"660712db533c9f26b9436e60","a404cdcb-9917-4d48-b23b-12d986abf91f","How to Add Images to PDF Files with Python","how-to-add-images-to-pdf-files-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Add Images to PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F'>Add to PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to automate the process of manipulating PDF documents. This tool allows you to seamlessly add images to existing PDF files, which can be particularly useful for generating reports, customizing documents, or simply adding visual content to your PDFs.\u003C\u002Fp> \n  \n\u003Cp>This tutorial will guide you through the process of sending an API call to the Add to PDF endpoint using Python, enabling you to enhance your PDFs programmatically.\u003C\u002Fp>\n\n\u003Cp>In the real world, a user might need to add a company logo to a batch of invoices, insert a graph or chart into a financial report, or place a signature image onto a contract. Automating this process saves time and reduces the potential for errors that come with manual editing. By using Python, a widely-used programming language for automation, you can integrate this functionality into your applications or workflows with ease.\u003C\u002Fp>\n\n\u003Ch2>Add Images to PDF with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\npdf_with_added_image_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-added-image'\n\nmp_encoder_pdfWithAddedImage = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'image_file': ('file_name.jpg', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'image\u002Fjpeg'),\n        'output' : 'example_out',\n        'x' : '10',\n        'y' : '10',\n        'page' : '1',\n    }\n)\n\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdfWithAddedImage.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to pdf-with-added-image endpoint...\")\nresponse = requests.post(pdf_with_added_image_endpoint_url, data=mp_encoder_pdfWithAddedImage, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Source code obtained from the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-added-image.py\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\n\u003Cp>In the provided code, we first import necessary modules: \u003Ccode class=\"language-python\">MultipartEncoder\u003C\u002Fcode> from \u003Ccode class=\"language-python\">requests_toolbelt\u003C\u002Fcode> for encoding multipart form data, \u003Ccode class=\"language-python\">requests\u003C\u002Fcode> for making HTTP requests, and \u003Ccode class=\"language-python\">json\u003C\u002Fcode> for handling JSON data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\u003C\u002Fpre>\n\n\n\u003Cp>The \u003Ccode class=\"language-python\">MultipartEncoder\u003C\u002Fcode> is used to create a multipart-encoded payload containing the PDF and image files to be uploaded, along with additional parameters such as the desired output file name, the x and y coordinates for where the image should be placed on the PDF, and the page number where the image should be added.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_pdfWithAddedImage = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'image_file': ('file_name.jpg', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'image\u002Fjpeg'),\n        'output' : 'example_out',\n        'x' : '10',\n        'y' : '10',\n        'page' : '1',\n    }\n)\u003C\u002Fpre>\n\n\u003Cp>Headers are set to accept JSON responses and to include the content type provided by the \u003Ccode class=\"language-python\">MultipartEncoder\u003C\u002Fcode>. An API key is also included in the headers for authentication. Replace \u003Ccode class=\"language-python\">'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\u003C\u002Fcode> with your actual pdfRest API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdfWithAddedImage.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\u003C\u002Fpre>\n\n\u003Cp>A POST request is then sent to the \u003Ccode class=\"language-python\">pdf_with_added_image_endpoint_url\u003C\u002Fcode> with the encoded data and headers. The response is checked for success, and the resulting JSON is printed out if the request was successful. If not, the error text is displayed.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">print(\"Sending POST request to pdf-with-added-image endpoint...\")\nresponse = requests.post(pdf_with_added_image_endpoint_url, data=mp_encoder_pdfWithAddedImage, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following this tutorial, you've learned how to use Python to send a multipart API call to the pdfRest Add to PDF API Tool to add an image to a PDF. This can be integrated into larger applications or used as a standalone script to automate PDF manipulation tasks.\u003C\u002Fp>\n\n\u003Cp>To explore more capabilities and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information about the API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-added-image.py\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-29T19:13:31.000+00:00","Learn how to use Python to add an image to a PDF by calling Add to PDF API Tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-with-python\u002F#article\",\n      \"headline\": \"How to Add Images to PDF Files with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-with-python\u002F\",\n      \"datePublished\": \"2024-03-29T19:13:31.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:36.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use Python to add an image to a PDF by calling Add to PDF API Tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-image API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Add to PDF, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Images to PDF Files with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-images-to-pdf-files-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3180,3181,3182,3183],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-images-to-pdf-files-with-python\u002F","How to Add Images to PDF Files with Python, Tutorial | pdfRest",{"id":3188,"uuid":3189,"title":3190,"slug":3191,"html":3192,"comment_id":3188,"feature_image":48,"featured":284,"visibility":1257,"created_at":3193,"updated_at":3194,"published_at":3193,"custom_excerpt":3195,"codeinjection_head":3196,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3197,"primary_tag":3204,"url":3205,"excerpt":3195,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3206,"meta_description":3195,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a8890f8533c9f26b943abcb","c18a8f90-d222-4764-bd3f-78b698b52b5a","How to Add Tables to PDF Files in .NET with C#","how-to-add-tables-to-pdf-files-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Add Tables to PDF with C#?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F'>pdfRest Add to PDF API Tool\u003C\u002Fa> is a powerful feature that allows developers to programmatically add tables to PDF documents. This tutorial will guide you through the process of sending an API call to the Add to PDF endpoint using C#. By integrating this tool into your C# applications, you can automate the process of enhancing PDF documents with structured data, such as tables, without manually editing the files.\u003C\u002Fp>\n\n\u003Cp>Businesses often need to generate reports or documents that include tables with data such as project statuses, financial summaries, or inventory lists. Using the Add to PDF API, a company can automatically generate these documents from their applications, ensuring consistency and saving time on manual document creation. This can be particularly useful for project management tools that need to provide stakeholders with up-to-date status reports.\u003C\u002Fp>\n\n\u003Ch2>Add Tables to PDF with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">\u002F*\n * What this sample does:\n * - Adds a tagged project-status table with styled headers, status cells, and a footer.\n * - Routed from Program.cs as: `dotnet run -- pdf-with-added-tables-multipart \u003CinputFile>`.\n *\n * Setup (environment):\n * - Copy .env.example to .env\n * - Set PDFREST_API_KEY=your_api_key_here\n * - Optional: set PDFREST_URL to override the API region. For EU\u002FGDPR compliance and proximity, use:\n *     PDFREST_URL=https:\u002F\u002Feu-api.pdfrest.com\n *   For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\nusing Newtonsoft.Json.Linq;\nusing System.Text;\nusing Samples;\n\nnamespace Samples.EndpointExamples.MultipartPayload;\n\npublic static class PdfWithAddedTables\n{\n    public static async Task Execute(string[] args)\n    {\n        var inputPath = SampleInput.RequireFile(args, \"pdf-with-added-tables-multipart\");\n        var apiKey = SampleInput.RequireApiKey();\n        using var client = SampleInput.CreateClient();\n        using var request = new HttpRequestMessage(HttpMethod.Post, \"pdf-with-added-tables\");\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        using var content = new MultipartFormDataContent();\n        content.Add(new ByteArrayContent(await File.ReadAllBytesAsync(inputPath)), \"file\", Path.GetFileName(inputPath));\n        content.Add(new StringContent(CreateTable().ToString(), Encoding.UTF8), \"table_objects\");\n        content.Add(new StringContent(\"true\"), \"tag_enabled\");\n        content.Add(new StringContent(\"en-US\"), \"tag_language\");\n        content.Add(new StringContent(\"project-status\"), \"output\");\n        request.Content = content;\n\n        await SampleInput.PrintResponse(client, request);\n    }\n\n    internal static JArray CreateTable() => JArray.Parse(\"\"\"\n        [{\n          \"page\":1,\"x\":54,\"y\":540,\"width\":504,\n          \"columns\":[{\"width\":210},{\"width\":144},{\"width\":150}],\n          \"tag_structure_type\":\"Table\",\n          \"style\":{\"padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8},\"text_size\":10},\n          \"header_rows\":[{\"cells\":[\n            {\"text\":\"Milestone\",\"tag_structure_type\":\"TH\",\"style\":{\"background_color_rgb\":[26,72,112],\"text_color_rgb\":[255,255,255]}},\n            {\"text\":\"Owner\",\"tag_structure_type\":\"TH\",\"style\":{\"background_color_rgb\":[26,72,112],\"text_color_rgb\":[255,255,255]}},\n            {\"text\":\"Status\",\"tag_structure_type\":\"TH\",\"style\":{\"background_color_rgb\":[26,72,112],\"text_color_rgb\":[255,255,255]}}\n          ]}],\n          \"rows\":[\n            {\"cells\":[{\"text\":\"Requirements review\"},{\"text\":\"Maya Chen\"},{\"text\":\"Complete\",\"tag_structure_type\":\"TD\",\"style\":{\"background_color_rgb\":[220,252,231]}}]},\n            {\"cells\":[{\"text\":\"Prototype delivery\"},{\"text\":\"Jordan Lee\"},{\"text\":\"In progress\",\"tag_structure_type\":\"TD\",\"style\":{\"background_color_rgb\":[254,249,195]}}]},\n            {\"cells\":[{\"text\":\"Stakeholder approval\"},{\"text\":\"Avery Patel\"},{\"text\":\"Planned\",\"tag_structure_type\":\"TD\",\"style\":{\"background_color_rgb\":[239,246,255]}}]}\n          ],\n          \"footer_rows\":[{\"cells\":[{\"text\":\"Next review: Friday, 10:00 AM\",\"col_span\":3,\"tag_structure_type\":\"TD\",\"style\":{\"background_color_rgb\":[245,247,250],\"text_color_rgb\":[55,65,81]}}]}]\n        }]\n        \"\"\");\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-added-tables.cs\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by setting up the environment and ensuring the necessary API key is available. The `Execute` method is the main function that processes the API call.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var inputPath = SampleInput.RequireFile(args, \"pdf-with-added-tables-multipart\");\nvar apiKey = SampleInput.RequireApiKey();\n\u003C\u002Fpre>\n\n\u003Cp>These lines retrieve the input file path and the API key, which are essential for the API call.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using var client = SampleInput.CreateClient();\nusing var request = new HttpRequestMessage(HttpMethod.Post, \"pdf-with-added-tables\");\nrequest.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\nrequest.Headers.Accept.Add(new(\"application\u002Fjson\"));\n\u003C\u002Fpre>\n\n\u003Cp>A new HTTP client and request are created. The request is configured to POST to the \"pdf-with-added-tables\" endpoint, and the API key is added to the headers for authentication.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using var content = new MultipartFormDataContent();\ncontent.Add(new ByteArrayContent(await File.ReadAllBytesAsync(inputPath)), \"file\", Path.GetFileName(inputPath));\ncontent.Add(new StringContent(CreateTable().ToString(), Encoding.UTF8), \"table_objects\");\ncontent.Add(new StringContent(\"true\"), \"tag_enabled\");\ncontent.Add(new StringContent(\"en-US\"), \"tag_language\");\ncontent.Add(new StringContent(\"project-status\"), \"output\");\nrequest.Content = content;\n\u003C\u002Fpre>\n\n\u003Cp>The request content is set up as a multipart form. It includes the PDF file, table objects, and additional parameters such as `tag_enabled`, `tag_language`, and `output` to specify the document's characteristics.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">internal static JArray CreateTable() => JArray.Parse(\"\"\"\n    [{\n      \"page\":1,\"x\":54,\"y\":540,\"width\":504,\n      \"columns\":[{\"width\":210},{\"width\":144},{\"width\":150}],\n      \"tag_structure_type\":\"Table\",\n      \"style\":{\"padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8},\"text_size\":10},\n      \"header_rows\":[{\"cells\":[\n        {\"text\":\"Milestone\",\"tag_structure_type\":\"TH\",\"style\":{\"background_color_rgb\":[26,72,112],\"text_color_rgb\":[255,255,255]}},\n        {\"text\":\"Owner\",\"tag_structure_type\":\"TH\",\"style\":{\"background_color_rgb\":[26,72,112],\"text_color_rgb\":[255,255,255]}},\n        {\"text\":\"Status\",\"tag_structure_type\":\"TH\",\"style\":{\"background_color_rgb\":[26,72,112],\"text_color_rgb\":[255,255,255]}}\n      ]}],\n      \"rows\":[\n        {\"cells\":[{\"text\":\"Requirements review\"},{\"text\":\"Maya Chen\"},{\"text\":\"Complete\",\"tag_structure_type\":\"TD\",\"style\":{\"background_color_rgb\":[220,252,231]}}]},\n        {\"cells\":[{\"text\":\"Prototype delivery\"},{\"text\":\"Jordan Lee\"},{\"text\":\"In progress\",\"tag_structure_type\":\"TD\",\"style\":{\"background_color_rgb\":[254,249,195]}}]},\n        {\"cells\":[{\"text\":\"Stakeholder approval\"},{\"text\":\"Avery Patel\"},{\"text\":\"Planned\",\"tag_structure_type\":\"TD\",\"style\":{\"background_color_rgb\":[239,246,255]}}]}\n      ],\n      \"footer_rows\":[{\"cells\":[{\"text\":\"Next review: Friday, 10:00 AM\",\"col_span\":3,\"tag_structure_type\":\"TD\",\"style\":{\"background_color_rgb\":[245,247,250],\"text_color_rgb\":[55,65,81]}}]}]\n    }]\n    \"\"\");\n\u003C\u002Fpre>\n\n\u003Cp>The `CreateTable` method constructs the JSON array that defines the table to be added to the PDF. It specifies the table's position, dimensions, and style, as well as the content of the header, body, and footer rows.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use C# to make an API call to pdfRest's Add to PDF endpoint, adding a structured table to a PDF document. This example illustrates the use of multipart form data to send complex payloads, such as files and JSON objects, to an API.\u003C\u002Fp>\n\n\u003Cp>To explore more capabilities of the pdfRest API, you can demo all the tools available in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further details on API endpoints, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-added-tables.cs\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-08-21T17:55:04.000+00:00","2026-09-02T18:26:42.000+00:00","Learn how to use C# and the pdfRest Add to PDF API Tool to create structured tables in PDF documents from .NET applications.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Add Tables to PDF Files in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-in-net-with-c\u002F\",\n      \"datePublished\": \"2026-08-21T17:55:04.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:04.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use C# and the pdfRest Add to PDF API Tool to create structured tables in PDF documents from .NET applications.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-tables API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Add to PDF, PDF Generation, Tables\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Tables to PDF Files in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3198,3199,3200,3201,3202,3203],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1858,"name":1859,"slug":1860,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-tables-to-pdf-files-in-net-with-c\u002F","How to Add Tables to PDF Files in .NET with C#, Tutorial | pdfRest",{"id":3208,"uuid":3209,"title":3210,"slug":3211,"html":3212,"comment_id":3208,"feature_image":48,"featured":284,"visibility":1257,"created_at":3213,"updated_at":3194,"published_at":3213,"custom_excerpt":3214,"codeinjection_head":3215,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3216,"primary_tag":3223,"url":3224,"excerpt":3214,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3225,"meta_description":3214,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a8891ad533c9f26b943abdf","4b991370-5568-486c-b003-006e53b2ade4","How to Add Tables to PDF Files with cURL","how-to-add-tables-to-pdf-files-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Add Tables to PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F'>pdfRest Add to PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to programmatically enhance PDF documents by adding tables, images, and other elements. This tutorial will guide you through the process of sending an API call to the Add to PDF endpoint using cURL, a command-line tool for transferring data with URLs. By following this tutorial, you will learn how to integrate this functionality into your applications, enabling automated PDF modifications.\u003C\u002Fp>\n\n\u003Cp>A project manager might use the Add to PDF tool to insert a project status table into a PDF report before distributing it to stakeholders. This table could include milestones, responsible team members, and current status updates, all formatted for clarity and ease of understanding. Automating this process with the Add to PDF API can save time and reduce manual errors, ensuring that documents are consistently updated and formatted.\u003C\u002Fp>\n\n\u003Ch2>Add Tables to PDF with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">#!\u002Fbin\u002Fsh\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# This example adds an accessible project-status table with a header, colored status cells, and a footer.\nTABLE_OBJECTS='[\n  {\n    \"page\": 1,\n    \"x\": 54,\n    \"y\": 540,\n    \"width\": 504,\n    \"columns\": [{\"width\": 210}, {\"width\": 144}, {\"width\": 150}],\n    \"tag_structure_type\": \"Table\",\n    \"style\": {\"padding\": {\"top\": 6, \"right\": 8, \"bottom\": 6, \"left\": 8}, \"text_size\": 10},\n    \"header_rows\": [{\"cells\": [\n      {\"text\": \"Milestone\", \"tag_structure_type\": \"TH\", \"style\": {\"background_color_rgb\": [26,72,112], \"text_color_rgb\": [255,255,255]}},\n      {\"text\": \"Owner\", \"tag_structure_type\": \"TH\", \"style\": {\"background_color_rgb\": [26,72,112], \"text_color_rgb\": [255,255,255]}},\n      {\"text\": \"Status\", \"tag_structure_type\": \"TH\", \"style\": {\"background_color_rgb\": [26,72,112], \"text_color_rgb\": [255,255,255]}}\n    ]}],\n    \"rows\": [\n      {\"cells\": [{\"text\": \"Requirements review\"}, {\"text\": \"Maya Chen\"}, {\"text\": \"Complete\", \"tag_structure_type\": \"TD\", \"style\": {\"background_color_rgb\": [220,252,231]}}]},\n      {\"cells\": [{\"text\": \"Prototype delivery\"}, {\"text\": \"Jordan Lee\"}, {\"text\": \"In progress\", \"tag_structure_type\": \"TD\", \"style\": {\"background_color_rgb\": [254,249,195]}}]},\n      {\"cells\": [{\"text\": \"Stakeholder approval\"}, {\"text\": \"Avery Patel\"}, {\"text\": \"Planned\", \"tag_structure_type\": \"TD\", \"style\": {\"background_color_rgb\": [239,246,255]}}]}\n    ],\n    \"footer_rows\": [{\"cells\": [\n      {\"text\": \"Next review: Friday, 10:00 AM\", \"col_span\": 3, \"tag_structure_type\": \"TD\", \"style\": {\"background_color_rgb\": [245,247,250], \"text_color_rgb\": [55,65,81]}}\n    ]}]\n  }\n]'\n\ncurl -X POST \"$API_URL\u002Fpdf-with-added-tables\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Finput.pdf\" \\\n  -F \"table_objects=$TABLE_OBJECTS\" \\\n  -F \"tag_enabled=true\" \\\n  -F \"tag_language=en-US\" \\\n  -F \"output=project-status\"\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-added-tables.sh\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The script begins by setting the \u003Ccode>API_URL\u003C\u002Fcode> variable to the default US-based service endpoint. This is the primary endpoint for global use. If you need to comply with GDPR or require better performance in Europe, you can switch to the EU-based service by uncommenting the alternative URL.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">API_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>TABLE_OBJECTS\u003C\u002Fcode> variable defines the structure of the table to be added to the PDF. It includes details such as page number, position, width, column definitions, and cell styles.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">TABLE_OBJECTS='[\n  {\n    \"page\": 1,\n    \"x\": 54,\n    \"y\": 540,\n    \"width\": 504,\n    ...\n  }\n]'\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>curl\u003C\u002Fcode> command is used to send a POST request to the \u003Ccode>pdf-with-added-tables\u003C\u002Fcode> endpoint. The request includes several headers and form fields:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"$API_URL\u002Fpdf-with-added-tables\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Finput.pdf\" \\\n  -F \"table_objects=$TABLE_OBJECTS\" \\\n  -F \"tag_enabled=true\" \\\n  -F \"tag_language=en-US\" \\\n  -F \"output=project-status\"\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>-H\u003C\u002Fcode> flags set the request headers, including the \u003Ccode>Api-Key\u003C\u002Fcode>, which must be replaced with your actual API key. The \u003Ccode>-F\u003C\u002Fcode> flags specify the form data, including the PDF file to be modified, the table objects, and additional parameters such as \u003Ccode>tag_enabled\u003C\u002Fcode> and \u003Ccode>tag_language\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use cURL to send a request to the pdfRest Add to PDF API, adding a table to a PDF document. This example demonstrated the use of multipart form data to include both the PDF file and the table configuration in the request.\u003C\u002Fp>\n\n\u003Cp>To explore further, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on each API tool, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example uses a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-added-tables.sh\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-08-21T17:58:05.000+00:00","Discover how to send a cURL request to the pdfRest Add to PDF API and insert formatted tables into PDF files.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-curl\u002F#article\",\n      \"headline\": \"How to Add Tables to PDF Files with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-curl\u002F\",\n      \"datePublished\": \"2026-08-21T17:58:05.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:04.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Discover how to send a cURL request to the pdfRest Add to PDF API and insert formatted tables into PDF files.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-tables API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Add to PDF, PDF Generation, Tables, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Tables to PDF Files with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3217,3218,3219,3220,3221,3222],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1858,"name":1859,"slug":1860,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-tables-to-pdf-files-with-curl\u002F","How to Add Tables to PDF Files with cURL, Tutorial | pdfRest",{"id":3227,"uuid":3228,"title":3229,"slug":3230,"html":3231,"comment_id":3227,"feature_image":48,"featured":284,"visibility":1257,"created_at":3232,"updated_at":3194,"published_at":3232,"custom_excerpt":3233,"codeinjection_head":3234,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3235,"primary_tag":3242,"url":3243,"excerpt":3233,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3244,"meta_description":3233,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a8891d1533c9f26b943abe9","98d6ad45-c5af-4012-8ed1-a709c48d2d38","How to Add Tables to PDF Files with Java","how-to-add-tables-to-pdf-files-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Add Tables to PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F'>pdfRest Add to PDF API Tool\u003C\u002Fa> allows developers to programmatically add tables to existing PDF documents. This tutorial will guide you through the process of sending an API call to the Add to PDF endpoint using Java. By utilizing this API, you can enhance your PDF documents dynamically, adding structured data in the form of tables, which can be crucial for reports, invoices, or any document requiring tabular data presentation.\u003C\u002Fp>\n\n\u003Cp>A project manager might need to update a project status report with the latest milestones, owners, and status updates. Instead of manually editing the PDF, the manager can use the Add to PDF API to automate the process, ensuring that the report is always up-to-date and distributed efficiently to stakeholders.\u003C\u002Fp>\n\n\u003Ch2>Add Tables to PDF with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\n\npublic class PDFWithAddedTables {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Finput.pdf\";\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  \u002F\u002F This tagged table uses fixed widths that add up to the table width: 210 + 144 + 150 = 504.\n  private static final String TABLE_OBJECTS =\n      \"\"\"\n      [\n        {\n          \"page\": 1,\n          \"x\": 54,\n          \"y\": 540,\n          \"width\": 504,\n          \"columns\": [{\"width\": 210}, {\"width\": 144}, {\"width\": 150}],\n          \"tag_structure_type\": \"Table\",\n          \"style\": {\n            \"padding\": {\"top\": 6, \"right\": 8, \"bottom\": 6, \"left\": 8},\n            \"text_size\": 10\n          },\n          \"header_rows\": [\n            {\n              \"cells\": [\n                {\"text\": \"Milestone\", \"tag_structure_type\": \"TH\", \"style\": {\"background_color_rgb\": [26, 72, 112], \"text_color_rgb\": [255, 255, 255]}},\n                {\"text\": \"Owner\", \"tag_structure_type\": \"TH\", \"style\": {\"background_color_rgb\": [26, 72, 112], \"text_color_rgb\": [255, 255, 255]}},\n                {\"text\": \"Status\", \"tag_structure_type\": \"TH\", \"style\": {\"background_color_rgb\": [26, 72, 112], \"text_color_rgb\": [255, 255, 255]}}\n              ]\n            }\n          ],\n          \"rows\": [\n            {\"cells\": [{\"text\": \"Requirements review\"}, {\"text\": \"Maya Chen\"}, {\"text\": \"Complete\", \"tag_structure_type\": \"TD\", \"style\": {\"background_color_rgb\": [220, 252, 231]}}]},\n            {\"cells\": [{\"text\": \"Prototype delivery\"}, {\"text\": \"Jordan Lee\"}, {\"text\": \"In progress\", \"tag_structure_type\": \"TD\", \"style\": {\"background_color_rgb\": [254, 249, 195]}}]},\n            {\"cells\": [{\"text\": \"Stakeholder approval\"}, {\"text\": \"Avery Patel\"}, {\"text\": \"Planned\", \"tag_structure_type\": \"TD\", \"style\": {\"background_color_rgb\": [239, 246, 255]}}]}\n          ],\n          \"footer_rows\": [\n            {\n              \"cells\": [\n                {\"text\": \"Next review: Friday, 10:00 AM\", \"col_span\": 3, \"tag_structure_type\": \"TD\", \"style\": {\"background_color_rgb\": [245, 247, 250], \"text_color_rgb\": [55, 65, 81]}}\n              ]\n            }\n          ]\n        }\n      ]\n      \"\"\";\n\n  public static void main(String[] args) {\n    File inputFile = new File(args.length > 0 ? args[0] : DEFAULT_FILE_PATH);\n    Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    RequestBody fileBody = RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), fileBody)\n            .addFormDataPart(\"table_objects\", new JSONArray(TABLE_OBJECTS).toString())\n            .addFormDataPart(\"tag_enabled\", \"true\")\n            .addFormDataPart(\"tag_language\", \"en-US\")\n            .addFormDataPart(\"output\", \"project-status\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Accept\", \"application\u002Fjson\")\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf-with-added-tables\")\n            .post(requestBody)\n            .build();\n\n    OkHttpClient client = new OkHttpClient.Builder().readTimeout(60, TimeUnit.SECONDS).build();\n    try (Response response = client.newCall(request).execute()) {\n      System.out.println(\"Response status code: \" + response.code());\n      if (response.body() != null) {\n        System.out.println(new JSONObject(response.body().string()).toString(2));\n      }\n    } catch (IOException error) {\n      throw new RuntimeException(error);\n    }\n  }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPDFWithAddedTables.java\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary libraries for handling environment variables, file I\u002FO, HTTP requests, and JSON manipulation. The \u003Ccode>Dotenv\u003C\u002Fcode> library is used to manage API keys securely.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\u003C\u002Fpre>\n\n\u003Cp>This line sets the base URL for the API. The default is the US-based service, but there's an option to switch to an EU-based service for GDPR compliance.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Finput.pdf\";\nprivate static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\u003C\u002Fpre>\n\n\u003Cp>These lines define default values for the input PDF file path and the API key. The API key is crucial for authenticating requests to the pdfRest service.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">private static final String TABLE_OBJECTS = ...\n\u003C\u002Fpre>\n\n\u003Cp>This JSON string defines the table structure to be added to the PDF. It specifies the page, position, dimensions, and styling of the table, as well as the content of the header, body, and footer rows.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">RequestBody requestBody = new MultipartBody.Builder()\n\u003C\u002Fpre>\n\n\u003Cp>This block creates a multipart request body, including the PDF file and table data. It sets the form type and adds form data parts for the file, table objects, tagging options, and output file name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Request request = new Request.Builder()\n\u003C\u002Fpre>\n\n\u003Cp>This snippet constructs the HTTP request, setting headers for content type and API key, and specifies the endpoint URL for adding tables to the PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">OkHttpClient client = new OkHttpClient.Builder().readTimeout(60, TimeUnit.SECONDS).build();\n\u003C\u002Fpre>\n\n\u003Cp>An \u003Ccode>OkHttpClient\u003C\u002Fcode> instance is created with a 60-second read timeout, which handles the HTTP request execution.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use Java to send an API request to pdfRest's Add to PDF endpoint, effectively adding tables to a PDF document. This process can be automated to enhance productivity and ensure accuracy in document updates.\u003C\u002Fp>\n\n\u003Cp>To explore more functionalities, try out all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed documentation, visit the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example demonstrates a multipart API call. For examples using JSON payloads, visit the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPDFWithAddedTables.java\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-08-21T17:58:41.000+00:00","Learn how Java applications can call the pdfRest Add to PDF API to generate tables with custom layouts, styles, and data.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-java\u002F#article\",\n      \"headline\": \"How to Add Tables to PDF Files with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-java\u002F\",\n      \"datePublished\": \"2026-08-21T17:58:41.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:03.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how Java applications can call the pdfRest Add to PDF API to generate tables with custom layouts, styles, and data.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-tables API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Add to PDF, Java, PDF Generation, Tables\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Tables to PDF Files with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3236,3237,3238,3239,3240,3241],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1858,"name":1859,"slug":1860,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-tables-to-pdf-files-with-java\u002F","How to Add Tables to PDF Files with Java, Tutorial | pdfRest",{"id":3246,"uuid":3247,"title":3248,"slug":3249,"html":3250,"comment_id":3246,"feature_image":48,"featured":284,"visibility":1257,"created_at":3251,"updated_at":3252,"published_at":3251,"custom_excerpt":3253,"codeinjection_head":3254,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3255,"primary_tag":3262,"url":3263,"excerpt":3253,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3264,"meta_description":3253,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a88912e533c9f26b943abd5","df42e702-8b84-43b7-9852-f3f800271664","How to Add Tables to PDF Files with JavaScript in NodeJS","how-to-add-tables-to-pdf-files-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Add Tables to PDF with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F'>pdfRest Add to PDF API Tool\u003C\u002Fa> is a powerful resource that allows developers to programmatically add tables and other elements to PDF documents. This tutorial will guide you through the process of sending an API call to the Add to PDF endpoint using JavaScript, enabling you to enhance your PDF files with structured and styled tables.\u003C\u002Fp>\n\n\u003Cp>A project manager might need to generate a project status report in PDF format that includes a table summarizing tasks, owners, and their current status. By using the Add to PDF API, the manager can automate this process, ensuring that the document is both accessible and visually appealing, complete with headers, colored status cells, and a footer.\u003C\u002Fp>\n\n\u003Ch2>Add Tables to PDF with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F**\n * Add an accessible, styled project-status table to a PDF.\n * The table includes header cells, colored status cells, and a footer row.\n *\u002F\nconst axios = require(\"axios\");\nconst FormData = require(\"form-data\");\nconst fs = require(\"fs\");\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nconst apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F const apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\nconst tables = [\n  {\n    page: 1,\n    x: 54,\n    y: 540,\n    width: 504,\n    columns: [{ width: 210 }, { width: 144 }, { width: 150 }],\n    tag_structure_type: \"Table\",\n    style: {\n      padding: { top: 6, right: 8, bottom: 6, left: 8 },\n      text_size: 10,\n    },\n    header_rows: [\n      {\n        cells: [\n          { text: \"Milestone\", tag_structure_type: \"TH\", style: { background_color_rgb: [26, 72, 112], text_color_rgb: [255, 255, 255] } },\n          { text: \"Owner\", tag_structure_type: \"TH\", style: { background_color_rgb: [26, 72, 112], text_color_rgb: [255, 255, 255] } },\n          { text: \"Status\", tag_structure_type: \"TH\", style: { background_color_rgb: [26, 72, 112], text_color_rgb: [255, 255, 255] } },\n        ],\n      },\n    ],\n    rows: [\n      { cells: [{ text: \"Requirements review\" }, { text: \"Maya Chen\" }, { text: \"Complete\", tag_structure_type: \"TD\", style: { background_color_rgb: [220, 252, 231] } }] },\n      { cells: [{ text: \"Prototype delivery\" }, { text: \"Jordan Lee\" }, { text: \"In progress\", tag_structure_type: \"TD\", style: { background_color_rgb: [254, 249, 195] } }] },\n      { cells: [{ text: \"Stakeholder approval\" }, { text: \"Avery Patel\" }, { text: \"Planned\", tag_structure_type: \"TD\", style: { background_color_rgb: [239, 246, 255] } }] },\n    ],\n    footer_rows: [\n      { cells: [{ text: \"Next review: Friday, 10:00 AM\", col_span: 3, tag_structure_type: \"TD\", style: { background_color_rgb: [245, 247, 250], text_color_rgb: [55, 65, 81] } }] },\n    ],\n  },\n];\n\nconst form = new FormData();\nform.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Finput.pdf\"));\nform.append(\"table_objects\", JSON.stringify(tables));\nform.append(\"tag_enabled\", \"true\");\nform.append(\"tag_language\", \"en-US\");\nform.append(\"output\", \"project-status\");\n\naxios({\n  method: \"post\",\n  maxBodyLength: Infinity,\n  url: `${apiUrl}\u002Fpdf-with-added-tables`,\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", \u002F\u002F Replace with your API key.\n    ...form.getHeaders(),\n  },\n  data: form,\n})\n  .then((response) => console.log(JSON.stringify(response.data, null, 2)))\n  .catch((error) => console.log(error.response?.data || error.message));\n\n\u002F\u002F To download the returned file, use the outputId with the get-resource-id endpoint sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-added-tables.js\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by requiring necessary modules: \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests, \u003Ccode>form-data\u003C\u002Fcode> for handling form submissions, and \u003Ccode>fs\u003C\u002Fcode> for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">const axios = require(\"axios\");\nconst FormData = require(\"form-data\");\nconst fs = require(\"fs\");\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>apiUrl\u003C\u002Fcode> is set to the US-based endpoint by default. For European users, the EU-based endpoint can be used for GDPR compliance.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">const apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>tables\u003C\u002Fcode> array defines the structure and style of the table to be added to the PDF. It includes details such as page number, position, column widths, and cell styles.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">const tables = [\n  {\n    page: 1,\n    x: 54,\n    y: 540,\n    width: 504,\n    columns: [{ width: 210 }, { width: 144 }, { width: 150 }],\n    tag_structure_type: \"Table\",\n    style: {\n      padding: { top: 6, right: 8, bottom: 6, left: 8 },\n      text_size: 10,\n    },\n    header_rows: [\n      {\n        cells: [\n          { text: \"Milestone\", tag_structure_type: \"TH\", style: { background_color_rgb: [26, 72, 112], text_color_rgb: [255, 255, 255] } },\n          { text: \"Owner\", tag_structure_type: \"TH\", style: { background_color_rgb: [26, 72, 112], text_color_rgb: [255, 255, 255] } },\n          { text: \"Status\", tag_structure_type: \"TH\", style: { background_color_rgb: [26, 72, 112], text_color_rgb: [255, 255, 255] } },\n        ],\n      },\n    ],\n    rows: [\n      { cells: [{ text: \"Requirements review\" }, { text: \"Maya Chen\" }, { text: \"Complete\", tag_structure_type: \"TD\", style: { background_color_rgb: [220, 252, 231] } }] },\n      { cells: [{ text: \"Prototype delivery\" }, { text: \"Jordan Lee\" }, { text: \"In progress\", tag_structure_type: \"TD\", style: { background_color_rgb: [254, 249, 195] } }] },\n      { cells: [{ text: \"Stakeholder approval\" }, { text: \"Avery Patel\" }, { text: \"Planned\", tag_structure_type: \"TD\", style: { background_color_rgb: [239, 246, 255] } }] },\n    ],\n    footer_rows: [\n      { cells: [{ text: \"Next review: Friday, 10:00 AM\", col_span: 3, tag_structure_type: \"TD\", style: { background_color_rgb: [245, 247, 250], text_color_rgb: [55, 65, 81] } }] },\n    ],\n  },\n];\n\u003C\u002Fpre>\n\n\u003Cp>A \u003Ccode>FormData\u003C\u002Fcode> object is created to hold the PDF file and table data. The \u003Ccode>file\u003C\u002Fcode> field is the PDF to which the table will be added, and \u003Ccode>table_objects\u003C\u002Fcode> contains the table structure.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">const form = new FormData();\nform.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Finput.pdf\"));\nform.append(\"table_objects\", JSON.stringify(tables));\nform.append(\"tag_enabled\", \"true\");\nform.append(\"tag_language\", \"en-US\");\nform.append(\"output\", \"project-status\");\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>axios\u003C\u002Fcode> call sends a POST request to the \u003Ccode>pdf-with-added-tables\u003C\u002Fcode> endpoint, including headers for the API key and form data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios({\n  method: \"post\",\n  maxBodyLength: Infinity,\n  url: `${apiUrl}\u002Fpdf-with-added-tables`,\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", \u002F\u002F Replace with your API key.\n    ...form.getHeaders(),\n  },\n  data: form,\n})\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use the pdfRest Add to PDF API Tool to add a styled table to a PDF document using JavaScript. This example demonstrates how to structure your API call and handle the response.\u003C\u002Fp>\n\n\u003Cp>To explore further, try out all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. This example shows a multipart API call; for JSON payload examples, visit the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-added-tables.js\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-08-21T17:55:58.000+00:00","2026-09-02T18:26:43.000+00:00","Find out how to use JavaScript in NodeJS to add dynamic tables to PDF documents through the pdfRest API.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Add Tables to PDF Files with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2026-08-21T17:55:58.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:04.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Find out how to use JavaScript in NodeJS to add dynamic tables to PDF documents through the pdfRest API.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-tables API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Add to PDF, JavaScript, PDF Generation, Tables\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Tables to PDF Files with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3256,3257,3258,3259,3260,3261],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1858,"name":1859,"slug":1860,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-tables-to-pdf-files-with-javascript-in-nodejs\u002F","How to Add Tables to PDF Files with JavaScript in NodeJS, Tutorial | pdfRest",{"id":3266,"uuid":3267,"title":3268,"slug":3269,"html":3270,"comment_id":3266,"feature_image":48,"featured":284,"visibility":1257,"created_at":3271,"updated_at":3252,"published_at":3271,"custom_excerpt":3272,"codeinjection_head":3273,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3274,"primary_tag":3281,"url":3282,"excerpt":3272,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3283,"meta_description":3272,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a88903b533c9f26b943abc1","2b06a85d-d1f3-4018-8f3b-1eb8cc0fcbc2","How to Add Tables to PDF Files with PHP","how-to-add-tables-to-pdf-files-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Add Tables to PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F'>pdfRest Add to PDF API Tool\u003C\u002Fa> provides a robust solution for integrating table data into existing PDF documents. This tutorial will guide you through the process of sending an API call to the Add to PDF endpoint using PHP. By leveraging this tool, developers can programmatically enhance PDFs with structured data, making it a valuable asset for automating document workflows.\u003C\u002Fp>\n\n\u003Cp>Consider a scenario where a project manager needs to regularly update a PDF report with the latest project status, including milestones, owners, and progress. Using the Add to PDF API, they can automate this process, ensuring that the document is always up-to-date with minimal manual intervention. This not only saves time but also reduces the risk of errors in the documentation process.\u003C\u002Fp>\n\n\u003Ch2>Add Tables to PDF with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">\nrequire 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = 'https:\u002F\u002Fapi.pdfrest.com';\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F $apiUrl = 'https:\u002F\u002Feu-api.pdfrest.com';\n\nfunction projectStatusTable(): array\n{\n    $headerStyle = ['background_color_rgb' =--> [26, 72, 112], 'text_color_rgb' => [255, 255, 255]];\n    return [[\n        'page' => 1, 'x' => 54, 'y' => 540, 'width' => 504,\n        'columns' => [['width' => 210], ['width' => 144], ['width' => 150]],\n        'tag_structure_type' => 'Table',\n        'style' => ['padding' => ['top' => 6, 'right' => 8, 'bottom' => 6, 'left' => 8], 'text_size' => 10],\n        'header_rows' => [['cells' => [\n            ['text' => 'Milestone', 'tag_structure_type' => 'TH', 'style' => $headerStyle],\n            ['text' => 'Owner', 'tag_structure_type' => 'TH', 'style' => $headerStyle],\n            ['text' => 'Status', 'tag_structure_type' => 'TH', 'style' => $headerStyle],\n        ]]],\n        'rows' => [\n            ['cells' => [['text' => 'Requirements review'], ['text' => 'Maya Chen'], ['text' => 'Complete', 'tag_structure_type' => 'TD', 'style' => ['background_color_rgb' => [220, 252, 231]]]]],\n            ['cells' => [['text' => 'Prototype delivery'], ['text' => 'Jordan Lee'], ['text' => 'In progress', 'tag_structure_type' => 'TD', 'style' => ['background_color_rgb' => [254, 249, 195]]]]],\n            ['cells' => [['text' => 'Stakeholder approval'], ['text' => 'Avery Patel'], ['text' => 'Planned', 'tag_structure_type' => 'TD', 'style' => ['background_color_rgb' => [239, 246, 255]]]]],\n        ],\n        'footer_rows' => [['cells' => [[\n            'text' => 'Next review: Friday, 10:00 AM', 'col_span' => 3, 'tag_structure_type' => 'TD',\n            'style' => ['background_color_rgb' => [245, 247, 250], 'text_color_rgb' => [55, 65, 81]],\n        ]]],\n    ]]];\n}\n\n\u002F\u002F Add an accessible project-status table with a header, colored status cells, and a footer.\n$request = new Request('POST', $apiUrl . '\u002Fpdf-with-added-tables', [\n    'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key.\n]);\n$response = (new Client(['http_errors' => false]))->send($request, [\n    'multipart' => [\n        ['name' => 'file', 'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Finput.pdf', 'r'), 'filename' => 'input.pdf'],\n        ['name' => 'table_objects', 'contents' => json_encode(projectStatusTable())],\n        ['name' => 'tag_enabled', 'contents' => 'true'],\n        ['name' => 'tag_language', 'contents' => 'en-US'],\n        ['name' => 'output', 'contents' => 'project-status'],\n    ],\n]);\n\necho $response->getBody() . PHP_EOL;\n\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-added-tables.php\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided PHP script begins by including necessary packages using Composer's autoload feature. It utilizes GuzzleHttp for making HTTP requests, and Psr7 for handling requests and utilities.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\u003C\u002Fpre>\n\n\u003Cp>The API endpoint is set to the US-based service by default. Users in Europe can switch to the EU-based endpoint for GDPR compliance by uncommenting the relevant line.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$apiUrl = 'https:\u002F\u002Fapi.pdfrest.com';\n\u002F\u002F $apiUrl = 'https:\u002F\u002Feu-api.pdfrest.com';\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>projectStatusTable\u003C\u002Fcode> function constructs an array representing the table to be added to the PDF. It specifies the page, position, dimensions, and styles for the table, header, rows, and footer.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">function projectStatusTable(): array\n{\n    ...\n}\n\u003C\u002Fpre>\n\n\u003Cp>A POST request is created, targeting the \u003Ccode>\u002Fpdf-with-added-tables\u003C\u002Fcode> endpoint. The request includes an API key for authentication.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$request = new Request('POST', $apiUrl . '\u002Fpdf-with-added-tables', [\n    'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n]);\n\u003C\u002Fpre>\n\n\u003Cp>The request payload is multipart, containing the input PDF file, table data, and additional parameters like \u003Ccode>tag_enabled\u003C\u002Fcode> and \u003Ccode>tag_language\u003C\u002Fcode>. These parameters ensure that the PDF is tagged and specifies the language for tagging.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$response = (new Client(['http_errors' => false]))->send($request, [\n    'multipart' => [\n        ['name' => 'file', 'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Finput.pdf', 'r'), 'filename' => 'input.pdf'],\n        ['name' => 'table_objects', 'contents' => json_encode(projectStatusTable())],\n        ['name' => 'tag_enabled', 'contents' => 'true'],\n        ['name' => 'tag_language', 'contents' => 'en-US'],\n        ['name' => 'output', 'contents' => 'project-status'],\n    ],\n]);\n\u003C\u002Fpre>\n\n\u003Cp>The response from the API is output to the console, displaying the result of the API call.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">echo $response->getBody() . PHP_EOL;\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we successfully demonstrated how to use PHP to make an API call to pdfRest's Add to PDF tool, adding a table to a PDF document. This example serves as a foundation for integrating more complex features into your PDF workflows.\u003C\u002Fp>\n\n\u003Cp>We encourage you to explore all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further details, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. This example demonstrates a multipart API call; for JSON payloads, refer to the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-added-tables.php\">GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-08-21T17:51:55.000+00:00","Learn how to integrate the pdfRest Add to PDF API with PHP and programmatically insert professional tables into PDF files.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-php\u002F#article\",\n      \"headline\": \"How to Add Tables to PDF Files with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-php\u002F\",\n      \"datePublished\": \"2026-08-21T17:51:55.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:04.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to integrate the pdfRest Add to PDF API with PHP and programmatically insert professional tables into PDF files.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-tables API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Add to PDF, PDF Generation, PHP, Tables\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Tables to PDF Files with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3275,3276,3277,3278,3279,3280],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1858,"name":1859,"slug":1860,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-tables-to-pdf-files-with-php\u002F","How to Add Tables to PDF Files with PHP, Tutorial | pdfRest",{"id":3285,"uuid":3286,"title":3287,"slug":3288,"html":3289,"comment_id":3285,"feature_image":48,"featured":284,"visibility":1257,"created_at":3290,"updated_at":3291,"published_at":3290,"custom_excerpt":3292,"codeinjection_head":3293,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3294,"primary_tag":3301,"url":3302,"excerpt":3292,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3303,"meta_description":3292,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a888f95533c9f26b943abb7","10d7df34-0492-456f-ab5e-804dbb2206f4","How to Add Tables to PDF Files with Python","how-to-add-tables-to-pdf-files-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Add Tables to PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F'>pdfRest Add to PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to manipulate PDF documents programmatically. This tutorial will guide you through the process of making an API call to the Add to PDF endpoint using Python. By leveraging this tool, you can automate the addition of tables and other elements to your PDFs, enhancing their utility and presentation.\u003C\u002Fp>\n\n\u003Cp>Imagine you're managing a project and need to regularly update stakeholders with the latest project status in a PDF format. Using the Add to PDF API, you can programmatically insert a table into a PDF document that outlines project milestones, owners, and statuses. This can save significant time and ensure that your documents are consistently formatted and up-to-date.\u003C\u002Fp>\n\n\u003Ch2>Add Tables to PDF with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">import json\n\nimport requests\nfrom requests_toolbelt import MultipartEncoder\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# Add an accessible project-status table with a header, colored status cells, and a footer.\ntable_objects = [\n    {\n        \"page\": 1,\n        \"x\": 54,\n        \"y\": 540,\n        \"width\": 504,\n        \"columns\": [{\"width\": 210}, {\"width\": 144}, {\"width\": 150}],\n        \"tag_structure_type\": \"Table\",\n        \"style\": {\n            \"padding\": {\"top\": 6, \"right\": 8, \"bottom\": 6, \"left\": 8},\n            \"text_size\": 10,\n        },\n        \"header_rows\": [\n            {\n                \"cells\": [\n                    {\"text\": \"Milestone\", \"tag_structure_type\": \"TH\", \"style\": {\"background_color_rgb\": [26, 72, 112], \"text_color_rgb\": [255, 255, 255]}},\n                    {\"text\": \"Owner\", \"tag_structure_type\": \"TH\", \"style\": {\"background_color_rgb\": [26, 72, 112], \"text_color_rgb\": [255, 255, 255]}},\n                    {\"text\": \"Status\", \"tag_structure_type\": \"TH\", \"style\": {\"background_color_rgb\": [26, 72, 112], \"text_color_rgb\": [255, 255, 255]}},\n                ]\n            }\n        ],\n        \"rows\": [\n            {\"cells\": [{\"text\": \"Requirements review\"}, {\"text\": \"Maya Chen\"}, {\"text\": \"Complete\", \"tag_structure_type\": \"TD\", \"style\": {\"background_color_rgb\": [220, 252, 231]}}]},\n            {\"cells\": [{\"text\": \"Prototype delivery\"}, {\"text\": \"Jordan Lee\"}, {\"text\": \"In progress\", \"tag_structure_type\": \"TD\", \"style\": {\"background_color_rgb\": [254, 249, 195]}}]},\n            {\"cells\": [{\"text\": \"Stakeholder approval\"}, {\"text\": \"Avery Patel\"}, {\"text\": \"Planned\", \"tag_structure_type\": \"TD\", \"style\": {\"background_color_rgb\": [239, 246, 255]}}]},\n        ],\n        \"footer_rows\": [\n            {\"cells\": [{\"text\": \"Next review: Friday, 10:00 AM\", \"col_span\": 3, \"tag_structure_type\": \"TD\", \"style\": {\"background_color_rgb\": [245, 247, 250], \"text_color_rgb\": [55, 65, 81]}}]}\n        ],\n    }\n]\n\nwith open(\"\u002Fpath\u002Fto\u002Finput.pdf\", \"rb\") as input_file:\n    multipart = MultipartEncoder(\n        fields={\n            \"file\": (\"input.pdf\", input_file, \"application\u002Fpdf\"),\n            \"table_objects\": json.dumps(table_objects),\n            \"tag_enabled\": \"true\",\n            \"tag_language\": \"en-US\",\n            \"output\": \"project-status\",\n        }\n    )\n    response = requests.post(\n        f\"{api_url}\u002Fpdf-with-added-tables\",\n        data=multipart,\n        headers={\n            \"Accept\": \"application\u002Fjson\",\n            \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",  # Replace with your API key.\n            \"Content-Type\": multipart.content_type,\n        },\n    )\n\nprint(f\"Response status code: {response.status_code}\")\nprint(json.dumps(response.json(), indent=2) if response.ok else response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-added-tables.py\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary libraries, including \u003Ccode>json\u003C\u002Fcode> for handling JSON data and \u003Ccode>requests\u003C\u002Fcode> along with \u003Ccode>MultipartEncoder\u003C\u002Fcode> from \u003Ccode>requests_toolbelt\u003C\u002Fcode> for making multipart HTTP requests.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">api_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\u003C\u002Fpre>\n\n\u003Cp>This line sets the base URL for the API. The default is the US-based service, but there's an option for a GDPR-compliant EU-based service.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">table_objects = [\n    {\n        \"page\": 1,\n        \"x\": 54,\n        \"y\": 540,\n        \"width\": 504,\n        \"columns\": [{\"width\": 210}, {\"width\": 144}, {\"width\": 150}],\n        \"tag_structure_type\": \"Table\",\n        \"style\": {\n            \"padding\": {\"top\": 6, \"right\": 8, \"bottom\": 6, \"left\": 8},\n            \"text_size\": 10,\n        },\n        ...\n    }\n]\n\u003C\u002Fpre>\n\n\u003Cp>This dictionary defines the table to be added to the PDF. It specifies the page number, coordinates, dimensions, and style of the table. The \u003Ccode>tag_structure_type\u003C\u002Fcode> is set to \"Table\", indicating the structure of the content.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">with open(\"\u002Fpath\u002Fto\u002Finput.pdf\", \"rb\") as input_file:\n    multipart = MultipartEncoder(\n        fields={\n            \"file\": (\"input.pdf\", input_file, \"application\u002Fpdf\"),\n            \"table_objects\": json.dumps(table_objects),\n            \"tag_enabled\": \"true\",\n            \"tag_language\": \"en-US\",\n            \"output\": \"project-status\",\n        }\n    )\n\u003C\u002Fpre>\n\n\u003Cp>This section opens the input PDF file and prepares the multipart form data. The \u003Ccode>fields\u003C\u002Fcode> dictionary includes the file, table objects, tagging options, and output file name. The \u003Ccode>json.dumps()\u003C\u002Fcode> function converts the \u003Ccode>table_objects\u003C\u002Fcode> dictionary into a JSON string.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(\n    f\"{api_url}\u002Fpdf-with-added-tables\",\n    data=multipart,\n    headers={\n        \"Accept\": \"application\u002Fjson\",\n        \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",  # Replace with your API key.\n        \"Content-Type\": multipart.content_type,\n    },\n)\n\u003C\u002Fpre>\n\n\u003Cp>This block sends the POST request to the API endpoint, including necessary headers such as the API key and content type. The response from the API is captured in the \u003Ccode>response\u003C\u002Fcode> variable.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use Python to make a multipart API call to the pdfRest Add to PDF endpoint, adding a table to a PDF document. This example demonstrates the flexibility of the pdfRest API in automating PDF manipulations.\u003C\u002Fp>\n\n\u003Cp>To explore further, try out all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. This example is a multipart API call. For examples using JSON payloads, visit the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-added-tables.py\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-08-21T17:49:09.000+00:00","2026-09-02T18:26:44.000+00:00","Learn how to use Python and the pdfRest API to add structured, formatted tables to PDF documents programmatically.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-python\u002F#article\",\n      \"headline\": \"How to Add Tables to PDF Files with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-python\u002F\",\n      \"datePublished\": \"2026-08-21T17:49:09.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:04.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use Python and the pdfRest API to add structured, formatted tables to PDF documents programmatically.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-tables API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Add to PDF, PDF Generation, Python, Tables\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Tables to PDF Files with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-tables-to-pdf-files-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3295,3296,3297,3298,3299,3300],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1858,"name":1859,"slug":1860,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-tables-to-pdf-files-with-python\u002F","How to Add Tables to PDF Files with Python, Tutorial | pdfRest",{"id":3305,"uuid":3306,"title":3307,"slug":3308,"html":3309,"comment_id":3305,"feature_image":48,"featured":284,"visibility":1257,"created_at":3310,"updated_at":3291,"published_at":3310,"custom_excerpt":3311,"codeinjection_head":3312,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3313,"primary_tag":3318,"url":3319,"excerpt":3311,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3320,"meta_description":3311,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"672a96ea533c9f26b9438b9e","65f3bc8f-2888-494c-a3a7-492d059a5da2","How to Add Text to PDF Files in .NET with C#","how-to-add-text-to-pdf-files-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Add Text to PDF Files with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F'>Add to PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to programmatically add text to PDF documents. This tutorial will guide you through the process of sending an API call to the Add to PDF endpoint using C#. By integrating this tool into your C# applications, you can automate the process of modifying PDF files, making it easier to manage and update documents without manual intervention.\u003C\u002Fp>\n\n\u003Cp>A user might need to add text to a PDF for various reasons, such as personalizing documents with user-specific information, adding annotations or comments, or dynamically generating reports with specific data. For instance, a company could use this API to automatically add customer names and order details to invoices before sending them out, ensuring each document is customized and accurate.\u003C\u002Fp>\n\n\u003Ch2>Add Text to PDF Files with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using Newtonsoft.Json;\nusing Newtonsoft.Json.Linq;\nusing System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf-with-added-text\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var text_option_array = new JArray();\n        var text_options = new JObject\n        {\n            [\"font\"] = \"Times New Roman\",\n            [\"max_width\"] = \"175\",\n            [\"opacity\"] = \"1\",\n            [\"page\"] = \"1\",\n            [\"rotation\"] = \"0\",\n            [\"text\"] = \"sample text in PDF\",\n            [\"text_color_rgb\"] = \"0,0,0\",\n            [\"text_size\"] = \"30\",\n            [\"x\"] = \"72\",\n            [\"y\"] = \"144\"\n        };\n        text_option_array.Add(text_options);\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(text_option_array)));\n        multipartContent.Add(byteArrayOption, \"text_objects\");\n\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-added-text.cs\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by setting up an \u003Ccode>HttpClient\u003C\u002Fcode> with a base address pointing to the pdfRest API:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>Next, an \u003Ccode>HttpRequestMessage\u003C\u002Fcode> is created to send a POST request to the \u003Ccode>pdf-with-added-text\u003C\u002Fcode> endpoint:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf-with-added-text\"))\n\u003C\u002Fpre>\n\n\u003Cp>The API key is added to the request headers for authentication:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>A \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> object is created to hold the file and text options. The PDF file is read as a byte array and added to the multipart content:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\u003C\u002Fpre>\n\n\u003Cp>The text options are defined in a JSON object, specifying parameters like font, size, color, and position:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var text_options = new JObject\n{\n    [\"font\"] = \"Times New Roman\",\n    [\"max_width\"] = \"175\",\n    [\"opacity\"] = \"1\",\n    [\"page\"] = \"1\",\n    [\"rotation\"] = \"0\",\n    [\"text\"] = \"sample text in PDF\",\n    [\"text_color_rgb\"] = \"0,0,0\",\n    [\"text_size\"] = \"30\",\n    [\"x\"] = \"72\",\n    [\"y\"] = \"144\"\n};\n\u003C\u002Fpre>\n\n\u003Cp>These options are serialized to JSON and added to the multipart content:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(text_option_array)));\nmultipartContent.Add(byteArrayOption, \"text_objects\");\n\u003C\u002Fpre>\n\n\u003Cp>The request is sent, and the response is read and printed to the console:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\nvar apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you've learned how to use C# to make an API call to pdfRest's Add to PDF endpoint, allowing you to add text to PDF files programmatically. This is a practical solution for automating PDF modifications in your applications.\u003C\u002Fp>\n\n\u003Cp>To explore more capabilities of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed documentation, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example demonstrates a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-added-text.cs\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-05T22:06:34.000+00:00","Learn how use pdfRest Add to PDF API Tool to insert text into a PDF with C#","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Add Text to PDF Files in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-11-05T22:06:34.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:23.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how use pdfRest Add to PDF API Tool to insert text into a PDF with C#\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Add to PDF\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Text to PDF Files in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3314,3315,3316,3317],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-text-to-pdf-files-in-net-with-c\u002F","How to Add Text to PDF Files in .NET with C#, Tutorial | pdfRest",{"id":3322,"uuid":3323,"title":3324,"slug":3325,"html":3326,"comment_id":3322,"feature_image":48,"featured":284,"visibility":1257,"created_at":3327,"updated_at":3328,"published_at":3327,"custom_excerpt":3329,"codeinjection_head":3330,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3331,"primary_tag":3337,"url":3338,"excerpt":3329,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3339,"meta_description":3329,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"672a9da6533c9f26b9438bb8","2c84f07a-cec7-4123-8acf-ea1cc71600ea","How to Add Text to PDF Files with cURL","how-to-add-text-to-pdf-files-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Add Text to PDF Files with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F'>Add to PDF API Tool\u003C\u002Fa> is a powerful resource for developers who need to programmatically add text to PDF documents. This tutorial will guide you through the process of sending an API call to the Add to PDF endpoint using cURL, a command line tool for transferring data with URLs. By learning how to use cURL with pdfRest, you can automate the process of modifying PDFs, making it efficient and scalable for various applications.\u003C\u002Fp>\n\n\u003Cp>Imagine you are working for a company that needs to generate personalized reports for hundreds of clients. Each report is a PDF document that requires the client's name and unique data to be added to specific locations within the document. Using the Add to PDF API with cURL, you can automate this process, ensuring accuracy and saving time by eliminating the need for manual editing.\u003C\u002Fp>\n\n\u003Ch2>Add Text to PDF Files with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">TEXT_OPTIONS='[{\"font\":\"Times New Roman\",\"max_width\":\"175\",\"opacity\":\"1\",\"page\":\"1\",\"rotation\":\"0\",\"text\":\"sample text in PDF\",\"text_color_rgb\":\"0,0,0\",\"text_size\":\"30\",\"x\":\"72\",\"y\":\"144\"}]'\n\ncurl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-added-text\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"text_objects=$TEXT_OPTIONS\" \\\n  -F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-added-text.sh\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>Let's break down the provided cURL command to understand how it works:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">TEXT_OPTIONS='[{\"font\":\"Times New Roman\",\"max_width\":\"175\",\"opacity\":\"1\",\"page\":\"1\",\"rotation\":\"0\",\"text\":\"sample text in PDF\",\"text_color_rgb\":\"0,0,0\",\"text_size\":\"30\",\"x\":\"72\",\"y\":\"144\"}]'\n\u003C\u002Fpre>\n\n\u003Cp>This line defines a shell variable \u003Ccode>TEXT_OPTIONS\u003C\u002Fcode> containing a JSON string. This JSON specifies the text properties to be added to the PDF, such as font, size, color, and position.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-added-text\"\n\u003C\u002Fpre>\n\n\u003Cp>This line initiates a POST request to the pdfRest API endpoint for adding text to PDFs.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\n\u003C\u002Fpre>\n\n\u003Cp>This header specifies that the client expects a JSON response from the server.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\n\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the request body will be sent as \u003Ccode>multipart\u002Fform-data\u003C\u002Fcode>, which is necessary for file uploads.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>This header includes the API key, which is required for authentication. You must replace the placeholder with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\n\u003C\u002Fpre>\n\n\u003Cp>This option specifies the file to upload. Replace \u003Ccode>\u002Fpath\u002Fto\u002Ffile\u003C\u002Fcode> with the path to your PDF file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"text_objects=$TEXT_OPTIONS\"\n\u003C\u002Fpre>\n\n\u003Cp>This option sends the text options defined earlier as part of the form data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>This option specifies the output file name for the processed PDF.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to make a multipart API call to add text to a PDF using the pdfRest Add to PDF API Tool with cURL. This process allows for efficient and automated PDF modifications. To explore more features and tools, try out all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on each API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-added-text.sh\">GitHub JSON Payload Examples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-05T22:35:18.000+00:00","2026-09-02T18:26:45.000+00:00","Learn how to add text to a PDF using pdfRest Add to PDF API Tool with cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-curl\u002F#article\",\n      \"headline\": \"How to Add Text to PDF Files with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-curl\u002F\",\n      \"datePublished\": \"2024-11-05T22:35:18.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:22.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to add text to a PDF using pdfRest Add to PDF API Tool with cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Add to PDF, Text, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Text to PDF Files with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3332,3333,3334,3335,3336],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-text-to-pdf-files-with-curl\u002F","How to Add Text to PDF Files with cURL, Tutorial | pdfRest",{"id":3341,"uuid":3342,"title":3343,"slug":3344,"html":3345,"comment_id":3341,"feature_image":48,"featured":284,"visibility":1257,"created_at":3346,"updated_at":3328,"published_at":3015,"custom_excerpt":3347,"codeinjection_head":3348,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3349,"primary_tag":3355,"url":3356,"excerpt":3347,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3357,"meta_description":3347,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c55533c9f26b943b47f","e98c7cc8-285b-4f44-98df-2f21fe373dd3","How to Add Text to PDF Files with Java","how-to-add-text-to-pdf-files-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This tutorial shows you how to add text to PDF files from a Java application with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\">Add to PDF API Tool\u003C\u002Fa>. The example builds a \u003Ccode>text_objects\u003C\u002Fcode> profile that controls placement and appearance before posting the PDF and instructions together. The walkthrough gives you a practical starting point that you can adapt when you need to add text to PDF files in your own document workflow.\u003C\u002Fp>\n\n\u003Ch2>Why Add Text to PDF Files with Java?\u003C\u002Fh2>\n\n\u003Cp>A case-management service may need to stamp a case number and review date onto an incoming document before it enters an approval queue. Adding text programmatically makes the identifier visible on the page and repeatable across every processed file.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>text_objects\u003C\u002Fcode> JSON array controls page number, coordinates, font, text size, color, opacity, rotation, and wrapping width. Coordinate values are expressed in PDF points.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class PDFWithAddedText {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final String text_options =\n        \"[{\\\"font\\\":\\\"Times New Roman\\\",\\\"max_width\\\":\\\"175\\\",\\\"opacity\\\":\\\"1\\\",\\\"page\\\":\\\"1\\\",\\\"rotation\\\":\\\"0\\\",\\\"text\\\":\\\"sample text in PDF\\\",\\\"text_color_rgb\\\":\\\"0,0,0\\\",\\\"text_size\\\":\\\"30\\\",\\\"x\\\":\\\"72\\\",\\\"y\\\":\\\"144\\\"}]\";\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"text_objects\", text_options)\n            .addFormDataPart(\"output\", \"pdfrest_added_text\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf-with-added-text\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPDFWithAddedText.java\">Java sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>This dependency set combines OkHttp networking with dotenv configuration and \u003Ccode>org.json\u003C\u002Fcode> processing.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final String text_options =\u003C\u002Fpre>\n\n\u003Cp>The startup code separates file selection from authentication so either value can change without rewriting the request.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"text_objects\", text_options)\n            .addFormDataPart(\"output\", \"pdfrest_added_text\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf-with-added-text\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>text_objects\u003C\u002Fcode> JSON array controls page number, coordinates, font, text size, color, opacity, rotation, and wrapping width. Coordinate values are expressed in PDF points. The multipart section uses the form multipart type required for combining uploaded content with operation parameters.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf-with-added-text\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The request builder adds the API key header, selects the operation URL, and attaches the prepared body; changing the base constant switches between US and EU service hosts.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>The response block shows the raw outcome for learning purposes; production code can retain output IDs and branch on reported errors.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You have now seen how to add text to PDF files from a Java application. With that foundation, you can adapt the text-object array for document IDs, status labels, page-specific notices, or generated headings.\u003C\u002Fp>\n\n\u003Cp>When you move beyond the sample, keep in mind that pDF coordinates are measured in points, so placement should be tested against the actual page dimensions and rotation of representative inputs. For variable text, calculate wrapping width and position from document data rather than assuming every identifier or notice occupies the same space.\u003C\u002Fp>\n\n\u003Cp>You can experiment with the Add Text to PDF operation in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. The \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\u002F\">Add to PDF API Tool documentation\u003C\u002Fa> describes the full parameter and response contract.\u003C\u002Fp>\n\n\u003Cp>Note: The Add Text to PDF example above uses multipart form data; to avoid transferring the same input again, compare the multipart call with the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPDFWithAddedText.java\">JSON payload example\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T17:33:09.000+00:00","Place positioned text on an existing PDF with Java using configurable fonts, size, color, and coordinates.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-java\u002F#article\",\n      \"headline\": \"How to Add Text to PDF Files with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:31.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:31.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Place positioned text on an existing PDF with Java using configurable fonts, size, color, and coordinates.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Add to PDF, Java, Text\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Text to PDF Files with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3350,3351,3352,3353,3354],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-text-to-pdf-files-with-java\u002F","Add Text to PDF Files with Java | pdfRest",{"id":3359,"uuid":3360,"title":3361,"slug":3362,"html":3363,"comment_id":3359,"feature_image":48,"featured":284,"visibility":1257,"created_at":3364,"updated_at":3328,"published_at":3364,"custom_excerpt":3365,"codeinjection_head":3366,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3367,"primary_tag":3373,"url":3374,"excerpt":3365,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3375,"meta_description":3365,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"672a9738533c9f26b9438ba8","2e9d62fb-5446-48db-ac41-413049f3c0c1","How to Add Text to PDF Files with JavaScript in NodeJS","how-to-add-text-to-pdf-files-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Add Text to PDF Files with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F'>Add to PDF API Tool\u003C\u002Fa> is a powerful solution for developers looking to programmatically add text to PDF documents. By using JavaScript, you can easily integrate this functionality into your web applications, allowing for dynamic PDF content updates. This tutorial will guide you through the process of sending an API call to the Add to PDF endpoint using JavaScript.\u003C\u002Fp>\n\n\u003Cp>Imagine a scenario where a company needs to generate personalized invoices for its clients. By using the Add to PDF API, the company can automate the process of adding client-specific details, such as names and billing information, directly onto a PDF template. This not only saves time but also reduces the possibility of errors that can occur with manual entry.\u003C\u002Fp>\n\n\u003Ch2>Add Text to PDF Files with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F**\n * This request demonstrates how to add text to a PDF.\n * Horizontal and vertical offsets of the text are measured in PDF units. (1 inch = 72 PDF units)\n *\u002F\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\nvar text_option_array = [];\nvar text_options = {\n    \"font\":\"Times New Roman\",\n    \"max_width\":\"175\",\n    \"opacity\":\"1\",\n    \"page\":\"1\",\n    \"rotation\":\"0\",\n    \"text\":\"sample text in PDF\",\n    \"text_color_rgb\":\"0,0,0\",\n    \"text_size\":\"30\",\n    \"x\":\"72\",\n    \"y\":\"144\"\n};\ntext_option_array.push(text_options);\ndata.append('text_objects', JSON.stringify(text_option_array));\ndata.append('output', 'pdfrest_pdf_with_added_text');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-added-text', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-added-text.js\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by requiring necessary modules: \u003Ccode>axios\u003C\u002Fcode> for HTTP requests, \u003Ccode>form-data\u003C\u002Fcode> for handling form data, and \u003Ccode>fs\u003C\u002Fcode> for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\n\u003C\u002Fpre>\n\n\u003Cp>Here, a new instance of \u003Ccode>FormData\u003C\u002Fcode> is created. The PDF file to be processed is appended to this instance using a file stream. Ensure the file path is correct.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var text_options = {\n    \"font\":\"Times New Roman\",\n    \"max_width\":\"175\",\n    \"opacity\":\"1\",\n    \"page\":\"1\",\n    \"rotation\":\"0\",\n    \"text\":\"sample text in PDF\",\n    \"text_color_rgb\":\"0,0,0\",\n    \"text_size\":\"30\",\n    \"x\":\"72\",\n    \"y\":\"144\"\n};\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>text_options\u003C\u002Fcode> object specifies the text attributes to be added to the PDF. Each parameter is crucial: \n\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Ccode>font\u003C\u002Fcode>: The font type for the text.\u003C\u002Fli>\n\u003Cli>\u003Ccode>max_width\u003C\u002Fcode>: Maximum width of the text box in PDF units.\u003C\u002Fli>\n\u003Cli>\u003Ccode>opacity\u003C\u002Fcode>: Opacity level of the text.\u003C\u002Fli>\n\u003Cli>\u003Ccode>page\u003C\u002Fcode>: Page number where the text will be added.\u003C\u002Fli>\n\u003Cli>\u003Ccode>rotation\u003C\u002Fcode>: Rotation angle of the text.\u003C\u002Fli>\n\u003Cli>\u003Ccode>text\u003C\u002Fcode>: The actual text content to be added.\u003C\u002Fli>\n\u003Cli>\u003Ccode>text_color_rgb\u003C\u002Fcode>: RGB color values for the text.\u003C\u002Fli>\n\u003Cli>\u003Ccode>text_size\u003C\u002Fcode>: Size of the text.\u003C\u002Fli>\n\u003Cli>\u003Ccode>x\u003C\u002Fcode> and \u003Ccode>y\u003C\u002Fcode>: Coordinates for text placement.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-added-text', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>config\u003C\u002Fcode> object defines the request parameters, including the HTTP method, endpoint URL, headers, and the data payload. The API key must be replaced with a valid key.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use JavaScript to send an API request to pdfRest's Add to PDF endpoint, allowing you to add text to a PDF document programmatically. This can be a valuable tool for automating document processing tasks.\u003C\u002Fp>\n\n\u003Cp>Explore more about pdfRest's capabilities by trying out all the API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-added-text.js\">here\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-05T22:07:52.000+00:00","Learn how to insert text into a PDF with JavaScript using pdfRest Add to PDF API Tool","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Add Text to PDF Files with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-11-05T22:07:52.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:23.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to insert text into a PDF with JavaScript using pdfRest Add to PDF API Tool\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Add to PDF, JavaScript, Text\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Text to PDF Files with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3368,3369,3370,3371,3372],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-text-to-pdf-files-with-javascript-in-nodejs\u002F","How to Add Text to PDF Files with JavaScript in NodeJS, Tutorial | pdfRest",{"id":3377,"uuid":3378,"title":3379,"slug":3380,"html":3381,"comment_id":3377,"feature_image":48,"featured":284,"visibility":1257,"created_at":3382,"updated_at":3383,"published_at":3382,"custom_excerpt":3384,"codeinjection_head":3385,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3386,"primary_tag":3392,"url":3393,"excerpt":3384,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3394,"meta_description":3384,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"672a965d533c9f26b9438b94","f0f9eaee-5379-4647-9912-a131deea0d38","How to Add Text to PDF Files with PHP","how-to-add-text-to-a-pdf-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Add Text to PDF Files with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F'>Add to PDF API Tool\u003C\u002Fa> is a powerful solution for developers looking to programmatically add text to PDF documents. This tutorial demonstrates how to send an API call to the Add to PDF endpoint using PHP. By leveraging this tool, users can automate the process of editing PDFs, making it an efficient option for applications that require dynamic PDF content generation.\u003C\u002Fp>\n\n\u003Cp>In a real-world scenario, a business might use the Add to PDF API to automatically generate invoices or reports that include custom text, such as customer names, dates, or transaction details. This can streamline workflows by eliminating the need for manual PDF editing, ensuring that documents are consistently formatted and delivered in a timely manner.\u003C\u002Fp>\n\n\u003Ch2>Add Text to PDF Files with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">\nrequire 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\n$headers = [\n  'Api-Key' =--> 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile', \u002F\u002F Set the filename for the file to be processed, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'text_objects', \u002F\u002F Specify the field name for the text options.\n      'contents' => '[{\"font\":\"Times New Roman\",\"max_width\":\"175\",\"opacity\":\"1\",\"page\":\"1\",\"rotation\":\"0\",\"text\":\"sample text in PDF\",\"text_color_rgb\":\"0,0,0\",\"text_size\":\"30\",\"x\":\"72\",\"y\":\"144\"}]' \u002F\u002F Set the value for the text_objects option. This is a JSON-formatted string consisting of an array with sets of text options.\n    ],\n    [\n      'name' => 'output', \u002F\u002F Specify the field name for the output option.\n      'contents' => 'pdfrest_pdf_with_added_text' \u002F\u002F Set the value for the output option (in this case, 'pdfrest_pdf_with_added_text').\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-added-text', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the PDF with new text.\n\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-added-text.php\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by requiring the autoload file to load the Guzzle HTTP client, which is necessary for making HTTP requests:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">require 'vendor\u002Fautoload.php';\n\u003C\u002Fpre>\n\n\u003Cp>Next, we import the necessary classes from the Guzzle library:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">use GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\u003C\u002Fpre>\n\n\u003Cp>We then create a new instance of the Guzzle HTTP client:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$client = new Client();\n\u003C\u002Fpre>\n\n\u003Cp>The headers for the request are set, including the API key for authentication:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$headers = [\n  'Api-Key' => 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The options array is configured with multipart data, which includes the file to be processed, the text objects to add, and the output format:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'text_objects',\n      'contents' => '[{\"font\":\"Times New Roman\",\"max_width\":\"175\",\"opacity\":\"1\",\"page\":\"1\",\"rotation\":\"0\",\"text\":\"sample text in PDF\",\"text_color_rgb\":\"0,0,0\",\"text_size\":\"30\",\"x\":\"72\",\"y\":\"144\"}]'\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_pdf_with_added_text'\n    ]\n  ]\n];\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>A new HTTP POST request is created with the specified endpoint and headers:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-added-text', $headers);\n\u003C\u002Fpre>\n\n\u003Cp>The request is sent asynchronously, and the response is awaited and outputted:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$res = $client->sendAsync($request, $options)->wait();\necho $res->getBody();\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we demonstrated how to use PHP to make an API call to the pdfRest Add to PDF endpoint, allowing you to add text to a PDF document programmatically. This can be a valuable tool for automating document processing tasks.\u003C\u002Fp>\n\n\u003Cp>To further explore the capabilities of the pdfRest API, we encourage you to try out all the available tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example demonstrates a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-added-text.php\">this GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-05T22:04:13.000+00:00","2026-09-02T18:26:46.000+00:00","Learn how use pdfRest Add to PDF API Tool with PHP to insert text into a PDF","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-a-pdf-with-php\u002F#article\",\n      \"headline\": \"How to Add Text to PDF Files with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-a-pdf-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-a-pdf-with-php\u002F\",\n      \"datePublished\": \"2024-11-05T22:04:13.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:23.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how use pdfRest Add to PDF API Tool with PHP to insert text into a PDF\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Add to PDF, PHP, Text\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Text to PDF Files with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-a-pdf-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3387,3388,3389,3390,3391],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-text-to-a-pdf-with-php\u002F","How to Add Text to a PDF with PHP, Tutorial | pdfRest",{"id":3396,"uuid":3397,"title":3398,"slug":3399,"html":3400,"comment_id":3396,"feature_image":48,"featured":284,"visibility":1257,"created_at":3401,"updated_at":3383,"published_at":3401,"custom_excerpt":3402,"codeinjection_head":3403,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3404,"primary_tag":3410,"url":3411,"excerpt":3402,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3412,"meta_description":3402,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"672a9634533c9f26b9438b8a","c8a54afb-bdb0-4e92-b48c-af682e4d27c8","How to Add Text to PDF Files with Python","how-to-add-text-to-pdf-files-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Add to PDF Files with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F'>Add to PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to programmatically add text to PDF documents. This tutorial will guide you through the process of sending an API call to the Add to PDF endpoint using Python. By leveraging this tool, you can automate the process of modifying PDF files, which is particularly useful for applications that require dynamic PDF content generation or updates.\u003C\u002Fp>\n\n\u003Cp>Consider a scenario where a business needs to generate personalized invoices for its customers. By using the Add to PDF API, the business can automatically insert customer names, addresses, and invoice details into a PDF template, streamlining the invoicing process and reducing the potential for manual errors. This approach not only enhances efficiency but also ensures a consistent and professional appearance for all generated documents.\u003C\u002Fp>\n\n\u003Ch2>Add Text to PDF Files with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\npdf_with_added_text_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-added-text'\n\ntext_options = [{\n    \"font\":\"Times New Roman\",\n    \"max_width\":\"175\",\n    \"opacity\":\"1\",\n    \"page\":\"1\",\n    \"rotation\":\"0\",\n    \"text\":\"sample text in PDF\",\n    \"text_color_rgb\":\"0,0,0\",\n    \"text_size\":\"30\",\n    \"x\":\"72\",\n    \"y\":\"144\"\n}]\n\nmp_encoder_addedtextPDF = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'text_objects': json.dumps(text_options),\n        'output' : 'example_out'\n    }\n)\n\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_addedtextPDF.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to pdf-with-added-text endpoint...\")\nresponse = requests.post(pdf_with_added_text_endpoint_url, data=mp_encoder_addedtextPDF, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-added-text.py\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary libraries: \u003Ccode>requests_toolbelt\u003C\u002Fcode> for handling multipart encoding, \u003Ccode>requests\u003C\u002Fcode> for making HTTP requests, and \u003Ccode>json\u003C\u002Fcode> for handling JSON data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">pdf_with_added_text_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-added-text'\n\u003C\u002Fpre>\n\n\u003Cp>This line sets the endpoint URL for the Add to PDF API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">text_options = [{\n    \"font\":\"Times New Roman\",\n    \"max_width\":\"175\",\n    \"opacity\":\"1\",\n    \"page\":\"1\",\n    \"rotation\":\"0\",\n    \"text\":\"sample text in PDF\",\n    \"text_color_rgb\":\"0,0,0\",\n    \"text_size\":\"30\",\n    \"x\":\"72\",\n    \"y\":\"144\"\n}]\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>text_options\u003C\u002Fcode> dictionary specifies the text attributes to be added to the PDF. Each key-value pair defines a property such as \u003Ccode>font\u003C\u002Fcode>, \u003Ccode>max_width\u003C\u002Fcode>, \u003Ccode>opacity\u003C\u002Fcode>, \u003Ccode>page\u003C\u002Fcode>, \u003Ccode>rotation\u003C\u002Fcode>, \u003Ccode>text\u003C\u002Fcode>, \u003Ccode>text_color_rgb\u003C\u002Fcode>, \u003Ccode>text_size\u003C\u002Fcode>, \u003Ccode>x\u003C\u002Fcode>, and \u003Ccode>y\u003C\u002Fcode>. These options allow precise control over the appearance and placement of the text.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_addedtextPDF = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'text_objects': json.dumps(text_options),\n        'output' : 'example_out'\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>MultipartEncoder\u003C\u002Fcode> is used to prepare the multipart form-data payload. The \u003Ccode>fields\u003C\u002Fcode> parameter includes the PDF file, the JSON-encoded \u003Ccode>text_objects\u003C\u002Fcode>, and the desired \u003Ccode>output\u003C\u002Fcode> filename.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_addedtextPDF.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>headers\u003C\u002Fcode> dictionary sets the request headers, including the \u003Ccode>Accept\u003C\u002Fcode> type, \u003Ccode>Content-Type\u003C\u002Fcode> derived from the \u003Ccode>MultipartEncoder\u003C\u002Fcode>, and the \u003Ccode>Api-Key\u003C\u002Fcode>, which you need to replace with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(pdf_with_added_text_endpoint_url, data=mp_encoder_addedtextPDF, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This line sends the POST request to the API endpoint, passing the encoded data and headers.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you successfully learned how to use Python to send an API request to the pdfRest Add to PDF endpoint, allowing you to add text to a PDF document programmatically. This is a versatile tool that can be integrated into various applications requiring PDF modifications.\u003C\u002Fp>\n\n\u003Cp>For further exploration, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. Additionally, the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> provides comprehensive details on all available endpoints and parameters.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-added-text.py\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-05T22:03:32.000+00:00","Learn how to insert text into a PDF using pdfRest Add to PDF API Tool with Python","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-python\u002F#article\",\n      \"headline\": \"How to Add Text to PDF Files with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-python\u002F\",\n      \"datePublished\": \"2024-11-05T22:03:32.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:23.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to insert text into a PDF using pdfRest Add to PDF API Tool with Python\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Add to PDF, Python, Text\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Text to PDF Files with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-text-to-pdf-files-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3405,3406,3407,3408,3409],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-text-to-pdf-files-with-python\u002F","How to Add Text to PDF Files with Python, Tutorial | pdfRest",{"id":3414,"uuid":3415,"title":3416,"slug":3417,"html":3418,"comment_id":3414,"feature_image":48,"featured":284,"visibility":1257,"created_at":3419,"updated_at":3420,"published_at":3419,"custom_excerpt":3421,"codeinjection_head":3422,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3423,"primary_tag":3429,"url":3430,"excerpt":3421,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3431,"meta_description":3421,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a860318533c9f26b943ab65","5e99b9eb-6e8b-476c-b3dc-a753b71b9fb9","How to Add Vector Lines and Rectangles to PDF Files in .NET with C#","how-to-add-vector-lines-and-rectangles-to-pdf-files-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Add Vector Lines and Rectangles to PDF Files with C#?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F'>pdfRest Add to PDF API Tool\u003C\u002Fa> is a powerful resource for developers who need to manipulate PDF documents programmatically. By using this tool, you can add shapes such as rectangles and lines to existing PDF files, which can be useful for highlighting areas, adding annotations, or creating custom layouts. This tutorial will guide you through the process of sending an API call to Add to PDF using C#.\u003C\u002Fp>\n\n\u003Cp>Consider a real-world scenario where a company needs to create a review panel on a PDF document for internal audits. By using the Add to PDF API, they can programmatically add shapes like rectangles for background and lines for dividers, ensuring consistency and saving time compared to manual editing. This automation can be especially beneficial when dealing with large volumes of documents.\u003C\u002Fp>\n\n\u003Ch2>Add Vector Lines and Rectangles to PDF Files with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">\u002F*\n * What this sample does:\n * - Adds a review-panel background and divider line to a PDF via multipart\u002Fform-data.\n * - Routed from Program.cs as: `dotnet run -- pdf-with-added-shapes-multipart \u003Cinputfile>`.\n *\n * Setup (environment):\n * - Copy .env.example to .env\n * - Set PDFREST_API_KEY=your_api_key_here\n * - Optional: set PDFREST_URL to override the API region. For EU\u002FGDPR compliance and proximity, use:\n *     PDFREST_URL=https:\u002F\u002Feu-api.pdfrest.com\n *   For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\nusing Newtonsoft.Json.Linq;\nusing System.Text;\nusing Samples;\n\nnamespace Samples.EndpointExamples.MultipartPayload;\n\npublic static class PdfWithAddedShapes\n{\n    public static async Task Execute(string[] args)\n    {\n        var inputPath = SampleInput.RequireFile(args, \"pdf-with-added-shapes-multipart\");\n        var apiKey = SampleInput.RequireApiKey();\n        var shapes = JArray.Parse(\"\"\"\n            [\n              {\"type\":\"rectangle\",\"page\":1,\"x\":54,\"y\":540,\"width\":504,\"height\":108,\"fill_color_rgb\":\"245,247,250\",\"stroke_color_rgb\":\"26,72,112\",\"stroke_width\":1,\"tag_is_artifact\":true},\n              {\"type\":\"line\",\"page\":1,\"x1\":72,\"y1\":576,\"x2\":540,\"y2\":576,\"stroke_color_rgb\":\"26,72,112\",\"stroke_width\":1.5,\"tag_actual_text\":\"Review section divider\",\"tag_structure_type\":\"Figure\"}\n            ]\n            \"\"\");\n\n        using var client = SampleInput.CreateClient();\n        using var request = new HttpRequestMessage(HttpMethod.Post, \"pdf-with-added-shapes\");\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        using var content = new MultipartFormDataContent();\n        content.Add(new ByteArrayContent(await File.ReadAllBytesAsync(inputPath)), \"file\", Path.GetFileName(inputPath));\n        content.Add(new StringContent(shapes.ToString(), Encoding.UTF8), \"shape_objects\");\n        content.Add(new StringContent(\"true\"), \"tag_enabled\");\n        content.Add(new StringContent(\"review-panel\"), \"output\");\n        request.Content = content;\n\n        await SampleInput.PrintResponse(client, request);\n    }\n}\n\u003C\u002Finputfile>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-added-shapes.cs\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by setting up the environment and requiring necessary inputs such as the input file path and API key:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var inputPath = SampleInput.RequireFile(args, \"pdf-with-added-shapes-multipart\");\nvar apiKey = SampleInput.RequireApiKey();\n\u003C\u002Fpre>\n\n\u003Cp>Next, a JSON array defines the shapes to be added, specifying attributes like type, page, coordinates, colors, and more:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var shapes = JArray.Parse(\"\"\"\n    [\n      {\"type\":\"rectangle\",\"page\":1,\"x\":54,\"y\":540,\"width\":504,\"height\":108,\"fill_color_rgb\":\"245,247,250\",\"stroke_color_rgb\":\"26,72,112\",\"stroke_width\":1,\"tag_is_artifact\":true},\n      {\"type\":\"line\",\"page\":1,\"x1\":72,\"y1\":576,\"x2\":540,\"y2\":576,\"stroke_color_rgb\":\"26,72,112\",\"stroke_width\":1.5,\"tag_actual_text\":\"Review section divider\",\"tag_structure_type\":\"Figure\"}\n    ]\n    \"\"\");\n\u003C\u002Fpre>\n\n\u003Cp>The HttpClient and HttpRequestMessage are initialized for making the API call. The API key is added to the request header:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using var client = SampleInput.CreateClient();\nusing var request = new HttpRequestMessage(HttpMethod.Post, \"pdf-with-added-shapes\");\nrequest.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\nrequest.Headers.Accept.Add(new(\"application\u002Fjson\"));\n\u003C\u002Fpre>\n\n\u003Cp>The content of the request is created using MultipartFormDataContent, which includes the PDF file and shape objects:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using var content = new MultipartFormDataContent();\ncontent.Add(new ByteArrayContent(await File.ReadAllBytesAsync(inputPath)), \"file\", Path.GetFileName(inputPath));\ncontent.Add(new StringContent(shapes.ToString(), Encoding.UTF8), \"shape_objects\");\ncontent.Add(new StringContent(\"true\"), \"tag_enabled\");\ncontent.Add(new StringContent(\"review-panel\"), \"output\");\nrequest.Content = content;\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the response from the API call is printed:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">await SampleInput.PrintResponse(client, request);\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use C# to make an API call to pdfRest's Add to PDF tool, adding shapes to a PDF document. This example demonstrates how to enhance PDF documents programmatically, which can be useful for various applications like creating templates or adding annotations.\u003C\u002Fp>\n\n\u003Cp>I encourage you to explore all the pdfRest API Tools available in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. Note that this is an example of a multipart API call, and code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-added-shapes.cs\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-08-19T19:25:12.000+00:00","2026-09-02T18:26:47.000+00:00","Learn how to use pdfRest Add to PDF API Tool with C# to add vector shapes to PDF documents.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Add Vector Lines and Rectangles to PDF Files in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-in-net-with-c\u002F\",\n      \"datePublished\": \"2026-08-19T19:25:12.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:05.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Add to PDF API Tool with C# to add vector shapes to PDF documents.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-shapes API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Add to PDF, PDF Generation\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Vector Lines and Rectangles to PDF Files in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3424,3425,3426,3427,3428],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-in-net-with-c\u002F","How to Add Vector Lines and Rectangles to PDF Files in .NET with C#, Tutorial | pdfRest",{"id":3433,"uuid":3434,"title":3435,"slug":3436,"html":3437,"comment_id":3433,"feature_image":48,"featured":284,"visibility":1257,"created_at":3438,"updated_at":3420,"published_at":3438,"custom_excerpt":3439,"codeinjection_head":3440,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3441,"primary_tag":3447,"url":3448,"excerpt":3439,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3449,"meta_description":3439,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a86073c533c9f26b943ab79","ee5c7e41-fdd6-4704-917e-555ad49001fe","How to Add Vector Lines and Rectangles to PDF Files with cURL","how-to-add-vector-lines-and-rectangles-to-pdf-files-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Add Vector Lines and Rectangles to PDF Files with cURL?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F'>pdfRest Add to PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to enhance PDFs by programmatically adding shapes such as lines, rectangles, and more. This tutorial will guide you through the process of making an API call to the Add to PDF endpoint using cURL, a command-line tool for transferring data with URLs. With this tool, you can automate the customization of PDF documents, making it easier to integrate PDF editing capabilities into your applications.\u003C\u002Fp>\n\n\u003Cp>In real-world scenarios, a user might use the Add to PDF tool to insert graphical elements into a PDF for various purposes. For example, a company might want to automatically add branded headers or footers to documents before distribution, or a teacher could add annotations or highlight sections of a PDF for educational purposes. By using cURL, these tasks can be scripted and automated, saving time and ensuring consistency.\u003C\u002Fp>\n\n\u003Ch2>Add Vector Lines and Rectangles to PDF Files with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">#!\u002Fbin\u002Fsh\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# This example adds a lightly shaded review panel and a divider line to page one.\n# Coordinates are measured from the lower-left corner in PDF units (72 units = 1 inch).\nSHAPE_OBJECTS='[\n  {\n    \"type\": \"rectangle\",\n    \"page\": 1,\n    \"x\": 54,\n    \"y\": 540,\n    \"width\": 504,\n    \"height\": 108,\n    \"fill_color_rgb\": \"245,247,250\",\n    \"stroke_color_rgb\": \"26,72,112\",\n    \"stroke_width\": 1,\n    \"tag_is_artifact\": true\n  },\n  {\n    \"type\": \"line\",\n    \"page\": 1,\n    \"x1\": 72,\n    \"y1\": 576,\n    \"x2\": 540,\n    \"y2\": 576,\n    \"stroke_color_rgb\": \"26,72,112\",\n    \"stroke_width\": 1.5,\n    \"tag_actual_text\": \"Review section divider\",\n    \"tag_structure_type\": \"Figure\"\n  }\n]'\n\ncurl -X POST \"$API_URL\u002Fpdf-with-added-shapes\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Finput.pdf\" \\\n  -F \"shape_objects=$SHAPE_OBJECTS\" \\\n  -F \"tag_enabled=true\" \\\n  -F \"output=review-panel\"\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-added-shapes.sh\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The script begins by setting the \u003Ccode>API_URL\u003C\u002Fcode> variable to the US-based endpoint \u003Ccode>\"https:\u002F\u002Fapi.pdfrest.com\"\u003C\u002Fcode>. This is the default for global users, but there's an option to switch to an EU-based endpoint for GDPR compliance.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">API_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>SHAPE_OBJECTS\u003C\u002Fcode> variable contains a JSON array defining the shapes to be added to the PDF. It specifies a rectangle and a line, detailing their positions, dimensions, and colors. The rectangle is filled with a light shade and outlined, while the line serves as a divider.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">SHAPE_OBJECTS='[\n  {\n    \"type\": \"rectangle\",\n    \"page\": 1,\n    ...\n  },\n  {\n    \"type\": \"line\",\n    \"page\": 1,\n    ...\n  }\n]'\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>curl\u003C\u002Fcode> command sends a POST request to the \u003Ccode>pdf-with-added-shapes\u003C\u002Fcode> endpoint. It includes headers for accepting JSON responses and specifying multipart form data. An API key is required for authentication.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"$API_URL\u002Fpdf-with-added-shapes\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  ...\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>-F\u003C\u002Fcode> flags specify form data: the PDF file to modify, the shape objects to add, enabling tagging, and the output file name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Finput.pdf\" \\\n-F \"shape_objects=$SHAPE_OBJECTS\" \\\n-F \"tag_enabled=true\" \\\n-F \"output=review-panel\"\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use cURL to call the pdfRest Add to PDF API, adding shapes to a PDF document. This example demonstrates the flexibility and power of automating PDF modifications through API calls.\u003C\u002Fp>\n\n\u003Cp>To further explore the capabilities of pdfRest, try out all the API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on each endpoint, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. For code samples using JSON payloads, visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-added-shapes.sh\">this GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-08-19T19:42:52.000+00:00","Learn how to work with the pdfRest Add to PDF API Tool to add vector shapes to PDF documents using cURL.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-curl\u002F#article\",\n      \"headline\": \"How to Add Vector Lines and Rectangles to PDF Files with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-curl\u002F\",\n      \"datePublished\": \"2026-08-19T19:42:52.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:05.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to work with the pdfRest Add to PDF API Tool to add vector shapes to PDF documents using cURL.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-shapes API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Add to PDF, PDF Generation, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Vector Lines and Rectangles to PDF Files with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3442,3443,3444,3445,3446],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-curl\u002F","How to Add Vector Lines and Rectangles to PDF Files with cURL, Tutorial | pdfRest",{"id":3451,"uuid":3452,"title":3453,"slug":3454,"html":3455,"comment_id":3451,"feature_image":48,"featured":284,"visibility":1257,"created_at":3456,"updated_at":3457,"published_at":3456,"custom_excerpt":3458,"codeinjection_head":3459,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3460,"primary_tag":3466,"url":3467,"excerpt":3458,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3468,"meta_description":3458,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a8607aa533c9f26b943ab83","582edc6e-e3bc-42d0-8d24-84f8b37c91fc","How to Add Vector Lines and Rectangles to PDF Files with Java","how-to-add-vector-lines-and-rectangles-to-pdf-files-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Add Vector Lines and Rectangles to PDF Files with Java?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F'>pdfRest Add to PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to programmatically add shapes, annotations, or other elements to PDF documents. By using this tool, you can enhance PDFs with custom graphics, making them more interactive and visually appealing. This tutorial will guide you through the process of sending an API call to the Add to PDF endpoint using Java, demonstrating how to integrate this functionality into your applications.\u003C\u002Fp>\n\n\u003Cp>In a real-world scenario, imagine a publishing company that needs to add review panels and divider lines to PDF documents before they are finalized. By using the Add to PDF API, they can automate this process, ensuring consistency and saving time. This capability is particularly useful for businesses that regularly handle large volumes of documents and require a streamlined workflow for document enhancement.\u003C\u002Fp>\n\n\u003Ch2>Add Vector Lines and Rectangles to PDF Files with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\n\npublic class PDFWithAddedShapes {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Finput.pdf\";\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile = new File(args.length > 0 ? args[0] : DEFAULT_FILE_PATH);\n    Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    \u002F\u002F Add a lightly shaded review panel and a divider line to page one.\n    \u002F\u002F Coordinates are measured from the lower-left corner in PDF units (72 units = 1 inch).\n    JSONArray shapes =\n        new JSONArray()\n            .put(\n                new JSONObject()\n                    .put(\"type\", \"rectangle\")\n                    .put(\"page\", 1)\n                    .put(\"x\", 54)\n                    .put(\"y\", 540)\n                    .put(\"width\", 504)\n                    .put(\"height\", 108)\n                    .put(\"fill_color_rgb\", \"245,247,250\")\n                    .put(\"stroke_color_rgb\", \"26,72,112\")\n                    .put(\"stroke_width\", 1)\n                    .put(\"tag_is_artifact\", true))\n            .put(\n                new JSONObject()\n                    .put(\"type\", \"line\")\n                    .put(\"page\", 1)\n                    .put(\"x1\", 72)\n                    .put(\"y1\", 576)\n                    .put(\"x2\", 540)\n                    .put(\"y2\", 576)\n                    .put(\"stroke_color_rgb\", \"26,72,112\")\n                    .put(\"stroke_width\", 1.5)\n                    .put(\"tag_actual_text\", \"Review section divider\")\n                    .put(\"tag_structure_type\", \"Figure\"));\n\n    RequestBody fileBody = RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), fileBody)\n            .addFormDataPart(\"shape_objects\", shapes.toString())\n            .addFormDataPart(\"tag_enabled\", \"true\")\n            .addFormDataPart(\"output\", \"review-panel\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Accept\", \"application\u002Fjson\")\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf-with-added-shapes\")\n            .post(requestBody)\n            .build();\n\n    OkHttpClient client = new OkHttpClient.Builder().readTimeout(60, TimeUnit.SECONDS).build();\n    try (Response response = client.newCall(request).execute()) {\n      System.out.println(\"Response status code: \" + response.code());\n      if (response.body() != null) {\n        System.out.println(new JSONObject(response.body().string()).toString(2));\n      }\n    } catch (IOException error) {\n      throw new RuntimeException(error);\n    }\n  }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPDFWithAddedShapes.java\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary libraries and defining constants. The \u003Ccode>API_URL\u003C\u002Fcode> is set to the US-based endpoint by default, but an EU-based endpoint is available for GDPR compliance. The \u003Ccode>DEFAULT_FILE_PATH\u003C\u002Fcode> and \u003Ccode>DEFAULT_API_KEY\u003C\u002Fcode> are placeholders for the PDF file path and API key, respectively.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">File inputFile = new File(args.length > 0 ? args[0] : DEFAULT_FILE_PATH);\nDotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\u003C\u002Fpre>\n\n\u003Cp>Here, the code checks if a file path is provided as an argument; otherwise, it uses the default path. The \u003Ccode>Dotenv\u003C\u002Fcode> library loads environment variables, which can include sensitive information like the API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">JSONArray shapes = new JSONArray()\n    .put(new JSONObject()\n        .put(\"type\", \"rectangle\")\n        .put(\"page\", 1)\n        .put(\"x\", 54)\n        .put(\"y\", 540)\n        .put(\"width\", 504)\n        .put(\"height\", 108)\n        .put(\"fill_color_rgb\", \"245,247,250\")\n        .put(\"stroke_color_rgb\", \"26,72,112\")\n        .put(\"stroke_width\", 1)\n        .put(\"tag_is_artifact\", true))\n    .put(new JSONObject()\n        .put(\"type\", \"line\")\n        .put(\"page\", 1)\n        .put(\"x1\", 72)\n        .put(\"y1\", 576)\n        .put(\"x2\", 540)\n        .put(\"y2\", 576)\n        .put(\"stroke_color_rgb\", \"26,72,112\")\n        .put(\"stroke_width\", 1.5)\n        .put(\"tag_actual_text\", \"Review section divider\")\n        .put(\"tag_structure_type\", \"Figure\"));\n\u003C\u002Fpre>\n\n\u003Cp>This snippet creates a JSON array of shapes to be added to the PDF. The shapes include a rectangle and a line, each with specific properties such as type, page, coordinates, color, and stroke width. These properties define how and where the shapes will appear on the PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">RequestBody fileBody = RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\nRequestBody requestBody = new MultipartBody.Builder()\n    .setType(MultipartBody.FORM)\n    .addFormDataPart(\"file\", inputFile.getName(), fileBody)\n    .addFormDataPart(\"shape_objects\", shapes.toString())\n    .addFormDataPart(\"tag_enabled\", \"true\")\n    .addFormDataPart(\"output\", \"review-panel\")\n    .build();\n\u003C\u002Fpre>\n\n\u003Cp>This part constructs the multipart request body. It includes the PDF file, the shapes JSON array, and additional parameters like \u003Ccode>tag_enabled\u003C\u002Fcode> and \u003Ccode>output\u003C\u002Fcode>. The \u003Ccode>tag_enabled\u003C\u002Fcode> parameter, when set to true, ensures that tags are applied to the shapes, while \u003Ccode>output\u003C\u002Fcode> specifies the desired output format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Request request = new Request.Builder()\n    .header(\"Accept\", \"application\u002Fjson\")\n    .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n    .url(API_URL + \"\u002Fpdf-with-added-shapes\")\n    .post(requestBody)\n    .build();\n\u003C\u002Fpre>\n\n\u003Cp>A request object is created with headers for content type and API key, and it specifies the endpoint URL. The \u003Ccode>POST\u003C\u002Fcode> method is used to send the request with the constructed request body.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">OkHttpClient client = new OkHttpClient.Builder().readTimeout(60, TimeUnit.SECONDS).build();\ntry (Response response = client.newCall(request).execute()) {\n  System.out.println(\"Response status code: \" + response.code());\n  if (response.body() != null) {\n    System.out.println(new JSONObject(response.body().string()).toString(2));\n  }\n} catch (IOException error) {\n  throw new RuntimeException(error);\n}\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>OkHttpClient\u003C\u002Fcode> is configured to handle the request, with a read timeout of 60 seconds. The response is then processed, printing the status code and response body if available.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use Java to make an API call to pdfRest's Add to PDF endpoint, allowing you to add custom shapes to a PDF document. This example demonstrated the use of a multipart API call, which is useful for handling file uploads and complex data structures.\u003C\u002Fp>\n\n\u003Cp>To further explore the capabilities of pdfRest, you can demo all of the API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. Note that this tutorial is an example of a multipart API call, and code samples using JSON payloads can be found on \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPDFWithAddedShapes.java\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-08-19T19:44:42.000+00:00","2026-09-02T18:26:48.000+00:00","Learn how to add vector shapes to PDF documents with Java using the pdfRest Add to PDF API Tool.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-java\u002F#article\",\n      \"headline\": \"How to Add Vector Lines and Rectangles to PDF Files with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-java\u002F\",\n      \"datePublished\": \"2026-08-19T19:44:42.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:05.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to add vector shapes to PDF documents with Java using the pdfRest Add to PDF API Tool.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-shapes API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Add to PDF, Java, PDF Generation\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Vector Lines and Rectangles to PDF Files with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3461,3462,3463,3464,3465],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-java\u002F","How to Add Vector Lines and Rectangles to PDF Files with Java, Tutorial | pdfRest",{"id":3470,"uuid":3471,"title":3472,"slug":3473,"html":3474,"comment_id":3470,"feature_image":48,"featured":284,"visibility":1257,"created_at":3475,"updated_at":3457,"published_at":3475,"custom_excerpt":3476,"codeinjection_head":3477,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3478,"primary_tag":3484,"url":3485,"excerpt":3476,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3486,"meta_description":3476,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a860408533c9f26b943ab6f","2a96da4c-8ba7-443e-8474-1c99a8bc6528","How to Add Vector Lines and Rectangles to PDF Files with JavaScript in NodeJS","how-to-add-vector-lines-and-rectangles-to-pdf-files-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Add Vector Lines and Rectangles to PDF Files with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F'>pdfRest Add to PDF API Tool\u003C\u002Fa> is a powerful utility that allows developers to programmatically add shapes and annotations to PDF documents using JavaScript. This tutorial will guide you through the process of sending an API call to the Add to PDF endpoint using JavaScript, enabling you to enhance PDF documents with custom shapes and designs.\u003C\u002Fp>\n\n\u003Cp>In real-world scenarios, a user might use the Add to PDF functionality to enhance reports or documents with visual elements such as dividers, highlights, or annotations. For example, a company could use this tool to automatically add branding elements or review sections to PDF reports generated from their data analytics platform.\u003C\u002Fp>\n\n\u003Ch2>Add Vector Lines and Rectangles to PDF Files with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F**\n * Add a review-panel background and divider line to a PDF.\n * PDF coordinates begin at the lower-left corner; 72 PDF units equal one inch.\n *\u002F\nconst axios = require(\"axios\");\nconst FormData = require(\"form-data\");\nconst fs = require(\"fs\");\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nconst apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F const apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\nconst shapes = [\n  {\n    type: \"rectangle\",\n    page: 1,\n    x: 54,\n    y: 540,\n    width: 504,\n    height: 108,\n    fill_color_rgb: \"245,247,250\",\n    stroke_color_rgb: \"26,72,112\",\n    stroke_width: 1,\n    tag_is_artifact: true,\n  },\n  {\n    type: \"line\",\n    page: 1,\n    x1: 72,\n    y1: 576,\n    x2: 540,\n    y2: 576,\n    stroke_color_rgb: \"26,72,112\",\n    stroke_width: 1.5,\n    tag_actual_text: \"Review section divider\",\n    tag_structure_type: \"Figure\",\n  },\n];\n\nconst form = new FormData();\nform.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Finput.pdf\"));\nform.append(\"shape_objects\", JSON.stringify(shapes));\nform.append(\"tag_enabled\", \"true\");\nform.append(\"output\", \"review-panel\");\n\naxios({\n  method: \"post\",\n  maxBodyLength: Infinity,\n  url: `${apiUrl}\u002Fpdf-with-added-shapes`,\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", \u002F\u002F Replace with your API key.\n    ...form.getHeaders(),\n  },\n  data: form,\n})\n  .then((response) => console.log(JSON.stringify(response.data, null, 2)))\n  .catch((error) => console.log(error.response?.data || error.message));\n\n\u002F\u002F To download the returned file, use the outputId with the get-resource-id endpoint sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-added-shapes.js\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary modules: \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests, \u003Ccode>form-data\u003C\u002Fcode> for handling form submissions, and \u003Ccode>fs\u003C\u002Fcode> for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">const apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\u003C\u002Fpre>\n\n\u003Cp>This line sets the API endpoint URL. For European users concerned with GDPR compliance, a separate EU endpoint is available.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">const shapes = [\n  {\n    type: \"rectangle\",\n    page: 1,\n    x: 54,\n    y: 540,\n    width: 504,\n    height: 108,\n    fill_color_rgb: \"245,247,250\",\n    stroke_color_rgb: \"26,72,112\",\n    stroke_width: 1,\n    tag_is_artifact: true,\n  },\n  {\n    type: \"line\",\n    page: 1,\n    x1: 72,\n    y1: 576,\n    x2: 540,\n    y2: 576,\n    stroke_color_rgb: \"26,72,112\",\n    stroke_width: 1.5,\n    tag_actual_text: \"Review section divider\",\n    tag_structure_type: \"Figure\",\n  },\n];\n\u003C\u002Fpre>\n\n\u003Cp>This array defines the shapes to be added to the PDF. Each shape object includes properties such as type, position, dimensions, and styling attributes. The \u003Ccode>tag_is_artifact\u003C\u002Fcode> and \u003Ccode>tag_actual_text\u003C\u002Fcode> fields are used for accessibility tagging.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">form.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Finput.pdf\"));\nform.append(\"shape_objects\", JSON.stringify(shapes));\nform.append(\"tag_enabled\", \"true\");\nform.append(\"output\", \"review-panel\");\n\u003C\u002Fpre>\n\n\u003Cp>These lines append the PDF file, shape definitions, and additional parameters to the form data. The \u003Ccode>tag_enabled\u003C\u002Fcode> parameter enables tagging for accessibility, and \u003Ccode>output\u003C\u002Fcode> specifies the output file name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios({\n  method: \"post\",\n  maxBodyLength: Infinity,\n  url: `${apiUrl}\u002Fpdf-with-added-shapes`,\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", \u002F\u002F Replace with your API key.\n    ...form.getHeaders(),\n  },\n  data: form,\n})\n\u003C\u002Fpre>\n\n\u003Cp>This snippet sends a POST request to the API endpoint, including the form data and headers. The \u003Ccode>Api-Key\u003C\u002Fcode> must be replaced with your actual API key.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use JavaScript to call the pdfRest Add to PDF API and add custom shapes to a PDF document. This example demonstrates how to enhance PDF files with visual elements programmatically.\u003C\u002Fp>\n\n\u003Cp>To explore further, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-added-shapes.js\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-08-19T19:29:12.000+00:00","Learn how to add vector shapes to PDF documents with JavaScript using Add to PDF API Tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Add Vector Lines and Rectangles to PDF Files with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2026-08-19T19:29:12.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:05.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to add vector shapes to PDF documents with JavaScript using Add to PDF API Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-shapes API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Add to PDF, JavaScript, PDF Generation\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Vector Lines and Rectangles to PDF Files with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3479,3480,3481,3482,3483],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-javascript-in-nodejs\u002F","How to Add Vector Lines and Rectangles to PDF Files with JavaScript in NodeJS, Tutorial | pdfRest",{"id":3488,"uuid":3489,"title":3490,"slug":3491,"html":3492,"comment_id":3488,"feature_image":48,"featured":284,"visibility":1257,"created_at":3493,"updated_at":3457,"published_at":3493,"custom_excerpt":3494,"codeinjection_head":3495,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3496,"primary_tag":3502,"url":3503,"excerpt":3494,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3504,"meta_description":3494,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a860299533c9f26b943ab5b","bf0ddb45-21ae-4664-b727-d3f791d1fafb","How to Add Vector Lines and Rectangles to PDF Files with PHP","how-to-add-vector-lines-and-rectangles-to-pdf-files-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Add Vector Lines and Rectangles to PDF Files with PHP?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F'>pdfRest Add to PDF API Tool\u003C\u002Fa> is a powerful resource for developers who need to programmatically add shapes to PDF documents. This tutorial will guide you through the process of making an API call to the Add to PDF endpoint using PHP, allowing you to enhance your PDF files with custom shapes and annotations.\u003C\u002Fp>\n\n\u003Cp>Imagine you're a developer working on a document management system that requires adding review panels or annotations to PDFs for collaborative editing. The Add to PDF API can streamline this process by enabling you to programmatically insert shapes, such as lines and rectangles, into your PDFs, thus enhancing the document's utility and readability.\u003C\u002Fp>\n\n\u003Ch2>Add Vector Lines and Rectangles to PDF Files with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">\nrequire 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = 'https:\u002F\u002Fapi.pdfrest.com';\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F $apiUrl = 'https:\u002F\u002Feu-api.pdfrest.com';\n\n\u002F\u002F Add a lightly shaded review panel and a divider line to page one.\n\u002F\u002F Coordinates are measured from the lower-left corner in PDF units (72 units = 1 inch).\n$shapeObjects = [\n    [\n        'type' =--> 'rectangle', 'page' => 1, 'x' => 54, 'y' => 540, 'width' => 504, 'height' => 108,\n        'fill_color_rgb' => '245,247,250', 'stroke_color_rgb' => '26,72,112', 'stroke_width' => 1,\n        'tag_is_artifact' => true,\n    ],\n    [\n        'type' => 'line', 'page' => 1, 'x1' => 72, 'y1' => 576, 'x2' => 540, 'y2' => 576,\n        'stroke_color_rgb' => '26,72,112', 'stroke_width' => 1.5,\n        'tag_actual_text' => 'Review section divider', 'tag_structure_type' => 'Figure',\n    ],\n];\n\n$request = new Request('POST', $apiUrl . '\u002Fpdf-with-added-shapes', [\n    'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key.\n]);\n$response = (new Client(['http_errors' => false]))->send($request, [\n    'multipart' => [\n        ['name' => 'file', 'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Finput.pdf', 'r'), 'filename' => 'input.pdf'],\n        ['name' => 'shape_objects', 'contents' => json_encode($shapeObjects)],\n        ['name' => 'tag_enabled', 'contents' => 'true'],\n        ['name' => 'output', 'contents' => 'review-panel'],\n    ],\n]);\n\necho $response->getBody() . PHP_EOL;\n\n\u002F\u002F To download the returned file, use the outputId with the get-resource-id endpoint sample.\n\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-added-shapes.php\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary libraries using \u003Ccode>require 'vendor\u002Fautoload.php';\u003C\u002Fcode> and setting up the Guzzle HTTP client for making HTTP requests.\u003C\u002Fp>\n\n\u003Cp>The API endpoint URL is set with \u003Ccode>$apiUrl = 'https:\u002F\u002Fapi.pdfrest.com';\u003C\u002Fcode>. This is the default US-based endpoint, but an EU-based endpoint is available for GDPR compliance.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>$shapeObjects\u003C\u002Fcode> array defines the shapes to be added to the PDF. Each shape is specified with attributes like \u003Ccode>type\u003C\u002Fcode>, \u003Ccode>page\u003C\u002Fcode>, \u003Ccode>x\u003C\u002Fcode>, \u003Ccode>y\u003C\u002Fcode>, \u003Ccode>width\u003C\u002Fcode>, \u003Ccode>height\u003C\u002Fcode>, and color specifications. These attributes define the appearance and placement of the shapes on the PDF.\u003C\u002Fp>\n\n\u003Cp>A \u003Ccode>Request\u003C\u002Fcode> object is created with the HTTP method 'POST' and the endpoint \u003Ccode>\u002Fpdf-with-added-shapes\u003C\u002Fcode>. The request headers include an \u003Ccode>Api-Key\u003C\u002Fcode> for authentication.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>send\u003C\u002Fcode> method of the \u003Ccode>Client\u003C\u002Fcode> object sends the request with a multipart payload. This payload includes the PDF file, shape objects, and additional parameters like \u003Ccode>tag_enabled\u003C\u002Fcode> and \u003Ccode>output\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cp>The response from the API call is captured and printed using \u003Ccode>echo $response->getBody() . PHP_EOL;\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use PHP to call the pdfRest Add to PDF API and add shapes to a PDF document. This functionality can be leveraged to enhance PDFs with annotations, review panels, or other graphical elements.\u003C\u002Fp>\n\n\u003Cp>To explore more features of the pdfRest API, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed documentation, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example demonstrates a multipart API call. For code samples using JSON payloads, visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-added-shapes.php\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-08-19T19:23:05.000+00:00","Learn how to add vector shapes to PDF documents using Add to PDF API Tool from pdfRest with Python.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-php\u002F#article\",\n      \"headline\": \"How to Add Vector Lines and Rectangles to PDF Files with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-php\u002F\",\n      \"datePublished\": \"2026-08-19T19:23:05.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:05.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to add vector shapes to PDF documents using Add to PDF API Tool from pdfRest with Python.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-shapes API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Add to PDF, PDF Generation, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Vector Lines and Rectangles to PDF Files with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3497,3498,3499,3500,3501],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-php\u002F","How to Add Vector Lines and Rectangles to PDF Files with PHP, Tutorial | pdfRest",{"id":3506,"uuid":3507,"title":3508,"slug":3509,"html":3510,"comment_id":3506,"feature_image":48,"featured":284,"visibility":1257,"created_at":3511,"updated_at":3512,"published_at":3511,"custom_excerpt":3513,"codeinjection_head":3514,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3515,"primary_tag":3521,"url":3522,"excerpt":3513,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3523,"meta_description":3513,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a85fd06533c9f26b943ab51","595cf983-1a3b-4518-aa8c-467dd575db3d","How to Add Vector Lines and Rectangles to PDF Files with Python","how-to-add-vector-lines-and-rectangles-to-pdf-files-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Add Vector Lines and Rectangles to PDF Files with Python?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F'>pdfRest Add to PDF API Tool\u003C\u002Fa> is a powerful feature that allows developers to programmatically add shapes, such as rectangles and lines, to existing PDF documents. This tutorial will guide you through the process of sending an API call to the Add to PDF endpoint using Python, enabling you to enhance your PDFs with custom graphical elements seamlessly.\u003C\u002Fp>\n\n\u003Cp>In a real-world scenario, a user might want to use the Add to PDF feature to annotate documents with review panels or highlight sections of a report for emphasis. For instance, a project manager could add shaded rectangles to a project proposal PDF to draw attention to key sections or use lines to divide different parts of a document, making it more visually organized and easier to navigate for stakeholders.\u003C\u002Fp>\n\n\u003Ch2>Add Vector Lines and Rectangles to PDF Files with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">import json\n\nimport requests\nfrom requests_toolbelt import MultipartEncoder\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# Add a lightly shaded review panel and a divider line to page one.\n# Coordinates are measured from the lower-left corner in PDF units (72 units = 1 inch).\nshape_objects = [\n    {\n        \"type\": \"rectangle\",\n        \"page\": 1,\n        \"x\": 54,\n        \"y\": 540,\n        \"width\": 504,\n        \"height\": 108,\n        \"fill_color_rgb\": \"245,247,250\",\n        \"stroke_color_rgb\": \"26,72,112\",\n        \"stroke_width\": 1,\n        \"tag_is_artifact\": True,\n    },\n    {\n        \"type\": \"line\",\n        \"page\": 1,\n        \"x1\": 72,\n        \"y1\": 576,\n        \"x2\": 540,\n        \"y2\": 576,\n        \"stroke_color_rgb\": \"26,72,112\",\n        \"stroke_width\": 1.5,\n        \"tag_actual_text\": \"Review section divider\",\n        \"tag_structure_type\": \"Figure\",\n    },\n]\n\nwith open(\"\u002Fpath\u002Fto\u002Finput.pdf\", \"rb\") as input_file:\n    multipart = MultipartEncoder(\n        fields={\n            \"file\": (\"input.pdf\", input_file, \"application\u002Fpdf\"),\n            \"shape_objects\": json.dumps(shape_objects),\n            \"tag_enabled\": \"true\",\n            \"output\": \"review-panel\",\n        }\n    )\n    response = requests.post(\n        f\"{api_url}\u002Fpdf-with-added-shapes\",\n        data=multipart,\n        headers={\n            \"Accept\": \"application\u002Fjson\",\n            \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",  # Replace with your API key.\n            \"Content-Type\": multipart.content_type,\n        },\n    )\n\nprint(f\"Response status code: {response.status_code}\")\nprint(json.dumps(response.json(), indent=2) if response.ok else response.text)\n\n# To download the returned file, use the outputId with the get-resource-id endpoint sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-added-shapes.py\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary libraries: \u003Ccode>json\u003C\u002Fcode> for handling JSON data, \u003Ccode>requests\u003C\u002Fcode> for making HTTP requests, and \u003Ccode>MultipartEncoder\u003C\u002Fcode> from \u003Ccode>requests_toolbelt\u003C\u002Fcode> for encoding multipart form data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">api_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\u003C\u002Fpre>\n\n\u003Cp>This line sets the API URL to the US-based service. If you need GDPR compliance, you can switch to the EU-based service by using the commented URL.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">shape_objects = [\n    {\n        \"type\": \"rectangle\",\n        \"page\": 1,\n        \"x\": 54,\n        \"y\": 540,\n        \"width\": 504,\n        \"height\": 108,\n        \"fill_color_rgb\": \"245,247,250\",\n        \"stroke_color_rgb\": \"26,72,112\",\n        \"stroke_width\": 1,\n        \"tag_is_artifact\": True,\n    },\n    {\n        \"type\": \"line\",\n        \"page\": 1,\n        \"x1\": 72,\n        \"y1\": 576,\n        \"x2\": 540,\n        \"y2\": 576,\n        \"stroke_color_rgb\": \"26,72,112\",\n        \"stroke_width\": 1.5,\n        \"tag_actual_text\": \"Review section divider\",\n        \"tag_structure_type\": \"Figure\",\n    },\n]\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>shape_objects\u003C\u002Fcode> list contains dictionaries defining the shapes to be added to the PDF. Each dictionary specifies the shape type, position, dimensions, color, and additional tagging information.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">with open(\"\u002Fpath\u002Fto\u002Finput.pdf\", \"rb\") as input_file:\n    multipart = MultipartEncoder(\n        fields={\n            \"file\": (\"input.pdf\", input_file, \"application\u002Fpdf\"),\n            \"shape_objects\": json.dumps(shape_objects),\n            \"tag_enabled\": \"true\",\n            \"output\": \"review-panel\",\n        }\n    )\n\u003C\u002Fpre>\n\n\u003Cp>This snippet opens the input PDF file and creates a \u003Ccode>MultipartEncoder\u003C\u002Fcode> object with the file and shape data. The \u003Ccode>tag_enabled\u003C\u002Fcode> field is set to \"true\" to enable tagging, and the \u003Ccode>output\u003C\u002Fcode> field specifies the output file name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(\n    f\"{api_url}\u002Fpdf-with-added-shapes\",\n    data=multipart,\n    headers={\n        \"Accept\": \"application\u002Fjson\",\n        \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",  # Replace with your API key.\n        \"Content-Type\": multipart.content_type,\n    },\n)\n\u003C\u002Fpre>\n\n\u003Cp>The API call is made using \u003Ccode>requests.post()\u003C\u002Fcode>, sending the multipart data to the endpoint. Headers include the API key and content type.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use Python to send an API call to the pdfRest Add to PDF endpoint, allowing you to add shapes to a PDF document. This powerful feature can be used to enhance documents with custom graphics and annotations.\u003C\u002Fp>\n\n\u003Cp>To explore more functionalities, try out all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. Note that this is an example of a multipart API call, and code samples using JSON payloads can be found \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-added-shapes.py\">here\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-08-19T18:59:18.000+00:00","2026-09-02T18:26:49.000+00:00","Learn how to use Add to PDF API Tool from pdfRest with Python to add vector shapes to PDF documents.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-python\u002F#article\",\n      \"headline\": \"How to Add Vector Lines and Rectangles to PDF Files with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-python\u002F\",\n      \"datePublished\": \"2026-08-19T18:59:18.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:05.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use Add to PDF API Tool from pdfRest with Python to add vector shapes to PDF documents.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Add to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-added-shapes API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fadd-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Add to PDF, PDF Generation, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Add Vector Lines and Rectangles to PDF Files with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3516,3517,3518,3519,3520],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1842,"name":1843,"slug":1844,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-add-vector-lines-and-rectangles-to-pdf-files-with-python\u002F","How to Add Vector Lines and Rectangles to PDF Files with Python, Tutorial | pdfRest",{"id":3525,"uuid":3526,"title":3527,"slug":3528,"html":3529,"comment_id":3525,"feature_image":48,"featured":284,"visibility":1257,"created_at":3530,"updated_at":3512,"published_at":3530,"custom_excerpt":3531,"codeinjection_head":3532,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3533,"primary_tag":3538,"url":3539,"excerpt":3531,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3540,"meta_description":3531,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"69ebb699533c9f26b943a9d7","32df503a-d77d-4fd7-8443-c7b797392dd4","How to Apply TDM Reservations to PDF in .NET with C#","how-to-apply-tdm-reservations-to-pdf-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use TDM Reserve PDF with C#?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Ftdm-reserve-pdf\u002F\">pdfRest TDM Reserve PDF API Tool\u003C\u002Fa> provides .NET developers with a robust method to shield digital documents from automated scraping bots. This tutorial demonstrates how to construct and send an API call to the TDM Reserve endpoint using C#. By utilizing this endpoint, you can automatically inject compliant TDMRep metadata into your PDFs, effectively telling AI training models and web crawlers to bypass your proprietary content.\u003C\u002Fp>\n\n\u003Cp>For example, a financial services enterprise might use a C# application to generate and distribute proprietary market analysis reports to their premium clients. To ensure these highly valuable insights aren't scraped and summarized by third-party AI tools, the development team can implement the TDM Reserve API as a final step in their document generation pipeline. This guarantees every outgoing report is embedded with a machine-readable \"Do Not Mine\" directive, securing the firm's competitive advantage and intellectual property.\u003C\u002Fp>\n\n\u003Ch2>TDM Reserve PDF with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">\u002F*\n * What this sample does:\n * - Applies TDM rights metadata to a PDF via multipart\u002Fform-data.\n * - Routed from Program.cs as: `dotnet run -- tdm-reserved-pdf-multipart \u003Cinputfile>`.\n *\n * Setup (environment):\n * - Copy .env.example to .env\n * - Set PDFREST_API_KEY=your_api_key_here\n * - Optional: set PDFREST_URL to override the API region. For EU\u002FGDPR compliance and proximity, use:\n *     PDFREST_URL=https:\u002F\u002Feu-api.pdfrest.com\n *   For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\n * Usage:\n *   dotnet run -- tdm-reserved-pdf-multipart \u002Fpath\u002Fto\u002Finput.pdf\n *\n * Output:\n * - Prints the JSON response. Validation errors (args\u002Fenv) exit non-zero.\n *\u002F\n\nusing System.Text;\n\nnamespace Samples.EndpointExamples.MultipartPayload\n{\n    public static class TdmReservedPdf\n    {\n        public static async Task Execute(string[] args)\n        {\n            if (args == null || args.Length \u003C 1)\n            {\n                Console.Error.WriteLine(\"tdm-reserved-pdf-multipart requires \u003Cinputfile>\");\n                Environment.Exit(1);\n                return;\n            }\n            var inputPath = args[0];\n            if (!File.Exists(inputPath))\n            {\n                Console.Error.WriteLine($\"File not found: {inputPath}\");\n                Environment.Exit(1);\n                return;\n            }\n            var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\n            if (string.IsNullOrWhiteSpace(apiKey))\n            {\n                Console.Error.WriteLine(\"Missing required environment variable: PDFREST_API_KEY\");\n                Environment.Exit(1);\n                return;\n            }\n            var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n\n            using (var httpClient = new HttpClient { BaseAddress = new Uri(baseUrl) })\n            using (var tdmReservedPdfRequest = new HttpRequestMessage(HttpMethod.Post, \"tdm-reserved-pdf\"))\n            {\n                tdmReservedPdfRequest.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\n                tdmReservedPdfRequest.Headers.Accept.Add(new(\"application\u002Fjson\"));\n                var multipartContent = new MultipartFormDataContent();\n\n                var byteArray = File.ReadAllBytes(inputPath);\n                var byteAryContent = new ByteArrayContent(byteArray);\n                multipartContent.Add(byteAryContent, \"file\", Path.GetFileName(inputPath));\n                byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Foctet-stream\");\n\n                var policyValue = new ByteArrayContent(Encoding.UTF8.GetBytes(\"https:\u002F\u002Fexample.com\u002Ftdm-policy\"));\n                multipartContent.Add(policyValue, \"policy\");\n\n                tdmReservedPdfRequest.Content = multipartContent;\n                var response = await httpClient.SendAsync(tdmReservedPdfRequest);\n                var apiResult = await response.Content.ReadAsStringAsync();\n\n                Console.WriteLine(\"TDM metadata response received.\");\n                Console.WriteLine(apiResult);\n            }\n        }\n    }\n}\n\u003C\u002Finputfile>\u003C\u002Finputfile>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Ftdm-reserved-pdf.cs\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by checking if the input arguments are valid:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">if (args == null || args.Length \u003C 1)\n{\n    Console.Error.WriteLine(\"tdm-reserved-pdf-multipart requires \u003Cinputfile>\");\n    Environment.Exit(1);\n    return;\n}\n\u003C\u002Finputfile>\u003C\u002Fpre>\n\n\u003Cp>This ensures that a file path is provided as an argument. If not, it exits with an error message.\u003C\u002Fp>\n\n\u003Cp>Next, it verifies the existence of the specified file:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var inputPath = args[0];\nif (!File.Exists(inputPath))\n{\n    Console.Error.WriteLine($\"File not found: {inputPath}\");\n    Environment.Exit(1);\n    return;\n}\n\u003C\u002Fpre>\n\n\u003Cp>This step is crucial to avoid processing a non-existent file.\u003C\u002Fp>\n\n\u003Cp>The code then retrieves the API key from environment variables:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\nif (string.IsNullOrWhiteSpace(apiKey))\n{\n    Console.Error.WriteLine(\"Missing required environment variable: PDFREST_API_KEY\");\n    Environment.Exit(1);\n    return;\n}\n\u003C\u002Fpre>\n\n\u003Cp>Without a valid API key, the request cannot be authenticated.\u003C\u002Fp>\n\n\u003Cp>The base URL for the API is set, with an option to override it:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n\u003C\u002Fpre>\n\n\u003Cp>This allows for regional API endpoint customization.\u003C\u002Fp>\n\n\u003Cp>The code constructs an HTTP POST request with multipart form data:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(baseUrl) })\nusing (var tdmReservedPdfRequest = new HttpRequestMessage(HttpMethod.Post, \"tdm-reserved-pdf\"))\n{\n    tdmReservedPdfRequest.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\n    tdmReservedPdfRequest.Headers.Accept.Add(new(\"application\u002Fjson\"));\n    var multipartContent = new MultipartFormDataContent();\n\n    var byteArray = File.ReadAllBytes(inputPath);\n    var byteAryContent = new ByteArrayContent(byteArray);\n    multipartContent.Add(byteAryContent, \"file\", Path.GetFileName(inputPath));\n    byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Foctet-stream\");\n\n    var policyValue = new ByteArrayContent(Encoding.UTF8.GetBytes(\"https:\u002F\u002Fexample.com\u002Ftdm-policy\"));\n    multipartContent.Add(policyValue, \"policy\");\n\n    tdmReservedPdfRequest.Content = multipartContent;\n    var response = await httpClient.SendAsync(tdmReservedPdfRequest);\n    var apiResult = await response.Content.ReadAsStringAsync();\n\n    Console.WriteLine(\"TDM metadata response received.\");\n    Console.WriteLine(apiResult);\n}\n\u003C\u002Fpre>\n\n\u003Cp>This snippet sends the PDF file along with a policy URL to the API, receiving a JSON response with the result.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to make a multipart API call to the pdfRest TDM Reserve PDF endpoint using C#. This process involves setting up environment variables, preparing the file and policy data, and handling the API response. To explore more, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further details, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Ftdm-reserved-pdf.cs\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-04-24T18:29:45.000+00:00","Learn how to use C# with pdfRest TDM Reserve PDF API to protect documents from AI data mining.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Apply TDM Reservations to PDF in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-in-net-with-c\u002F\",\n      \"datePublished\": \"2026-04-24T18:29:45.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:06.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use C# with pdfRest TDM Reserve PDF API to protect documents from AI data mining.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"TDM Reserve PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Ftdm-reserve-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Ftdm-reserved-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Ftdm-reserve-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, TDM Reserve PDF\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Apply TDM Reservations to PDF in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3534,3535,3536,3537],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2029,"name":2030,"slug":2031,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-apply-tdm-reservations-to-pdf-in-net-with-c\u002F","How to Apply TDM Reservations to PDF in .NET with C#, Tutorial | pdfRest",{"id":3542,"uuid":3543,"title":3544,"slug":3545,"html":3546,"comment_id":3542,"feature_image":48,"featured":284,"visibility":1257,"created_at":3547,"updated_at":3548,"published_at":3547,"custom_excerpt":3549,"codeinjection_head":3550,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3551,"primary_tag":3556,"url":3557,"excerpt":3549,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3558,"meta_description":3549,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"69ebb723533c9f26b943a9eb","7db1f93e-c3bf-456d-a6fe-ef02899673ff","How to Apply TDM Reservations to PDF with cURL","how-to-apply-tdm-reservations-to-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use TDM Reserve PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Ftdm-reserve-pdf\u002F\">pdfRest TDM Reserve PDF API tool\u003C\u002Fa> equips users with the ability to secure their PDF documents against unauthorized data extraction and AI scraping. This tutorial offers a step-by-step guide on how to send a request to the TDM Reserve PDF endpoint using cURL, a highly versatile command-line utility for transferring data. By executing this API call, you can rapidly inject standardized W3C TDMRep metadata into your files, formally asserting your right to opt out of automated text and data mining.\u003C\u002Fp>\n\n\u003Cp>For instance, a system administrator managing a large public archive of legal records or historical documents may need to ensure these files aren't harvested by AI companies to train language models. By incorporating the TDM Reserve PDF API into a simple bash script via cURL, they can easily batch process thousands of documents. This embeds a strict \"No-AI\" policy URL directly into the metadata of the entire repository, legally safeguarding the content before it is synced to a public-facing web server.\u003C\u002Fp>\n\n\u003Ch2>TDM Reserve PDF with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# This request applies metadata declaring Text and Data Mining (TDM) rights.\ncurl -X POST \"$API_URL\u002Ftdm-reserved-pdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_tdm_reserved_pdf_out\" \\\n  -F \"policy=https:\u002F\u002Fexample.com\u002Ftdm-policy\" \\\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Ftdm-reserved-pdf.sh\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by setting the \u003Ccode>API_URL\u003C\u002Fcode> variable to the US-based API service endpoint:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">API_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\u003C\u002Fpre>\n\n\u003Cp>This is the default endpoint for global use. If you are located in Europe and require GDPR compliance, you can switch to the EU-based service by uncommenting the alternative URL:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\"># API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\u003C\u002Fpre>\n\n\u003Cp>The cURL command is used to make a POST request to the \u003Ccode>\u002Ftdm-reserved-pdf\u003C\u002Fcode> endpoint:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"$API_URL\u002Ftdm-reserved-pdf\"\n\u003C\u002Fpre>\n\n\u003Cp>The headers specify that the request accepts JSON responses and uses multipart\u002Fform-data for the content type:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\n-H \"Content-Type: multipart\u002Fform-data\"\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>Api-Key\u003C\u002Fcode> header is crucial for authentication. Replace \u003Ccode>xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\u003C\u002Fcode> with your actual API key:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>-F\u003C\u002Fcode> options specify the form data to be sent in the request. The \u003Ccode>file\u003C\u002Fcode> parameter uploads the PDF file from your local system:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>output\u003C\u002Fcode> parameter defines the name of the output file:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_tdm_reserved_pdf_out\"\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>policy\u003C\u002Fcode> parameter specifies the URL of the TDM policy:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"policy=https:\u002F\u002Fexample.com\u002Ftdm-policy\"\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to make an API call to the TDM Reserve PDF endpoint using cURL. This example demonstrated how to apply TDM rights metadata to a PDF document. To explore more functionalities, try out all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further reading, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Ftdm-reserved-pdf.sh\">here\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-04-24T18:32:03.000+00:00","2026-09-02T18:26:51.000+00:00","Learn how to use pdfRest TDM Reserve PDF API with cURL to protect documents from AI data scraping.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Apply TDM Reservations to PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-curl\u002F\",\n      \"datePublished\": \"2026-04-24T18:32:03.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:06.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest TDM Reserve PDF API with cURL to protect documents from AI data scraping.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"TDM Reserve PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Ftdm-reserve-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Ftdm-reserved-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Ftdm-reserve-pdf\"\n        }\n      ],\n      \"keywords\": \"TDM Reserve PDF, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Apply TDM Reservations to PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3552,3553,3554,3555],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2029,"name":2030,"slug":2031,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-apply-tdm-reservations-to-pdf-with-curl\u002F","How to Apply TDM Reservations to PDF with cURL, Tutorial | pdfRest",{"id":3560,"uuid":3561,"title":3562,"slug":3563,"html":3564,"comment_id":3560,"feature_image":48,"featured":284,"visibility":1257,"created_at":3565,"updated_at":3548,"published_at":3565,"custom_excerpt":3566,"codeinjection_head":3567,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3568,"primary_tag":3573,"url":3574,"excerpt":3566,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3575,"meta_description":3566,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"69ebb970533c9f26b943a9f5","752c2e87-c70f-4a4a-8751-8cf3f9285791","How to Apply TDM Reservations to PDF with Java","how-to-apply-tdm-reservations-to-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use TDM Reserve PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Ftdm-reserve-pdf\u002F\">pdfRest TDM Reserve PDF API Tool\u003C\u002Fa> provides a vital mechanism for developers to protect intellectual property from unauthorized artificial intelligence ingestion. This tutorial demonstrates how to send an API call to the TDM Reserve PDF endpoint using Java. By implementing this request within your Java applications, you can automatically embed machine-readable metadata into your documents to explicitly opt out of automated text and data mining (TDM), ensuring your rights are legally asserted.\u003C\u002Fp>\n\n\u003Cp>Consider a digital publishing platform that hosts premium academic journals or proprietary market research. To prevent commercial web crawlers from scraping these valuable PDF documents to train Large Language Models (LLMs) for free, the platform can automate the TDM Reserve PDF API. This applies a universal \"No-AI\" policy to all outgoing files, guaranteeing that the content remains protected and compliant with international copyright directives without requiring manual intervention.\u003C\u002Fp>\n\n\u003Ch2>TDM Reserve PDF with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class TDMReservedPDF {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"policy\", \"https:\u002F\u002Fexample.com\u002Ftdm-policy\")\n            .addFormDataPart(\"output\", \"pdfrest_tdm_reserved_pdf\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Ftdm-reserved-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"TDM metadata result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FTDMReservedPDF.java\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary libraries such as Dotenv for environment variable management, OkHttp for HTTP requests, and JSONObject for JSON manipulation.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\u003C\u002Fpre>\n\n\u003Cp>This line sets the API endpoint URL. You have the option to switch to an EU-based endpoint for GDPR compliance by uncommenting the alternative URL.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\u003C\u002Fpre>\n\n\u003Cp>This specifies the default path to the PDF file that you will be sending in the API call. You can modify this path or pass it as an argument when running the program.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\u003C\u002Fpre>\n\n\u003Cp>Your API key is specified here. It can also be stored in an environment variable named PDFREST_API_KEY.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">RequestBody requestBody = new MultipartBody.Builder()\n    .setType(MultipartBody.FORM)\n    .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n    .addFormDataPart(\"policy\", \"https:\u002F\u002Fexample.com\u002Ftdm-policy\")\n    .addFormDataPart(\"output\", \"pdfrest_tdm_reserved_pdf\")\n    .build();\n\u003C\u002Fpre>\n\n\u003Cp>This snippet creates a multipart form request body, which includes the PDF file, a policy URL, and an output specification. The 'file' part attaches the PDF file, 'policy' specifies the TDM policy URL, and 'output' defines the desired output format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Request request = new Request.Builder()\n    .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n    .url(API_URL + \"\u002Ftdm-reserved-pdf\")\n    .post(requestBody)\n    .build();\n\u003C\u002Fpre>\n\n\u003Cp>This block constructs the HTTP request, setting the API key in the header and specifying the endpoint URL. The request body is attached using the POST method.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to send an API call to the TDM Reserve PDF endpoint using Java. This process allows you to reserve PDFs for TDM purposes, ensuring compliance with policies and legal requirements. To further explore the capabilities of the pdfRest API Tools, try out the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FTDMReservedPDF.java\">here\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-04-24T18:41:52.000+00:00","Learn how to work with pdfRest TDM Reserve PDF API and Java to protect files from AI data scraping.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Apply TDM Reservations to PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-java\u002F\",\n      \"datePublished\": \"2026-04-24T18:41:52.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:06.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to work with pdfRest TDM Reserve PDF API and Java to protect files from AI data scraping.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"TDM Reserve PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Ftdm-reserve-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Ftdm-reserved-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Ftdm-reserve-pdf\"\n        }\n      ],\n      \"keywords\": \"Java, TDM Reserve PDF\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Apply TDM Reservations to PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3569,3570,3571,3572],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2029,"name":2030,"slug":2031,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-apply-tdm-reservations-to-pdf-with-java\u002F","How to Apply TDM Reservations to PDF with Java, Tutorial | pdfRest",{"id":3577,"uuid":3578,"title":3579,"slug":3580,"html":3581,"comment_id":3577,"feature_image":48,"featured":284,"visibility":1257,"created_at":3582,"updated_at":3583,"published_at":3582,"custom_excerpt":3584,"codeinjection_head":3585,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3586,"primary_tag":3591,"url":3592,"excerpt":3584,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3593,"meta_description":3584,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"69ebb6c0533c9f26b943a9e1","da0930be-647f-488b-b8a5-121812409bc4","How to Apply TDM Reservations to PDF with JavaScript in NodeJS","how-to-apply-tdm-reservations-to-pdf-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use TDM Reserve PDF with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Ftdm-reserve-pdf\u002F\">pdfRest TDM Reserve PDF API Tool\u003C\u002Fa> offers developers a seamless way to embed protective metadata into PDF files, actively restricting automated text and data mining (TDM). This tutorial walks you through sending an API call to the TDM Reserve endpoint using JavaScript. By integrating this functionality into your frontend applications or Node.js backends, you can programmatically establish machine-readable boundaries that prevent AI crawlers from ingesting your digital assets without explicit permission.\u003C\u002Fp>\n\n\u003Cp>Imagine a SaaS platform built with JavaScript that empowers independent authors to self-publish e-books and digital portfolios. To give creators peace of mind that their original work won't be harvested to train public Large Language Models, the platform’s developers can trigger the TDM Reserve PDF API during the file upload process. This automatically stamps every new document with a legally recognized W3C TDMRep policy, securing the creators' intellectual property right at the point of distribution.\u003C\u002Fp>\n\n\u003Ch2>TDM Reserve PDF with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to apply TDM rights metadata to a PDF.\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n\u002F\u002F Create a new form data object and append the PDF file and TDM policy to it.\nvar tdmReservedPdfData = new FormData();\ntdmReservedPdfData.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ntdmReservedPdfData.append('policy', 'https:\u002F\u002Fexample.com\u002Ftdm-policy');\ntdmReservedPdfData.append('output', 'pdfrest_tdm_reserved_pdf');\n\n\u002F\u002F define configuration options for axios request\nvar tdmReservedPdfConfig = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: apiUrl + '\u002Ftdm-reserved-pdf',\n  headers: {\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...tdmReservedPdfData.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : tdmReservedPdfData \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(tdmReservedPdfConfig)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error);\n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Ftdm-reserved-pdf.js\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary modules: \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests, \u003Ccode>form-data\u003C\u002Fcode> for handling form submissions, and \u003Ccode>fs\u003C\u002Fcode> for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>apiUrl\u003C\u002Fcode> variable is set to the US-based API endpoint by default. For users in Europe, there's an option to switch to the EU-based service for GDPR compliance.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\u003C\u002Fpre>\n\n\u003Cp>A \u003Ccode>FormData\u003C\u002Fcode> object is created to hold the PDF file and the TDM policy URL. The \u003Ccode>append\u003C\u002Fcode> method is used to add these fields to the form data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var tdmReservedPdfData = new FormData();\ntdmReservedPdfData.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ntdmReservedPdfData.append('policy', 'https:\u002F\u002Fexample.com\u002Ftdm-policy');\ntdmReservedPdfData.append('output', 'pdfrest_tdm_reserved_pdf');\n\u003C\u002Fpre>\n\n\u003Cp>The configuration for the \u003Ccode>axios\u003C\u002Fcode> request is defined, specifying the HTTP method, URL, headers (including the API key), and the form data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var tdmReservedPdfConfig = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: apiUrl + '\u002Ftdm-reserved-pdf',\n  headers: {\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...tdmReservedPdfData.getHeaders()\n  },\n  data : tdmReservedPdfData\n};\n\u003C\u002Fpre>\n\n\u003Cp>The request is sent using \u003Ccode>axios\u003C\u002Fcode>, and the response or any errors are logged to the console.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(tdmReservedPdfConfig)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error);\n});\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to make a multipart API call to the pdfRest TDM Reserve PDF endpoint using JavaScript. This allows you to apply TDM rights metadata to a PDF document programmatically. To explore more functionalities, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further details, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Ftdm-reserved-pdf.js\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-04-24T18:30:24.000+00:00","2026-09-02T18:26:52.000+00:00","Learn how to protect documents from AI data mining using JavaScript with pdfRest TDM Reserve PDF API.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Apply TDM Reservations to PDF with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2026-04-24T18:30:24.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:06.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to protect documents from AI data mining using JavaScript with pdfRest TDM Reserve PDF API.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"TDM Reserve PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Ftdm-reserve-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Ftdm-reserved-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Ftdm-reserve-pdf\"\n        }\n      ],\n      \"keywords\": \"JavaScript, TDM Reserve PDF\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Apply TDM Reservations to PDF with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3587,3588,3589,3590],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2029,"name":2030,"slug":2031,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-apply-tdm-reservations-to-pdf-with-javascript-in-nodejs\u002F","How to Apply TDM Reservations to PDF with JavaScript in NodeJS, Tutorial | pdfRest",{"id":3595,"uuid":3596,"title":3597,"slug":3598,"html":3599,"comment_id":3595,"feature_image":48,"featured":284,"visibility":1257,"created_at":3600,"updated_at":3583,"published_at":3600,"custom_excerpt":3601,"codeinjection_head":3602,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3603,"primary_tag":3608,"url":3609,"excerpt":3601,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3610,"meta_description":3601,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"69ebb5a9533c9f26b943a9cd","bcff0886-1ccd-4a47-b2fd-1ce8049fc3ac","How to Apply TDM Reservations to PDF with PHP","how-to-apply-tdm-reservations-to-pdf-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use TDM Reserve PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Ftdm-reserve-pdf\u002F\">pdfRest TDM Reserve PDF API Tool\u003C\u002Fa> is an essential resource for PHP developers looking to defend their digital content against unauthorized text and data mining (TDM). This tutorial will show you how to execute an API call to the TDM Reserve PDF endpoint using PHP. By incorporating this code into your server-side scripts, you can effortlessly embed standardized metadata into your PDF files, explicitly opting them out of AI training datasets and automated web scraping.\u003C\u002Fp>\n\n\u003Cp>Consider a media organization operating a PHP-based Content Management System (CMS) to distribute investigative journalism and exclusive reports. To ensure their original work is not freely harvested by AI companies, developers can integrate the TDM Reserve PDF API directly into the CMS upload workflow. Whenever a new PDF is published to the site, the script automatically applies a machine-readable TDM policy, safeguarding the organization's copyright and ensuring compliance with modern digital rights regulations like the EU CDSM Directive.\u003C\u002Fp>\n\n\u003Ch2>TDM Reserve PDF with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">\nrequire 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\n$headers = [\n  'Api-Key' =--> 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile', \u002F\u002F Set the filename for the file to be processed, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'policy', \u002F\u002F Specify the field name for the policy string.\n      'contents' => 'https:\u002F\u002Fexample.com\u002Ftdm-policy' \u002F\u002F Set a dummy URL policy value.\n    ],\n    [\n      'name' => 'output', \u002F\u002F Specify the field name for the output option.\n      'contents' => 'pdfrest_tdm_reserved_pdf' \u002F\u002F Set the value for the output option.\n    ]\n  ]\n];\n\n$request = new Request('POST', $apiUrl.'\u002Ftdm-reserved-pdf', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the PDF with TDM rights metadata.\n\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Ftdm-reserved-pdf.php\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>First, the code includes the Guzzle HTTP client library using \u003Ccode>require 'vendor\u002Fautoload.php';\u003C\u002Fcode>. This allows us to use Guzzle for making HTTP requests.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>use\u003C\u002Fcode> statements import necessary classes from the Guzzle library: \u003Ccode>Client\u003C\u002Fcode> for creating HTTP clients, \u003Ccode>Request\u003C\u002Fcode> for HTTP requests, and \u003Ccode>Utils\u003C\u002Fcode> for working with streams.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>$apiUrl\u003C\u002Fcode> variable sets the API endpoint URL. By default, it points to the US-based service, but there's an option to switch to the EU-based service for GDPR compliance by uncommenting the alternative URL.\u003C\u002Fp>\n\n\u003Cp>We create a new Guzzle client instance with \u003Ccode>$client = new Client();\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>$headers\u003C\u002Fcode> array includes the API key for authentication. Replace \u003Ccode>'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\u003C\u002Fcode> with your actual API key.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>$options\u003C\u002Fcode> array configures the multipart request. It includes fields for the file, policy, and output options:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Ccode>file\u003C\u002Fcode>: Specifies the file to be processed. The \u003Ccode>Utils::tryFopen()\u003C\u002Fcode> function opens the file for reading.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>policy\u003C\u002Fcode>: Contains a URL to the TDM policy, which defines the rights and permissions for text and data mining.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>output\u003C\u002Fcode>: Sets the output format, in this case, \u003Ccode>'pdfrest_tdm_reserved_pdf'\u003C\u002Fcode>.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>A new HTTP POST request is created with \u003Ccode>$request = new Request('POST', $apiUrl.'\u002Ftdm-reserved-pdf', $headers);\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cp>The request is sent asynchronously using \u003Ccode>$client->sendAsync($request, $options)->wait();\u003C\u002Fcode>, and the response body is outputted with \u003Ccode>echo $res->getBody();\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we demonstrated how to use PHP to send an API request to the pdfRest TDM Reserve PDF endpoint, allowing you to embed TDM rights metadata into your PDF files. This capability is crucial for ensuring compliance with TDM rights management policies.\u003C\u002Fp>\n\n\u003Cp>To explore more features and tools offered by pdfRest, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> for demos. For detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Ftdm-reserved-pdf.php\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-04-24T18:25:45.000+00:00","Learn how to protect documents from AI data mining using pdfRest TDM Reserve PDF API with PHP.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-php\u002F#article\",\n      \"headline\": \"How to Apply TDM Reservations to PDF with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-php\u002F\",\n      \"datePublished\": \"2026-04-24T18:25:45.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:06.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to protect documents from AI data mining using pdfRest TDM Reserve PDF API with PHP.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"TDM Reserve PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Ftdm-reserve-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Ftdm-reserved-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Ftdm-reserve-pdf\"\n        }\n      ],\n      \"keywords\": \"PHP, TDM Reserve PDF\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Apply TDM Reservations to PDF with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3604,3605,3606,3607],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2029,"name":2030,"slug":2031,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-apply-tdm-reservations-to-pdf-with-php\u002F","How to Apply TDM Reservations to PDF with PHP, Tutorial | pdfRest",{"id":3612,"uuid":3613,"title":3614,"slug":3615,"html":3616,"comment_id":3612,"feature_image":48,"featured":284,"visibility":1257,"created_at":3617,"updated_at":3618,"published_at":3617,"custom_excerpt":3619,"codeinjection_head":3620,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3621,"primary_tag":3626,"url":3627,"excerpt":3619,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3628,"meta_description":3619,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"69eba6a6533c9f26b943a9c3","465229e6-3f85-4539-9444-1488f35f2320","How to Apply TDM Reservations to PDF with Python","how-to-apply-tdm-reservations-to-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use TDM Reserve PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Ftdm-reserve-pdf\u002F\">pdfRest TDM Reserve PDF API Tool\u003C\u002Fa> provides Python developers with a straightforward method to enforce intellectual property rights against automated data mining. This tutorial will walk you through how to construct and execute an API request to the TDM Reserve endpoint using Python. By building this functionality into your document processing scripts, you can programmatically inject W3C-compliant metadata into your PDFs, effectively blocking unauthorized AI scrapers and web crawlers from harvesting your content.\u003C\u002Fp>\n\n\u003Cp>In a practical setting, a data engineering team at an academic publisher might use Python to manage a massive library of scientific research and journals. Before distributing these PDFs online or to third-party databases, they need to ensure the documents cannot be freely ingested to train commercial LLMs. By writing a Python script that calls the TDM Reserve PDF API, the team can rapidly process the entire repository, embedding a machine-readable \"opt-out\" policy into every file to legally protect the institution's proprietary research at scale.\u003C\u002Fp>\n\n\u003Ch2>TDM Reserve PDF with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\n# This sample applies metadata on a PDF declaring Text and Data Mining (TDM) rights.\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\n\ntdm_reserved_pdf_endpoint_url = api_url+'\u002Ftdm-reserved-pdf'\n\n# The \u002Ftdm-reserved-pdf endpoint can take a single PDF file or id as input.\nmp_encoder_tdm_reserved_pdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'policy': 'https:\u002F\u002Fexample.com\u002Ftdm-policy',\n        'output' : 'example_tdm_reserved_pdf_out'\n    }\n)\n\n# Let's set the headers that the tdm-reserved-pdf endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_tdm_reserved_pdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to tdm-reserved-pdf endpoint...\")\nresponse = requests.post(tdm_reserved_pdf_endpoint_url, data=mp_encoder_tdm_reserved_pdf, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Ftdm-reserved-pdf.py\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary libraries: \u003Ccode>requests_toolbelt\u003C\u002Fcode> for handling multipart form data, \u003Ccode>requests\u003C\u002Fcode> for making HTTP requests, and \u003Ccode>json\u003C\u002Fcode> for handling JSON data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">api_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\u003C\u002Fpre>\n\n\u003Cp>This line sets the base URL for the API. The default is the US-based service, but you can switch to the EU-based service for GDPR compliance by uncommenting the alternative URL.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_tdm_reserved_pdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'policy': 'https:\u002F\u002Fexample.com\u002Ftdm-policy',\n        'output' : 'example_tdm_reserved_pdf_out'\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>MultipartEncoder\u003C\u002Fcode> is used to prepare the data for the POST request. The \u003Ccode>fields\u003C\u002Fcode> dictionary includes:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Ccode>file\u003C\u002Fcode>: The PDF file to which TDM rights will be applied. It is opened in binary mode.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>policy\u003C\u002Fcode>: A URL pointing to the TDM policy document.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>output\u003C\u002Fcode>: The desired name for the output file.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_tdm_reserved_pdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>headers\u003C\u002Fcode> dictionary specifies the request headers. The \u003Ccode>Content-Type\u003C\u002Fcode> is automatically set by the \u003Ccode>MultipartEncoder\u003C\u002Fcode>. The \u003Ccode>Api-Key\u003C\u002Fcode> is a placeholder for your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(tdm_reserved_pdf_endpoint_url, data=mp_encoder_tdm_reserved_pdf, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This line sends a POST request to the TDM Reserve PDF endpoint with the prepared data and headers.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to apply TDM rights to a PDF using the pdfRest API with Python. This can be particularly useful for automating the preparation of documents for text and data mining. To explore more, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further details, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example demonstrates a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Ftdm-reserved-pdf.py\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-04-24T17:21:42.000+00:00","2026-09-02T18:26:53.000+00:00","Learn how to use pdfRest TDM Reserve PDF API with Python to protect files from AI data mining.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Apply TDM Reservations to PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-python\u002F\",\n      \"datePublished\": \"2026-04-24T17:21:42.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:07.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest TDM Reserve PDF API with Python to protect files from AI data mining.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"TDM Reserve PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Ftdm-reserve-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Ftdm-reserved-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Ftdm-reserve-pdf\"\n        }\n      ],\n      \"keywords\": \"Python, TDM Reserve PDF\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Apply TDM Reservations to PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-apply-tdm-reservations-to-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3622,3623,3624,3625],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2029,"name":2030,"slug":2031,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-apply-tdm-reservations-to-pdf-with-python\u002F","How to Apply TDM Reservations to PDF with Python, Tutorial | pdfRest",{"id":3630,"uuid":3631,"title":3632,"slug":3633,"html":3634,"comment_id":3630,"feature_image":48,"featured":284,"visibility":1257,"created_at":3635,"updated_at":3636,"published_at":3635,"custom_excerpt":3637,"codeinjection_head":3638,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3639,"primary_tag":3646,"url":3647,"excerpt":3637,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3648,"meta_description":3637,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ea02bb533c9f26b94366f4","192198b1-778a-4996-94f8-7e762696fa67","How to Change PDF Password in .NET with C#","how-to-change-pdf-password-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Change PDF Password with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F'>Encrypt PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to secure their PDF documents programmatically. By using this tool, you can encrypt PDF files to ensure that sensitive information is protected and only accessible to individuals with the correct password. For documents that already have a password set, you can also use this tool to change its password.  This tutorial will guide you through the process of sending an API call to Encrypt PDF using C# programming language, which is a common language for backend development and scripting in Windows environments.\u003C\u002Fp>\n\n\u003Cp>Imagine you're working on a project with a client who sends you a confidential document, like a new product design or a marketing strategy. You need to access the document to collaborate, but also ensure its security. You can utilize the Encrypt PDF API to set a new password on the document before saving or sharing it further within your team. This two-step process ensures you can collaborate on the document while keeping the information secure, even if someone intercepts it during transmission.\u003C\u002Fp>\n\n\u003Ch2>Change PDF Password with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"encrypted-pdf\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArrayOption1 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"CURRENTPASSWORD\"));\n        multipartContent.Add(byteArrayOption1, \"current_open_password\");\n  \n        var byteArrayOption2 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"NEWPASSWORD\"));\n        multipartContent.Add(byteArrayOption2, \"new_open_password\");\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fencrypted-pdf.cs\">pdfRest C# Sample Code\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by creating an instance of \u003Ccode class=\"language-csharp\">HttpClient\u003C\u002Fcode> with the base address set to the pdfRest API endpoint. A new \u003Ccode class=\"language-csharp\">HttpRequestMessage\u003C\u002Fcode> is then constructed for the POST method to the 'encrypted-pdf' endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"encrypted-pdf\"))\n    {\n        ...\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>The API key is added to the request headers, which is required for authentication. The content type that the client accepts is also specified as 'application\u002Fjson'.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\nrequest.Headers.Accept.Add(new(\"application\u002Fjson\"));\n\u003C\u002Fpre>\n\n\u003Cp>A \u003Ccode class=\"language-csharp\">MultipartFormDataContent\u003C\u002Fcode> object is created to hold the file content, the current encryption password, and the new encryption password. The PDF file is read into a byte array and added to the multipart content with the appropriate content type. The password is also encoded into a byte array and added to the multipart content.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n...\nmultipartContent.Add(byteArrayOption, \"new_open_password\");\n\u003C\u002Fpre>\n\n\u003Cp>The multipart content is then assigned to the request, which is sent asynchronously. The response is read as a string and printed to the console.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Content = multipartContent;\nvar response = await httpClient.SendAsync(request);\n...\nConsole.WriteLine(apiResult);\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've learned how to use C# to send a multipart API call to pdfRest's Encrypt PDF API. This allows us to modify a PDF document's password, ensuring that only authorized individuals with the new password can open the document. By following this example, you can integrate PDF password modification into your own applications, adding an essential security feature for handling sensitive documents.\u003C\u002Fp>\n\n\u003Cp>For further exploration and to demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information on the API, check out the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. If you are interested in code samples using JSON payloads, you can find them at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fencrypted-pdf.cs\">pdfRest C# JSON Payload Sample Code\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-07T18:08:59.000+00:00","2026-09-02T18:26:55.000+00:00","Learn how to change an existing password for a PDF to a new password using Encrypt PDF API Tool from pdfRest with C#","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Change PDF Password in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-03-07T18:08:59.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:45.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to change an existing password for a PDF to a new password using Encrypt PDF API Tool from pdfRest with C#\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Encrypt PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fencrypted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fencrypt-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Encrypt PDF, Password, Security\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Change PDF Password in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3640,3641,3642,3643,3644,3645],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1997,"name":1998,"slug":1999,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1977,"name":1978,"slug":1979,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-change-pdf-password-in-net-with-c\u002F","How to Change PDF Password in .NET with C#, Tutorial | pdfRest",{"id":3650,"uuid":3651,"title":3652,"slug":3653,"html":3654,"comment_id":3650,"feature_image":48,"featured":284,"visibility":1257,"created_at":3655,"updated_at":3636,"published_at":3655,"custom_excerpt":3656,"codeinjection_head":3657,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3658,"primary_tag":3665,"url":3666,"excerpt":3656,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3667,"meta_description":3656,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ea17e1533c9f26b943670d","197ca879-8259-48a1-a87d-786d23f58d24","How to Change PDF Password JavaScript in NodeJS","how-to-change-pdf-password-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Change PDF Password with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F'>Encrypt PDF API Tool\u003C\u002Fa> empowers you to efficiently manage passwords for your existing PDFs. This tutorial dives into using JavaScript to send API calls and directly change a PDF's password through the Encrypt PDF functionality.\u003C\u002Fp>\n\n\u003Cp>Imagine you have a project containing highly sensitive documents, like marketing strategies or product roadmaps. These documents are already password-protected, but you need to update the original password with a stronger password, restricting access to authorized personnel only.\u003C\u002Fp>\n\n\u003Cp>By leveraging the Encrypt PDF API with JavaScript, you can programmatically update PDF passwords within your existing workflow. This eliminates the need to manually open and re-encrypt documents, saving time and minimizing the risk of errors.\u003C\u002Fp>\n\n\u003Ch2>Change PDF Password with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to apply 256-bit AES encryption with a 32-bit key. Encrypted PDFs cannot be viewed without first providing the open password.\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('current_open_password', 'curr_example_pw');\ndata.append('new_open_password', 'new_example_pw');\ndata.append('output', 'pdfrest_encrypted_pdf');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\nmaxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fencrypted-pdf',\n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error);\n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Refer to the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fencrypted-pdf.js\">source of the provided code\u003C\u002Fa> for more details.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided code snippet demonstrates how to encrypt a PDF file using the pdfRest API. Let's break down the key parts of this code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\u003C\u002Fpre>\n\n\u003Cp>These lines import the required modules: \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests, \u003Ccode>FormData\u003C\u002Fcode> for building form data payloads, and \u003Ccode>fs\u003C\u002Fcode> for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('current_open_password', 'curr_example_pw');\ndata.append('new_open_password', 'new_example_pw');\ndata.append('output', 'pdfrest_encrypted_pdf');\n\u003C\u002Fpre>\n\n\u003Cp>This section creates a new \u003Ccode>FormData\u003C\u002Fcode> object and appends the file to be encrypted, the current password, the new password for opening the encrypted PDF, and the desired output name for the encrypted file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fencrypted-pdf',\n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\n\u003C\u002Fpre>\n\n\u003Cp>Here, we define the configuration for the \u003Ccode>axios\u003C\u002Fcode> request, setting the HTTP method to POST, the request URL, and the headers including the API key. The \u003Ccode>maxBodyLength\u003C\u002Fcode> is set to Infinity to allow large files to be sent.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error);\n});\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the \u003Ccode>axios\u003C\u002Fcode> request is sent with the defined configuration. The response is logged to the console, or in the case of an error, the error is logged.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've demonstrated how to change a password for a PDF using the pdfRest API and JavaScript. By following the steps outlined above, you've learned how to send a multipart API call to secure a PDF document with an updated password. This ensures that the document's contents are protected and can only be accessed by individuals with the correct password.\u003C\u002Fp>\n\n\u003Cp>To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For a comprehensive understanding of the available endpoints and parameters, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. For code samples using JSON payloads, check out the examples at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fencrypted-pdf.js\">this repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-07T19:39:13.000+00:00","Learn how to use JavaScript to reset a PDF password with the Encrypt PDF API Tool from pdfRest","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Change PDF Password JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-03-07T19:39:13.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:44.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use JavaScript to reset a PDF password with the Encrypt PDF API Tool from pdfRest\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Encrypt PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fencrypted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fencrypt-pdf\"\n        }\n      ],\n      \"keywords\": \"Encrypt PDF, JavaScript, Password, Security\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Change PDF Password JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3659,3660,3661,3662,3663,3664],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1997,"name":1998,"slug":1999,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1977,"name":1978,"slug":1979,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-change-pdf-password-javascript-in-nodejs\u002F","How to Change PDF Password JavaScript in NodeJS, Tutorial | pdfRest",{"id":3669,"uuid":3670,"title":3671,"slug":3672,"html":3673,"comment_id":3669,"feature_image":48,"featured":284,"visibility":1257,"created_at":3674,"updated_at":3636,"published_at":3674,"custom_excerpt":3675,"codeinjection_head":3676,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3677,"primary_tag":3684,"url":3685,"excerpt":3675,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3686,"meta_description":3675,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ea177f533c9f26b9436703","75e28815-5c91-42a2-abf3-714b1471a9bd","How to Change PDF Password with cURL","how-to-change-pdf-password-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Change PDF Password with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F'>Encrypt PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to secure their PDF documents. By using this API, you can add and change PDF passwords to restrict access, ensuring that only individuals with the correct password can view or modify the document. This tutorial will guide you through the process of sending an API call to Encrypt PDF using cURL, a command-line tool used for making network requests.\u003C\u002Fp>\n\n\u003Cp>You might need to encrypt PDF documents to protect sensitive information such as financial reports, legal contracts, or personal data. Whether you’re sending a confidential document to a colleague or storing it in an insecure location, encryption helps prevent unauthorized access. By modifying a current password to a new passord, you can ensure only users with the new password will be able to open the file.  For instance, a healthcare provider might change a PDF password on patient records before sharing them with a new insurance company.\u003C\u002Fp>\n\n\u003Ch2>Change PDF Password with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fencrypted-pdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\" \\\n  -F \"current_open_password=password\" \\\n  -F \"new_open_password=newpassword\"\n\u003C\u002Fpre>\n\n\u003Cp>Reference to the provided code can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fencrypted-pdf-change-password.sh\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This cURL command is used to make a POST request to the Encrypt PDF endpoint. Let’s break down the components of the command:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fencrypted-pdf\"\n\u003C\u002Fpre>\n\n\u003Cp>This specifies that you are making a POST request to the Encrypt PDF endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\n\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the server’s response should be in JSON format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\n\u003C\u002Fpre>\n\n\u003Cp>This header tells the server that the request body contains form data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>Replace the placeholder with your actual API key to authenticate the request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\n\u003C\u002Fpre>\n\n\u003Cp>The '-F' flag is used to specify each field to be sent. This field contains the file path to the PDF you want to encrypt.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>This field sets the name of the output file that will be created.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"current_open_password=password\"\n\u003C\u002Fpre>\n\n\u003Cp>This field is the current password of the PDF if it is already protected.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"new_open_password=newpassword\"\n\u003C\u002Fpre>\n\n\u003Cp>This field is the new password you want to set for the PDF file.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you've learned how to change a PDF password using the pdfRest API and cURL. This provides an additional layer of security to your PDF files by requiring a new password to open them. You've also seen how to structure an API call with cURL and pass various parameters to customize the request.\u003C\u002Fp>\n\n\u003Cp>You are now ready to explore and demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further information and a comprehensive guide to using the pdfRest API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-07T19:37:35.000+00:00","Learn how to modify a PDF password with the pdfRest Encrypt PDF API Tool using cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-with-curl\u002F#article\",\n      \"headline\": \"How to Change PDF Password with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-with-curl\u002F\",\n      \"datePublished\": \"2024-03-07T19:37:35.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:44.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to modify a PDF password with the pdfRest Encrypt PDF API Tool using cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Encrypt PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fencrypted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fencrypt-pdf\"\n        }\n      ],\n      \"keywords\": \"Encrypt PDF, Password, Security, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Change PDF Password with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3678,3679,3680,3681,3682,3683],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1997,"name":1998,"slug":1999,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1977,"name":1978,"slug":1979,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-change-pdf-password-with-curl\u002F","How to Change PDF Password with cURL, Tutorial | pdfRest",{"id":3688,"uuid":3689,"title":3690,"slug":3691,"html":3692,"comment_id":3688,"feature_image":48,"featured":284,"visibility":1257,"created_at":3693,"updated_at":3694,"published_at":3693,"custom_excerpt":3695,"codeinjection_head":3696,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3697,"primary_tag":3704,"url":3705,"excerpt":3695,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3706,"meta_description":3695,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ea1925533c9f26b943672b","474a1151-f8d5-4b6c-ad59-28b874027e7d","How to Change PDF Password with Java","how-to-change-pdf-password-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Change an Existing PDF Password with Java\u003C\u002Fh2>\n\n\u003Cp>Password changes are often part of a document's lifecycle rather than a one-time security step. A PDF may use an internal password while it moves through a review process and require a different password before it is delivered to a customer, partner, or archive. The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\">Encrypt PDF API Tool\u003C\u002Fa> changes the open password through the \u003Ccode>\u002Fencrypted-pdf\u003C\u002Fcode> endpoint when the request supplies both the document's current password and the new password.\u003C\u002Fp>\n\n\u003Cp>pdfRest applies AES 256-bit encryption using Adobe PDF Library technology. By supplying the current open password and a new one, an application can rotate access credentials as part of a controlled document-delivery or retention workflow without bypassing the document's existing protection.\u003C\u002Fp>\n\n\u003Cp>For example, a Java-based benefits portal can receive an encrypted enrollment package from an internal system, replace its temporary processing password with a recipient-specific delivery password, and then store the new PDF for secure distribution. The password transition happens as part of the automated workflow, so staff do not need to open and resave sensitive documents manually.\u003C\u002Fp>\n\n\u003Cp>This example uses OkHttp to upload the protected PDF as multipart form data and send the current and replacement passwords in the same request.\u003C\u002Fp>\n\u003Ch2>Java Password-Change Code Example\u003C\u002Fh2>\n\n\u003Cp>Add OkHttp, java-dotenv, and JSON-java to the project. Set \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode> in an environment variable or \u003Ccode>.env\u003C\u002Fcode> file, then replace the input path, current password, and new password placeholders. Do not commit passwords or API keys to source control.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class EncryptedPDF {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    final boolean DELETE_SENSITIVE_FILES = false; \u002F\u002F toggle deletion (default: false)\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"current_open_password\", \"current-password\")\n            .addFormDataPart(\"new_open_password\", \"new-password\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fencrypted-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        String respStr = response.body().string();\n        System.out.println(prettyJson(respStr));\n\n        \u002F\u002F All files uploaded or generated are automatically deleted based on the\n        \u002F\u002F File Retention Period as shown on https:\u002F\u002Fpdfrest.com\u002Fpricing.\n        \u002F\u002F For immediate deletion of files, particularly when sensitive data\n        \u002F\u002F is involved, an explicit delete call can be made to the API.\n        \u002F\u002F\n        \u002F\u002F Deletes all files in the workflow, including outputs. Save all desired files before\n        \u002F\u002F enabling this step.\n\n        if (DELETE_SENSITIVE_FILES) {\n          org.json.JSONObject parsed = new org.json.JSONObject(respStr);\n          String inputId = parsed.getString(\"inputId\");\n          String outputId = parsed.getString(\"outputId\");\n          String deleteJson = String.format(\"{ \\\"ids\\\":\\\"%s, %s\\\" }\", inputId, outputId);\n          RequestBody deleteBody =\n              RequestBody.create(deleteJson, MediaType.parse(\"application\u002Fjson\"));\n          Request deleteRequest =\n              new Request.Builder()\n                  .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n                  .url(API_URL + \"\u002Fdelete\")\n                  .post(deleteBody)\n                  .build();\n          try (Response deleteResp =\n              new OkHttpClient()\n                  .newBuilder()\n                  .readTimeout(60, TimeUnit.SECONDS)\n                  .build()\n                  .newCall(deleteRequest)\n                  .execute()) {\n            if (deleteResp.body() != null) {\n              System.out.println(prettyJson(deleteResp.body().string()));\n            }\n          }\n        }\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FEncryptedPDF.java\">pdfRest Encrypt PDF multipart Java sample\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Supply the Current and New Passwords\u003C\u002Fh2>\n\n\u003Cp>The multipart \u003Ccode>file\u003C\u002Fcode> part contains the encrypted PDF. The \u003Ccode>current_open_password\u003C\u002Fcode> field proves that the application is authorized to open and re-encrypt it, while \u003Ccode>new_open_password\u003C\u002Fcode> sets the password that will be required for the output. The optional \u003Ccode>output\u003C\u002Fcode> field assigns a predictable base filename to the generated PDF.\u003C\u002Fp>\n\n\u003Cp>An open password controls access to the document. A permissions password controls whether users can modify restrictions such as printing or editing. If the input PDF has relevant edit restrictions, the request may also need \u003Ccode>current_permissions_password\u003C\u002Fcode>. Keep these values distinct and obtain them through secure application input or a secret-management process rather than hard-coding them.\u003C\u002Fp>\n\n\u003Cp>The sample defaults to the US Cloud API and exposes the EU base URL as a configuration option. Keeping the base URL outside the request logic lets deployment environments select the appropriate processing region without changing the workflow.\u003C\u002Fp>\n\n\u003Ch2>Use the Result in a Larger Workflow\u003C\u002Fh2>\n\n\u003Cp>A successful response identifies the newly encrypted PDF. Download its output URL when the application needs to store the file, or pass its resource ID directly to another compatible pdfRest API Tool. Resource-ID chaining avoids downloading and re-uploading intermediate files when the password change is followed by another operation.\u003C\u002Fp>\n\n\u003Cp>Check the HTTP status before parsing success fields, and treat an incorrect current password as a request failure rather than retrying indefinitely. Production code should also use appropriate connection and read timeouts, handle network failures separately from API validation errors, and avoid writing passwords or sensitive response data to logs.\u003C\u002Fp>\n\n\u003Cp>If the PDF has already been uploaded, the request can be sent as JSON with its resource ID instead of another multipart upload. See the official \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FEncryptedPDF.java\">Encrypt PDF JSON-payload Java sample\u003C\u002Fa> for that request pattern. Use \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> to configure password changes, and consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fencrypt-pdf\">Encrypt PDF API reference\u003C\u002Fa> for the current fields and response schema.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-07T19:44:37.000+00:00","2026-09-22T19:02:59.000+00:00","Learn how to change a PDF password with pdfRest Encrypt PDF API Tool using Java","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-with-java\u002F#article\",\n      \"headline\": \"How to Change PDF Password with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-with-java\u002F\",\n      \"datePublished\": \"2024-03-07T19:44:37.000Z\",\n      \"dateModified\": \"2026-09-22T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to change a PDF password with pdfRest Encrypt PDF API Tool using Java\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Encrypt PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fencrypted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fencrypt-pdf\"\n        }\n      ],\n      \"keywords\": \"Encrypt PDF, Java, Password, Security\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Change PDF Password with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3698,3699,3700,3701,3702,3703],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1997,"name":1998,"slug":1999,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1977,"name":1978,"slug":1979,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-change-pdf-password-with-java\u002F","How to Change PDF Password with Java, Tutorial | pdfRest",{"id":3708,"uuid":3709,"title":3710,"slug":3711,"html":3712,"comment_id":3708,"feature_image":48,"featured":284,"visibility":1257,"created_at":3713,"updated_at":3714,"published_at":3713,"custom_excerpt":3715,"codeinjection_head":3716,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3717,"primary_tag":3724,"url":3725,"excerpt":3715,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3726,"meta_description":3715,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ea182c533c9f26b9436717","68307065-21e5-416c-b21d-21c08425c84e","How to Change PDF Password with PHP","how-to-change-pdf-password-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Change PDF Password with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\">Encrypt PDF API Tool\u003C\u002Fa> lets you update passwords for PDF documents directly with PHP. This eliminates the hassle of manually re-encrypting documents and ensures both enhanced security and streamlined collaboration.\u003C\u002Fp>\n\n\u003Cp>Whether you're strengthening passwords, granting access to new team members, or complying with regulations, the Encrypt PDF API automates the process, saving you time and minimizing errors.\u003C\u002Fp>\n\n\u003Ch2>Change PDF Password with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'current_open_password',\n      'contents' => 'curr_example_pw'\n    ],\n    [\n      'name' => 'new_open_password',\n      'contents' => 'new_example_pw'\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_encrypted_pdf'\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fencrypted-pdf', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source of the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fencrypted-pdf.php\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The PHP code provided above is designed to make an API call to the Encrypt PDF endpoint of the pdfRest API. Let's break down the key components of this code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\u003C\u002Fpre>\n\n\u003Cp>This section includes the necessary libraries and sets up the namespaces. Guzzle HTTP client is used for making HTTP requests.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>$headers\u003C\u002Fcode> array contains the API key required for authentication with the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">'options' => [\n  'multipart' => [\n    \u002F\u002F ...multipart form data...\n  ]\n];\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>$options\u003C\u002Fcode> array is where the multipart form data is defined. This includes the file to encrypt, the current password, the new password, and the output file name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fencrypted-pdf', $headers);\n\u003C\u002Fpre>\n\n\u003Cp>A new HTTP POST request is created with the API endpoint and the headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$res = $client->sendAsync($request, $options)->wait();\necho $res->getBody();\n\u003C\u002Fpre>\n\n\u003Cp>The request is sent asynchronously, and the script waits for the response. The response body, which contains the encrypted PDF content, is then outputted.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've successfully made a call to the Encrypt PDF endpoint using the pdfRest API with PHP. By doing so, we've updated a PDF document by setting a new password, ensuring that only authorized individuals with the password can access the document's contents.\u003C\u002Fp>\n\n\u003Cp>Demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for further exploration of the capabilities offered by pdfRest.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fencrypted-pdf.php\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-07T19:40:28.000+00:00","2026-09-10T20:19:08.000+00:00","Learn how to change a PDF password using pdfRest Encrypt PDF API Tool with PHP","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-with-php\u002F#article\",\n      \"headline\": \"How to Change PDF Password with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-with-php\u002F\",\n      \"datePublished\": \"2024-03-07T19:40:28.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:44.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to change a PDF password using pdfRest Encrypt PDF API Tool with PHP\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Encrypt PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fencrypted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fencrypt-pdf\"\n        }\n      ],\n      \"keywords\": \"Encrypt PDF, PHP, Password, Security\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Change PDF Password with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3718,3719,3720,3721,3722,3723],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1997,"name":1998,"slug":1999,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1977,"name":1978,"slug":1979,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-change-pdf-password-with-php\u002F","How to Change PDF Password with PHP, Tutorial | pdfRest",{"id":3728,"uuid":3729,"title":3730,"slug":3731,"html":3732,"comment_id":3728,"feature_image":48,"featured":284,"visibility":1257,"created_at":3733,"updated_at":3734,"published_at":3733,"custom_excerpt":3735,"codeinjection_head":3736,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3737,"primary_tag":3744,"url":3745,"excerpt":3735,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3746,"meta_description":3735,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ea1872533c9f26b9436721","e32b8e03-5216-4dd9-a6bc-c82fb7beebd6","How to Change PDF Password with Python","how-to-change-pdf-password-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Change PDF Password with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F'>Encrypt PDF API Tool\u003C\u002Fa> empowers you to efficiently update passwords on existing PDFs directly with Python.  This eliminates the need for manual re-encryption, saving you time and minimizing errors.\u003C\u002Fp>\n\n\u003Cp>Strengthen passwords, grant access to new team members, or comply with data security regulations – the Encrypt PDF API automates the process, ensuring both enhanced security and streamlined collaboration within your Python workflows.\u003C\u002Fp>\n\n\u003Ch2>Change PDF Password with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nencrypted_pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fencrypted-pdf'\n\n# The \u002Fencrypted-pdf endpoint can take a single PDF file or id as input.\n# This sample demonstrates encryption of a PDF with the password 'password'.\nmp_encoder_encryptedPdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_encryptedPdf_out',\n        'current_open_password': 'currpassword',\n        'new_open_password': 'newpassword',\n    }\n)\n\n# Let's set the headers that the encrypted-pdf endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_encryptedPdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to encrypted-pdf endpoint...\")\nresponse = requests.post(encrypted_pdf_endpoint_url, data=mp_encoder_encryptedPdf, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>The provided code is sourced from the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fencrypted-pdf.py\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing the necessary libraries: \u003Ccode class=\"language-python\">MultipartEncoder\u003C\u002Fcode> from \u003Ccode class=\"language-python\">requests_toolbelt\u003C\u002Fcode>, \u003Ccode class=\"language-python\">requests\u003C\u002Fcode>, and \u003Ccode class=\"language-python\">json\u003C\u002Fcode>. The \u003Ccode class=\"language-python\">MultipartEncoder\u003C\u002Fcode> is used for creating multipart\u002Fform-data payloads, which is the required format for file uploads.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\u003C\u002Fpre>\n\n\u003Cp>The endpoint URL is defined as a string, representing the API endpoint to which the POST request will be sent.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">encrypted_pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fencrypted-pdf'\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode class=\"language-python\">MultipartEncoder\u003C\u002Fcode> is then configured with the fields needed for the request: the file to encrypt, the desired output name, the current password, and the new password for opening the PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_encryptedPdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_encryptedPdf_out',\n        'current_open_password': 'currpassword',\n        'new_open_password': 'newpassword',\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>Headers are set up to include the expected 'Accept' and 'Content-Type', as well as the 'Api-Key' which should be replaced with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_encryptedPdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\u003C\u002Fpre>\n\n\u003Cp>The POST request is sent using the \u003Ccode class=\"language-python\">requests.post\u003C\u002Fcode> method with the specified URL, data payload, and headers. The response is then checked for success, and the JSON response is printed if available, otherwise the error text is displayed.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(encrypted_pdf_endpoint_url, data=mp_encoder_encryptedPdf, headers=headers)\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the above steps, you have learned how to make an API call to change a PDF password using Python. This process can be integrated into larger workflows to automate the protection of sensitive documents. To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further information and detailed API documentation, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads for the same operation can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fencrypted-pdf.py\">pdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-07T19:41:38.000+00:00","2026-09-02T18:26:57.000+00:00","Learn how to replace a PDF password with a new one using pdfRest Encrypt PDF API Tool with Python","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-with-python\u002F#article\",\n      \"headline\": \"How to Change PDF Password with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-with-python\u002F\",\n      \"datePublished\": \"2024-03-07T19:41:38.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:44.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to replace a PDF password with a new one using pdfRest Encrypt PDF API Tool with Python\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Encrypt PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fencrypted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fencrypt-pdf\"\n        }\n      ],\n      \"keywords\": \"Encrypt PDF, Password, Python, Security\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Change PDF Password with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-change-pdf-password-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3738,3739,3740,3741,3742,3743],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1997,"name":1998,"slug":1999,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1977,"name":1978,"slug":1979,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-change-pdf-password-with-python\u002F","How to Change PDF Password with Python, Tutorial | pdfRest",{"id":3748,"uuid":3749,"title":3750,"slug":3751,"html":3752,"comment_id":3748,"feature_image":48,"featured":284,"visibility":1257,"created_at":3753,"updated_at":3734,"published_at":3753,"custom_excerpt":3754,"codeinjection_head":3755,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3756,"primary_tag":3761,"url":3762,"excerpt":3754,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3763,"meta_description":3754,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ce7da6533c9f26b9436416","818da684-083e-4920-9a01-aec146e5470a","How to Check PDF Conditions and Metadata in .NET with C#","how-to-check-pdf-conditions-and-metadata-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Query PDF with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F'>Query PDF API Tool\u003C\u002Fa> is a powerful resource that enables developers to retrieve various pieces of information from a PDF document. By sending an API call to Query PDF with C#, you can extract metadata such as the title, page count, document language, and more without having to manually open the document or write complex parsing logic.\u003C\u002Fp>\n\u003Cp>This can be particularly useful in content management systems, where you might need to catalog and organize large numbers of PDF files based on their metadata. For instance, a user might use Query PDF to quickly scan a repository of PDFs to identify and categorize them by author or creation date.\u003C\u002Fp>\n\n\u003Ch2>Query PDF with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf-info\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"title, page_count, doc_language, tagged, image_only, author, creation_date, modified_date, producer\"));\n        multipartContent.Add(byteArrayOption, \"queries\");\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-info.cs\">pdf-rest-api-samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code above is a C# example of how to use the pdfRest API to query information from a PDF document. Let's break it down:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") };\n\u003C\u002Fpre>\n\n\u003Cp>This line initializes a new \u003Ccode>HttpClient\u003C\u002Fcode> instance with the base address set to the pdfRest API endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>This line adds your API key to the request headers. Replace the placeholder with your actual pdfRest API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\u003C\u002Fpre>\n\n\u003Cp>These lines read the PDF file as a byte array, create a new \u003Ccode>ByteArrayContent\u003C\u002Fcode> with it, and add it to the multipart form data content. The \u003Ccode>\"file\"\u003C\u002Fcode> and \u003Ccode>\"file_name\"\u003C\u002Fcode> parameters are the form field name and the file name sent in the request, respectively.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"title, page_count, doc_language, tagged, image_only, author, creation_date, modified_date, producer\"));\nmultipartContent.Add(byteArrayOption, \"queries\");\n\u003C\u002Fpre>\n\n\u003Cp>This snippet creates a byte array content with the specified queries and adds it to the multipart content. These queries determine what information you want to retrieve from the PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\nvar apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the request is sent asynchronously, and the response is read as a string, which contains the queried PDF information.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've accomplished sending a multipart API call to pdfRest's Query PDF endpoint using C#. This allows us to programmatically retrieve specific information from a PDF document. Exploring all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>\u003C\u002Fa> is a great next step. You can also refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for more details on the available endpoints and their functionalities.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-info.cs\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-15T21:09:58.000+00:00","Learn how to check PDF files for conditional information and metadata using pdfRest Query PDF API Tool with C#.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Check PDF Conditions and Metadata in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-02-15T21:09:58.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:47.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to check PDF files for conditional information and metadata using pdfRest Query PDF API Tool with C#.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Query PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-info API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fquery-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Query PDF\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Check PDF Conditions and Metadata in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3757,3758,3759,3760],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1352,"name":1353,"slug":1354,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-check-pdf-conditions-and-metadata-in-net-with-c\u002F","How to Check PDF Conditions and Metadata in .NET with C#, Tutorial | pdfRest",{"id":3765,"uuid":3766,"title":3767,"slug":3768,"html":3769,"comment_id":3765,"feature_image":48,"featured":284,"visibility":1257,"created_at":3770,"updated_at":3771,"published_at":3770,"custom_excerpt":3772,"codeinjection_head":3773,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3774,"primary_tag":3779,"url":3780,"excerpt":3772,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3781,"meta_description":3772,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65f08a40533c9f26b94369df","252ced6c-3cfe-452f-9de6-9688c8cb4600","How to Check PDF Conditions and Metadata with cURL","how-to-check-pdf-conditions-and-metadata-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Query PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F'>Query PDF API Tool\u003C\u002Fa> is a powerful resource for extracting information from PDF documents. This tool allows users to query various properties of a PDF, such as the title, page count, document language, and author, among others. In this tutorial, we will demonstrate how to send an API call to the Query PDF endpoint using cURL, a versatile command-line tool used for making HTTP requests. cURL is widely used for its simplicity and broad support across various platforms, making it an ideal choice for interacting with web APIs like pdfRest.\u003C\u002Fp>\n\n\u003Cp>Imagine you are working on an application that needs to organize a large number of PDF documents based on their metadata. You might need to categorize them by author, count the number of pages, or filter them by language. Using the Query PDF API, you can programmatically retrieve this information and automate the organization process. This can save a significant amount of time and effort, especially when dealing with a large volume of documents.\u003C\u002Fp>\n\n\u003Ch2>Query PDF with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-info\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"queries=title,page_count,doc_language,author\"\n\u003C\u002Fpre>\n\n\u003Cp>Reference to the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-info.sh\">pdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This cURL command sends a POST request to the Query PDF endpoint. Let's break down each part of the command:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-info\"\u003C\u002Fpre>\n\n\u003Cp>This specifies the request method (POST) and the URL of the API endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\u003C\u002Fpre>\n\n\u003Cp>This header tells the server that the client expects a response in JSON format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the request body will be sent as multipart\u002Fform-data, which is necessary for uploading files.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\u003C\u002Fpre>\n\n\u003Cp>This header includes the API key required for authentication with the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\u003C\u002Fpre>\n\n\u003Cp>The -F flag is used to specify each field that will be sent as part of the multipart\u002Fform-data request. In this case, it's used to upload the PDF file from the specified path.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"queries=title,page_count,doc_language,author\"\u003C\u002Fpre>\n\n\u003Cp>This field specifies the information to query from the PDF. The API will return the title, page count, document language, and author of the PDF.\u003C\u002Fp>\n\n\u003Cp>For more details on the parameters and how to use the Query PDF API, you can refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fquery-pdf\u002F\">pdfRest Cloud API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you have learned how to make a multipart API call to the Query PDF endpoint using cURL. This enables you to programmatically retrieve valuable metadata from PDF documents. With the knowledge gained, you can integrate this functionality into your applications or workflows, enhancing your ability to manage and utilize PDF files.\u003C\u002Fp>\n\n\u003Cp>To further explore what you can do with pdfRest, consider trying out all of the API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For a comprehensive understanding of the full capabilities of the pdfRest API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-info.sh\">pdf-rest-api-samples JSON Payload\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-12T17:00:48.000+00:00","2026-09-02T18:26:58.000+00:00","Learn how to check conditional information about a PDF and get metadata using Query PDF API Tool from pdfRest with cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-curl\u002F#article\",\n      \"headline\": \"How to Check PDF Conditions and Metadata with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-curl\u002F\",\n      \"datePublished\": \"2024-03-12T17:00:48.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:40.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to check conditional information about a PDF and get metadata using Query PDF API Tool from pdfRest with cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Query PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-info API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fquery-pdf\"\n        }\n      ],\n      \"keywords\": \"Query PDF, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Check PDF Conditions and Metadata with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3775,3776,3777,3778],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1352,"name":1353,"slug":1354,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-check-pdf-conditions-and-metadata-with-curl\u002F","How to Check PDF Conditions and Metadata with cURL, Tutorial | pdfRest",{"id":3783,"uuid":3784,"title":3785,"slug":3786,"html":3787,"comment_id":3783,"feature_image":48,"featured":284,"visibility":1257,"created_at":3346,"updated_at":3771,"published_at":3788,"custom_excerpt":3789,"codeinjection_head":3790,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3791,"primary_tag":3796,"url":3797,"excerpt":3789,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3798,"meta_description":3789,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c55533c9f26b943b489","5a464251-8c03-46ce-b774-415ce89011df","How to Check PDF Conditions and Metadata with Java","how-to-check-pdf-conditions-and-metadata-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>Learn how to check PDF conditions and metadata with Java and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F\">Query PDF API Tool\u003C\u002Fa>. The request combines several property names in one \u003Ccode>queries\u003C\u002Fcode> value and reads the resulting document information from JSON. We'll move from input and authentication setup through the request and returned data involved when you check PDF conditions and metadata.\u003C\u002Fp>\n\n\u003Ch2>Why Check PDF Conditions and Metadata with Java?\u003C\u002Fh2>\n\n\u003Cp>An ingestion service can inspect page count, language, title, author, encryption, or conformance information before routing a document. That prevents later operations from relying on assumptions about an unknown file.\u003C\u002Fp>\n\n\u003Cp>The comma-separated \u003Ccode>queries\u003C\u002Fcode> field names the properties returned by Query PDF. The sample requests title, page count, document language, and author in one call.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class PDFInfo {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"queries\", \"title, page_count, doc_language, author\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf-info\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPDFInfo.java\">Java sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The Java setup relies on OkHttp to send the call, dotenv to resolve credentials, and \u003Ccode>org.json\u003C\u002Fcode> to inspect or format JSON.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>The input setup supports quick local testing while allowing normal callers to provide their own path and \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"queries\", \"title, page_count, doc_language, author\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf-info\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The comma-separated \u003Ccode>queries\u003C\u002Fcode> field names the properties returned by Query PDF. The sample requests title, page count, document language, and author in one call. The OkHttp body collects the named parts before OkHttp calculates the final multipart header and body encoding.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf-info\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>This POST request joins authentication, routing, and payload in one place while leaving regional service selection in the API URL constant.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>The JSON response reports the requested document properties and whether every query was processed, giving the caller data it can use for routing decisions.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>Together, we stepped through the Java request needed to check PDF conditions and metadata. With that foundation, you can use query results to drive conditional OCR, form handling, archival conversion, validation, or rejection workflows.\u003C\u002Fp>\n\n\u003Cp>As you build this into a larger workflow, request only properties that affect the next processing decision, and check whether all queries were completed before relying on the values. Password protection or malformed input can limit what the service can inspect, so route incomplete results to an explicit exception path.\u003C\u002Fp>\n\n\u003Cp>Try the Check PDF Conditions and Metadata operation with representative files in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. Review the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fquery-pdf\u002F\">Query PDF API Tool documentation\u003C\u002Fa> for supported values and production considerations.\u003C\u002Fp>\n\n\u003Cp>Note: The Check PDF Conditions and Metadata example above uses multipart form data; for the resource-ID form of this operation, review how the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPDFInfo.java\">JSON payload example\u003C\u002Fa> constructs the request.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T21:57:32.000+00:00","Query PDF metadata and document conditions with Java before selecting later processing steps.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-java\u002F#article\",\n      \"headline\": \"How to Check PDF Conditions and Metadata with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:32.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:32.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Query PDF metadata and document conditions with Java before selecting later processing steps.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Query PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-info API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fquery-pdf\"\n        }\n      ],\n      \"keywords\": \"Java, Query PDF\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Check PDF Conditions and Metadata with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3792,3793,3794,3795],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1352,"name":1353,"slug":1354,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-check-pdf-conditions-and-metadata-with-java\u002F","Check PDF Conditions and Metadata with Java | pdfRest",{"id":3800,"uuid":3801,"title":3802,"slug":3803,"html":3804,"comment_id":3800,"feature_image":48,"featured":284,"visibility":1257,"created_at":3805,"updated_at":3806,"published_at":3805,"custom_excerpt":3807,"codeinjection_head":3808,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3809,"primary_tag":3814,"url":3815,"excerpt":3807,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3816,"meta_description":3807,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ce7e2a533c9f26b9436420","d401b523-3025-41f1-a9b2-e8e439894fbe","How to Check PDF Conditions and Metadata with JavaScript in NodeJS","how-to-check-pdf-conditions-and-metadata-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Query PDF with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F'>Query PDF API Tool\u003C\u002Fa> is designed to extract detailed information about a PDF document, such as metadata, page count, whether it contains annotations, signatures, JavaScript, and much more. This tutorial will show you how to send an API call to Query PDF using JavaScript.\u003C\u002Fp>\n\u003Cp>This is particularly useful, for instance, when you need to automate the process of validating PDF files for certain criteria before they are processed or distributed in a system.\u003C\u002Fp>\n\n\u003Ch2>Query PDF with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to get detailed information about a PDF document and its contents to assess the current state of the file and drive conditional processing.\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('queries', 'tagged,image_only,title,subject,author,producer,creator,creation_date,modified_date,keywords,doc_language,page_count,contains_annotations,contains_signature,pdf_version,file_size,filename,restrict_permissions_set,contains_xfa,contains_acroforms,contains_javascript,contains_transparency,contains_embedded_file,uses_embedded_fonts,uses_nonembedded_fonts,pdfa,requires_password_to_open');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-info', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-info.js\">pdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code starts by requiring necessary modules: axios for making HTTP requests, FormData for constructing form data to send with the request, and fs for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\u003C\u002Fpre>\n\n\u003Cp>Next, it creates a new FormData instance and appends the PDF file and a string of queries to it. Each query specifies a piece of information you want to retrieve from the PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('queries', '...');\u003C\u002Fpre>\n\n\u003Cp>The configuration object for the axios request is defined with the HTTP method, URL, headers (including the API key), and the data payload.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-info',\n  headers: {\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\u003C\u002Fpre>\n\n\u003Cp>Finally, the axios request is sent, and the response or error is handled accordingly.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you have learned how to use JavaScript to call the pdfRest Query PDF API to retrieve detailed information about a PDF document. This can be the foundation for more complex workflows involving PDF processing and analysis.\u003C\u002Fp>\n\n\u003Cp>Feel free to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for further exploration.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-info.js\">pdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-15T21:12:10.000+00:00","2026-09-02T18:27:00.000+00:00","Learn how to use pdfRest Query PDF API Tool with JavaScript to check PDF files for conditional information and metadata. ","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Check PDF Conditions and Metadata with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-02-15T21:12:10.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:47.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Query PDF API Tool with JavaScript to check PDF files for conditional information and metadata. \",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Query PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-info API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fquery-pdf\"\n        }\n      ],\n      \"keywords\": \"JavaScript, Query PDF\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Check PDF Conditions and Metadata with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3810,3811,3812,3813],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1352,"name":1353,"slug":1354,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-check-pdf-conditions-and-metadata-with-javascript-in-nodejs\u002F","How to Check PDF Conditions and Metadata with JavaScript in NodeJS, Tutorial | pdfRest",{"id":3818,"uuid":3819,"title":3820,"slug":3821,"html":3822,"comment_id":3818,"feature_image":48,"featured":284,"visibility":1257,"created_at":3823,"updated_at":3806,"published_at":3824,"custom_excerpt":3825,"codeinjection_head":3826,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3827,"primary_tag":3832,"url":3833,"excerpt":3825,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3834,"meta_description":3825,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ce7eb4533c9f26b943642a","002f2129-fa15-4aa7-9210-2d838484a037","How to Check PDF Conditions and Metadata with PHP","how-to-check-pdf-conditions-and-metadata-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Query PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F'>Query PDF API Tool\u003C\u002Fa> is a powerful resource for extracting information from PDF files. It allows users to query various properties of a PDF, such as metadata, page count, whether it contains annotations, and much more. This tutorial will guide you through the process of making an API call to the Query PDF endpoint using PHP.\u003C\u002Fp>\n\u003Cp>One example for using Query PDF is to automate the process of cataloging a large number of PDFs based on their metadata or to verify compliance with PDF standards in a batch of documents.\u003C\u002Fp>\n\n\u003Ch2>Query PDF with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">\nrequire 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003CContent-type header>'\n      ]\n    ],\n    [\n      'name' => 'queries',\n      'contents' => 'tagged,image_only,title,subject,author,producer,creator,creation_date,modified_date,keywords,doc_language,page_count,contains_annotations,contains_signature,pdf_version,file_size,filename,restrict_permissions_set,contains_xfa,contains_acroforms,contains_javascript,contains_transparency,contains_embedded_file,uses_embedded_fonts,uses_nonembedded_fonts,pdfa,requires_password_to_open,pdfua_claim,pdfe_claim,pdfx_claim'\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-info', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source of the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-info.php\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code above is a PHP script that uses the Guzzle HTTP client to send a multipart\u002Fform-data POST request to the pdfRest API. Here's how each part of the code works:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Cstrong>Autoload and Namespaces:\u003C\u002Fstrong> The script begins by including the Composer autoload file and importing necessary classes from the Guzzle HTTP client library.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Client Initialization:\u003C\u002Fstrong> A new Guzzle HTTP client instance is created.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Headers:\u003C\u002Fstrong> The 'Api-Key' is set in the headers for authentication with the pdfRest API.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Options:\u003C\u002Fstrong> The 'multipart' array contains the details of the file to be uploaded and the queries to be performed. The 'contents' key under 'file' uses Utils::tryFopen to open the file for reading.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Request:\u003C\u002Fstrong> A new HTTP POST request is created with the API endpoint URL and the headers.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>Response:\u003C\u002Fstrong> The request is sent asynchronously, and the script waits for the response. The response body is then echoed, which contains the results of the queries.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>The 'queries' field contains a comma-separated list of properties to query about the PDF. These properties are explained in the pdfRest Cloud API Reference Guide.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've learned how to send a multipart\u002Fform-data POST request to the pdfRest API to query information about a PDF file using PHP. By executing the code, you can retrieve detailed information about a PDF document, which can be used for various purposes such as document management, compliance checks, or content analysis.\u003C\u002Fp>\n\n\u003Cp>I encourage you to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for more details and capabilities.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-info.php\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-15T21:14:28.000+00:00","2024-02-15T21:14:29.000+00:00","Learn how to use pdfRest Query PDF API Tool to check PDF files for conditional information and metadata with PHP.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-php\u002F#article\",\n      \"headline\": \"How to Check PDF Conditions and Metadata with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-php\u002F\",\n      \"datePublished\": \"2024-02-15T21:14:29.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:46.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Query PDF API Tool to check PDF files for conditional information and metadata with PHP.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Query PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-info API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fquery-pdf\"\n        }\n      ],\n      \"keywords\": \"PHP, Query PDF\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Check PDF Conditions and Metadata with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3828,3829,3830,3831],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1352,"name":1353,"slug":1354,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-check-pdf-conditions-and-metadata-with-php\u002F","How to Check PDF Conditions and Metadata with PHP, Tutorial | pdfRest",{"id":3836,"uuid":3837,"title":3838,"slug":3839,"html":3840,"comment_id":3836,"feature_image":48,"featured":284,"visibility":1257,"created_at":3841,"updated_at":3842,"published_at":3841,"custom_excerpt":3843,"codeinjection_head":3844,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3845,"primary_tag":3850,"url":3851,"excerpt":3843,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3852,"meta_description":3843,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ce7eff533c9f26b9436434","01d331db-ac51-4757-b650-91b677631e26","How to Check PDF Conditions and Metadata with Python","how-to-check-pdf-conditions-and-metadata-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Query PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F'>Query PDF API Tool\u003C\u002Fa> is a powerful resource for developers who need to extract information from PDF files programmatically. This tutorial will guide you through the process of sending an API call to the Query PDF endpoint using Python.\u003C\u002Fp>\n\u003Cp>This can be particularly useful in scenarios such as automating document processing systems, where you might need to retrieve metadata like the title, page count, or author of a PDF document before taking further action.\u003C\u002Fp>\n\n\u003Ch2>Query PDF with Python Code Example\u003C\u002Fh2>\n\n\u003Cp>The following code is a complete example of how to call the Query PDF API endpoint with Python. This code is sourced from the pdfRest API samples available on GitHub at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-info.py\">pdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\npdf_info_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-info'\n\n# The \u002Fpdf-info endpoint can take a single PDF file or id as input.\n#This sample demonstrates querying the title, page count, document language and author\nmp_encoder_pdfInfo = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'queries': 'title,page_count,doc_language,author',\n    }\n)\n\n# Let's set the headers that the pdf-info endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdfInfo.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to pdf-info endpoint...\")\nresponse = requests.post(pdf_info_endpoint_url, data=mp_encoder_pdfInfo, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code snippet above is broken down into several parts:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Cstrong>MultipartEncoder:\u003C\u002Fstrong> This is used to encode the files and fields for a multipart\u002Fform-data POST request.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>fields:\u003C\u002Fstrong> Here we define the data to be sent. 'file' is the PDF file to be queried and 'queries' is a comma-separated list of the PDF attributes we want to retrieve.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>headers:\u003C\u002Fstrong> These are the HTTP headers sent with the request. The 'Content-Type' is set automatically by the MultipartEncoder. 'Api-Key' should be replaced with your actual API key.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>requests.post:\u003C\u002Fstrong> This line sends the POST request to the pdf-info endpoint with the data and headers.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>response handling:\u003C\u002Fstrong> After the request, the response is checked. If successful, the JSON response is printed; otherwise, the error text is shown.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you've learned how to use Python to call the Query PDF API endpoint to retrieve information from a PDF file. You can now integrate this functionality into your applications, enabling you to automate and streamline processes that involve PDFs.\u003C\u002Fp>\n\n\u003Cp>We encourage you to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for more details on what you can achieve with pdfRest.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-info.py\">JSON Payload Examples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-15T21:15:43.000+00:00","2026-09-02T18:27:01.000+00:00","Learn how to check PDF conditional information and metadata using pdfRest Query PDF API Tool with Python.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-python\u002F#article\",\n      \"headline\": \"How to Check PDF Conditions and Metadata with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-python\u002F\",\n      \"datePublished\": \"2024-02-15T21:15:43.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:46.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to check PDF conditional information and metadata using pdfRest Query PDF API Tool with Python.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Query PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-info API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fquery-pdf\"\n        }\n      ],\n      \"keywords\": \"Python, Query PDF\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Check PDF Conditions and Metadata with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-check-pdf-conditions-and-metadata-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3846,3847,3848,3849],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1352,"name":1353,"slug":1354,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-check-pdf-conditions-and-metadata-with-python\u002F","How to Check PDF Conditions and Metadata with Python, Tutorial | pdfRest",{"id":3854,"uuid":3855,"title":3856,"slug":3857,"html":3858,"comment_id":3859,"feature_image":48,"featured":284,"visibility":1257,"created_at":3860,"updated_at":3861,"published_at":3860,"custom_excerpt":3862,"codeinjection_head":3863,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3864,"primary_tag":3870,"url":3871,"excerpt":3862,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3872,"meta_description":3862,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b137d","27ba540a-633f-4f73-a3be-f29939b3df55","How to Compress PDF Files in .NET with C#","how-to-compress-pdf-files-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Compress PDF with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcompress-pdf\u002F'>Compress PDF API Tool\u003C\u002Fa> is a powerful resource that allows developers to reduce the size of PDF files programmatically. This is particularly useful when dealing with large documents that need to be shared over email or stored in environments with limited space.\u003C\u002Fp>\n    \n\u003Cp>For instance, a business might need to compress a batch of reports to archive them efficiently or to ensure that they can be emailed to clients without hitting attachment size limits.\u003C\u002Fp>\n\n\u003Cp>This tutorial will show you how to send an API call to Compress PDF with C# using the pdfRest API.\u003C\u002Fp>\n\n\u003Ch2>Compress PDF with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"compressed-pdf\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"high\"));\n        multipartContent.Add(byteArrayOption, \"compression_level\");\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source code reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fcompressed-pdf.cs\">pdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the C# Code\u003C\u002Fh2>\n\n\u003Cp>The code snippet above demonstrates how to make an API call to the pdfRest Compress PDF endpoint using C#. Let's break down the key parts of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>This line initializes an \u003Ccode>HttpClient\u003C\u002Fcode> instance with the base address set to the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>Here, an API key is added to the request headers for authentication. Replace \u003Ccode>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\u003C\u002Fcode> with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n\u003C\u002Fpre>\n\n\u003Cp>This snippet reads a PDF file from the specified path and adds it to the multipart form data content with the key \u003Ccode>file\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"high\"));\nmultipartContent.Add(byteArrayOption, \"compression_level\");\n\u003C\u002Fpre>\n\n\u003Cp>The compression level is set to 'high' and added to the multipart content. The available compression levels can be found in the pdfRest Cloud API Reference Guide.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\n\u003C\u002Fpre>\n\n\u003Cp>This line sends the API request and waits for the response.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the response from the API is read as a string and can be processed or saved as needed.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you've learned how to compress a PDF file using C# and the pdfRest Compress PDF API. By following the steps outlined above, you have made an API call to reduce the size of a PDF document. This can help you manage files more efficiently in your applications.\u003C\u002Fp>\n\n\u003Cp>We encourage you to try all of the pdfRest API Tools in the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcompress-pdf\u002F\">Cloud API Reference Guide\u003C\u002Fa> for further exploration.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fcompressed-pdf.cs\">pdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","65a1c3c72d4014c9499b3e06","2024-01-12T22:57:11.000+00:00","2026-09-02T18:27:02.000+00:00","Learn how to use the Compress PDF API Tool from pdfRest to programmatically compress PDF files with C#.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-files-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Compress PDF Files in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-files-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-files-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-01-12T22:57:11.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:55.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use the Compress PDF API Tool from pdfRest to programmatically compress PDF files with C#.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Compress PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcompress-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fcompressed-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcompress-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Compress PDF, File Size\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Compress PDF Files in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-files-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3865,3866,3867,3868,3869],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1736,"name":1737,"slug":1738,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1740,"name":1741,"slug":1742,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-compress-pdf-files-in-net-with-c\u002F","How to Compress PDF Files in .NET with C#, Tutorial | pdfRest",{"id":3874,"uuid":3875,"title":3876,"slug":3877,"html":3878,"comment_id":3879,"feature_image":48,"featured":284,"visibility":1257,"created_at":3880,"updated_at":3861,"published_at":3880,"custom_excerpt":3881,"codeinjection_head":3882,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3883,"primary_tag":3889,"url":3890,"excerpt":3881,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3891,"meta_description":3881,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b137e","cf233ef4-8b69-41f7-9796-057527004ef1","How to Compress PDF Files with JavaScript in NodeJS","how-to-compress-pdf-files-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Compress PDF with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>Compressing PDF files is an essential task for optimizing storage space and improving download and upload times. The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcompress-pdf\u002F'>Compress PDF API Tool\u003C\u002Fa> provides a straightforward way to reduce PDF file sizes programmatically. This tutorial will demonstrate how to send an API call to Compress PDF using JavaScript.\u003C\u002Fp>\n\u003Cp>For instance, if you're building a web application that allows users to upload reports, compressing these PDFs before storing them can save server space and make the reports quicker to access for users.\u003C\u002Fp>\n\n\u003Ch2>Compress PDF with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to reduce the file size of a PDF.\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('compression_level', 'medium');\ndata.append('output', 'pdfrest_compressed_pdf');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fcompressed-pdf', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source code reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fcompressed-pdf.js\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the JavaScript Code\u003C\u002Fh2>\n\n\u003Cp>The code provided demonstrates how to compress a PDF file using the pdfRest API in JavaScript:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\u003C\u002Fpre>\n\n\u003Cp>This initializes the required modules: \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests, \u003Ccode>FormData\u003C\u002Fcode> to construct the multipart form data, and \u003Ccode>fs\u003C\u002Fcode> to handle the file system.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('compression_level', 'medium');\ndata.append('output', 'pdfrest_compressed_pdf');\n\u003C\u002Fpre>\n\n\u003Cp>Here, a new \u003Ccode>FormData\u003C\u002Fcode> object is created and the PDF file along with compression parameters are appended to it. The \u003Ccode>'compression_level'\u003C\u002Fcode> can be \u003Ccode>'low'\u003C\u002Fcode>, \u003Ccode>'medium'\u003C\u002Fcode>, or \u003Ccode>'high'\u003C\u002Fcode>, depending on the desired compression ratio.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  \u002F\u002F ... other configuration options\n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>config\u003C\u002Fcode> object contains the request configuration, including the API endpoint URL, headers (with your API key), and the data payload.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>axios\u003C\u002Fcode> library is used to send the request. The response is then logged to the console, or an error is logged if the request fails.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you've learned how to make an API call to compress a PDF file using JavaScript. This is a practical skill for any web application that handles PDFs, as it allows for efficient file management and faster data transfer. To explore the full capabilities of the pdfRest API, you can demo all of the pdfRest API Tools in the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcompress-pdf\u002F\">Cloud API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can also be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fcompressed-pdf.js\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","65a1c7682d4014c9499b3e16","2024-01-12T23:12:40.000+00:00","Learn how to compress PDF files programmatically with JavaScript using the Compress PDF API Tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-files-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Compress PDF Files with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-files-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-files-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-01-12T23:12:40.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:54.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to compress PDF files programmatically with JavaScript using the Compress PDF API Tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Compress PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcompress-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fcompressed-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcompress-pdf\"\n        }\n      ],\n      \"keywords\": \"Compress PDF, File Size, JavaScript\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Compress PDF Files with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-files-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3884,3885,3886,3887,3888],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1736,"name":1737,"slug":1738,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1740,"name":1741,"slug":1742,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-compress-pdf-files-with-javascript-in-nodejs\u002F","How to Compress PDF Files with JavaScript in NodeJS, Tutorial | pdfRest",{"id":3893,"uuid":3894,"title":3895,"slug":3896,"html":3897,"comment_id":3898,"feature_image":48,"featured":284,"visibility":1257,"created_at":3899,"updated_at":3900,"published_at":3899,"custom_excerpt":3901,"codeinjection_head":3902,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3903,"primary_tag":3909,"url":3910,"excerpt":3901,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3911,"meta_description":3901,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b137f","dc2e91c0-3dd1-4fc7-93a8-3a46d00c94a3","How to Compress PDF Files with PHP","how-to-compress-pdf-files-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Compress PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcompress-pdf\u002F'>Compress PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to reduce the size of PDF files programmatically. Compressing PDFs can be crucial in many scenarios, such as when you need to send large documents via email, save storage space, or improve website load times by serving smaller files.\u003C\u002Fp> \n\u003Cp>\u003C\u002Fp>This tutorial will demonstrate how to send an API call to Compress PDF using PHP, a popular server-side scripting language.\u003C\u002Fp>\n\n\u003Ch2>Compress PDF with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">\nrequire 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\n$headers = [\n  'Api-Key' =--> 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile', \u002F\u002F Set the filename for the file to be compressed, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'compression_level', \u002F\u002F Specify the field name for the compression level.\n      'contents' => 'medium' \u002F\u002F Set the value for the compression level (in this case, 'medium').\n    ],\n    [\n      'name' => 'output', \u002F\u002F Specify the field name for the output option.\n      'contents' => 'pdfrest_compressed_pdf' \u002F\u002F Set the value for the output option (in this case, 'pdfrest_compressed_pdf').\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fcompressed-pdf', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the compressed PDF content.\n\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source of the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fcompressed-pdf.php\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the PHP Code\u003C\u002Fh2>\n\n\u003Cp>This code snippet demonstrates how to use the Guzzle HTTP client to send a multipart\u002Fform-data POST request to the pdfRest API to compress a PDF file.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>$headers\u003C\u002Fcode> array includes the 'Api-Key' which is used for authentication with the pdfRest API.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>$options\u003C\u002Fcode> array specifies the multipart body of the request. It contains three parts:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Cstrong>file:\u003C\u002Fstrong> The file to be compressed. It includes the 'contents', which is a stream of the file opened for reading, and 'filename', which is the path to the file.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>compression_level:\u003C\u002Fstrong> The desired level of compression, which can be 'low', 'medium', or 'high'.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>output:\u003C\u002Fstrong> The name of the output file or the option to return the compressed PDF content.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>The \u003Ccode>new Request()\u003C\u002Fcode> function creates a new HTTP POST request with the specified endpoint and headers. The \u003Ccode>$client->sendAsync()\u003C\u002Fcode> function sends the request and \u003Ccode>wait()\u003C\u002Fcode> is called to wait for the response. Finally, \u003Ccode>$res->getBody()\u003C\u002Fcode> outputs the response body.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we have learned how to compress a PDF file using the pdfRest Compress PDF API Tool with PHP. The code sends a multipart request to the pdfRest API, which processes the file and returns the compressed PDF content.\u003C\u002Fp>\n\n\u003Cp>To explore all of the pdfRest API Tools, you can demo them in the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcompress-pdf\u002F\">Cloud API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fcompressed-pdf.php\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","65a469ca2d4014c9499b3e21","2024-01-14T23:10:02.000+00:00","2026-09-02T18:27:03.000+00:00","Learn how to use pdfRest Compress PDF API Tool with PHP to compress PDF files and reduce file size.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-files-with-php\u002F#article\",\n      \"headline\": \"How to Compress PDF Files with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-files-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-files-with-php\u002F\",\n      \"datePublished\": \"2024-01-14T23:10:02.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:54.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Compress PDF API Tool with PHP to compress PDF files and reduce file size.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Compress PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcompress-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fcompressed-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcompress-pdf\"\n        }\n      ],\n      \"keywords\": \"Compress PDF, File Size, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Compress PDF Files with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-files-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3904,3905,3906,3907,3908],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1736,"name":1737,"slug":1738,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1740,"name":1741,"slug":1742,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-compress-pdf-files-with-php\u002F","How to Compress PDF Files with PHP, Tutorial | pdfRest",{"id":3913,"uuid":3914,"title":3915,"slug":3916,"html":3917,"comment_id":3913,"feature_image":48,"featured":284,"visibility":1257,"created_at":3918,"updated_at":3900,"published_at":3918,"custom_excerpt":3919,"codeinjection_head":3920,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3921,"primary_tag":3927,"url":3928,"excerpt":3919,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3929,"meta_description":3919,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65eb594b533c9f26b9436817","968540d5-0ed7-4182-ae1e-155a05069d2c","How to Compress PDF with cURL","how-to-compress-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Compress PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcompress-pdf\u002F'>Compress PDF API Tool\u003C\u002Fa> is an invaluable resource for reducing the size of PDF files while maintaining their quality. This tool can be particularly useful when dealing with large documents that need to be shared or stored efficiently. This tutorial will guide you through the process of sending an API call to Compress PDF using cURL, a powerful command-line tool used for transferring data with URLs.\u003C\u002Fp>\n\n\u003Cp>Imagine you need to email a large PDF report to your colleagues, but your email service has a file size limit. Or perhaps you need to upload a PDF to a website that restricts the upload size. In such scenarios, using the Compress PDF API can significantly reduce the file size, making it easier to share and upload documents without compromising on the quality of the content.\u003C\u002Fp>\n\n\u003Ch2>Compress PDF with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fcompressed-pdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\" \\\n  -F \"compression_level=medium\"\n\u003C\u002Fpre>\n\n\u003Cp>Reference to the code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fcompressed-pdf.sh\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This cURL command is used to send a POST request to the pdfRest Compress PDF API endpoint:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fcompressed-pdf\"\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>-X POST\u003C\u002Fcode> flag specifies the request method, which is POST in this case.\u003C\u002Fp>\n\n\u003Cp>Headers are added to the request to indicate the expected response format and the content type of the request:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\n-H \"Content-Type: multipart\u002Fform-data\"\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>Accept: application\u002Fjson\u003C\u002Fcode> header tells the server that the client expects a JSON response. The \u003Ccode>Content-Type: multipart\u002Fform-data\u003C\u002Fcode> header is used because the request will include a file upload.\u003C\u002Fp>\n\n\u003Cp>The API key is included as a header for authentication:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\u003C\u002Fpre>\n\n\u003Cp>Replace \u003Ccode>xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\u003C\u002Fcode> with your actual API key.\u003C\u002Fp>\n\n\u003Cp>The file to be compressed is included in the form data:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>-F\u003C\u002Fcode> flag is used to specify each piece of form data. The \u003Ccode>file=@\u002Fpath\u002Fto\u002Ffile\u003C\u002Fcode> form field specifies the file path for the PDF to be compressed.\u003C\u002Fp>\n\n\u003Cp>Additional form fields specify the output file name and the desired compression level:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\n-F \"compression_level=medium\"\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>output\u003C\u002Fcode> field determines the name of the output file, and \u003Ccode>compression_level\u003C\u002Fcode> can be set to 'low', 'medium', or 'high', depending on the desired balance between file size and quality.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following this tutorial, you have learned how to compress a PDF using the pdfRest Compress PDF API with cURL. This capability can be a game-changer when it comes to managing and distributing PDF files efficiently.\u003C\u002Fp>\n\n\u003Cp>Feel free to explore and demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further information and detailed documentation, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcompress-pdf\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fcompressed-pdf.sh\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-08T18:30:35.000+00:00","Learn how to compress a PDF file to reduce file size using pdfRest Compress PDF API Tool with cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Compress PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-with-curl\u002F\",\n      \"datePublished\": \"2024-03-08T18:30:35.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:43.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to compress a PDF file to reduce file size using pdfRest Compress PDF API Tool with cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Compress PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcompress-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fcompressed-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcompress-pdf\"\n        }\n      ],\n      \"keywords\": \"Compress PDF, File Size, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Compress PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3922,3923,3924,3925,3926],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1736,"name":1737,"slug":1738,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1740,"name":1741,"slug":1742,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-compress-pdf-with-curl\u002F","How to Compress PDF with cURL, Tutorial | pdfRest",{"id":3931,"uuid":3932,"title":3933,"slug":3934,"html":3935,"comment_id":3931,"feature_image":48,"featured":284,"visibility":1257,"created_at":3936,"updated_at":3900,"published_at":3936,"custom_excerpt":3937,"codeinjection_head":3938,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3939,"primary_tag":3945,"url":3946,"excerpt":3937,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3947,"meta_description":3937,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65eb5980533c9f26b9436821","d4b8e588-a645-4723-ab3f-2612a56f7728","How to Compress PDF with Java","how-to-compress-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Compress PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcompress-pdf\u002F'>Compress PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to optimize their PDF files by reducing their size without sacrificing quality. This tutorial will guide you through the process of making an API call to the Compress PDF endpoint using Java. The ability to compress PDFs programmatically allows for seamless integration into various workflows, such as document management systems, web applications, or automated batch processing tasks.\u003C\u002Fp>\n\n\u003Cp>You might need to compress a PDF to meet email attachment size limits, save storage space, or improve the speed of document sharing and loading on the web. For instance, a legal firm may need to email a large batch of case files, which are too large to send without compression. By using the Compress PDF API, they can easily reduce the file size while maintaining the necessary level of document clarity and detail.\u003C\u002Fp>\n\n\u003Ch2>Compress PDF with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONObject;\n\npublic class CompressedPDF {\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  private static final String COMPRESSION_LEVEL = \"medium\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"compression_level\", COMPRESSION_LEVEL)\n            .addFormDataPart(\"output\", \"pdfrest_compressed_pdf\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fcompressed-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\n\u003C\u002Fpre>\n\n\u003Cp>This code is sourced from the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FCompressedPDF.java\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by defining constants for the file path and API key, which you can set directly in the code or through environment variables. The \u003Ccode>COMPRESSION_LEVEL\u003C\u002Fcode> is set to \"medium\", but you can adjust this based on your needs.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\nprivate static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\nprivate static final String COMPRESSION_LEVEL = \"medium\";\n\u003C\u002Fpre>\n\n\u003Cp>The main method checks for an input file argument; if none is provided, it uses the default file path. It then creates a multipart request body with the file, compression level, and output name. The API key is set in the request header, and the request is sent to the endpoint \u003Ccode>https:\u002F\u002Fapi.pdfrest.com\u002Fcompressed-pdf\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">\u002F\u002F ... (code for setting up the file and request body) ...\nRequest request = new Request.Builder()\n    .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n    .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fcompressed-pdf\")\n    .post(requestBody)\n    .build();\n\u003C\u002Fpre>\n\n\u003Cp>An \u003Ccode>OkHttpClient\u003C\u002Fcode> is configured with a 60-second read timeout, and the request is executed. The response is printed out, and if it contains a body, the JSON response is formatted and printed.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">OkHttpClient client = new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\nResponse response = client.newCall(request).execute();\n\u002F\u002F ... (code for handling the response) ...\n\u003C\u002Fpre>\n\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps outlined in this tutorial, you've learned how to compress a PDF file using Java and the pdfRest Compress PDF API. This example demonstrates a multipart API call, which is suitable for file uploads and additional form data.\u003C\u002Fp>\n\n\u003Cp>To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further learning and experimentation, you can dive into the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcompress-pdf\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FCompressedPDF.java\">https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FCompressedPDF.java\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-08T18:31:28.000+00:00","Learn how to use pdfRest Compress PDF API Tool with Java to optimally reduce the size of PDF files","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Compress PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-with-java\u002F\",\n      \"datePublished\": \"2024-03-08T18:31:28.000Z\",\n      \"dateModified\": \"2026-09-01T14:52:11.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Compress PDF API Tool with Java to optimally reduce the size of PDF files\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Compress PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcompress-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fcompressed-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcompress-pdf\"\n        }\n      ],\n      \"keywords\": \"Compress PDF, File Size, Java\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Compress PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3940,3941,3942,3943,3944],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1736,"name":1737,"slug":1738,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1740,"name":1741,"slug":1742,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-compress-pdf-with-java\u002F","How to Compress PDF with Java, Tutorial | pdfRest",{"id":3949,"uuid":3950,"title":3951,"slug":3952,"html":3953,"comment_id":3954,"feature_image":48,"featured":284,"visibility":1257,"created_at":3955,"updated_at":3956,"published_at":3955,"custom_excerpt":3957,"codeinjection_head":3958,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3959,"primary_tag":3965,"url":3966,"excerpt":3957,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3967,"meta_description":3957,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1355","af0d6422-81c0-4c23-b252-1ca21c6ab8aa","How to Compress PDF with Python","how-to-compress-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Compress PDFs via API?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcompress-pdf\u002F\">Compress PDF API Tool\u003C\u002Fa> is a powerful resource for developers and businesses looking to reduce the size of their PDF files without compromising on quality.\u003C\u002Fp>\n\n\u003Cp>This tutorial will guide you through the process of making an API call to the Compress PDF endpoint using Python. Compressing PDFs is particularly useful in scenarios where you need to save storage space, speed up file transfers, or meet file size requirements for email attachments or website uploads.\u003C\u002Fp>\n\n\u003Ch2>Python Code Example for Compression\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\ncompressed_pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fcompressed-pdf'\n\n# The \u002Fcompressed-pdf endpoint can take a single PDF file or id as input.\n# This sample demonstrates setting compression_level to 'medium'.\n# We have preset 'high', 'medium', and 'low' compression levels available for use. These preset levels do not require the 'profile' parameter.\nmp_encoder_compressedPdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_compressedPdf_out',\n        'compression_level': 'medium',\n    }\n)\n\n# Let's set the headers that the compressed-pdf endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_compressedPdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to compressed-pdf endpoint...\")\nresponse = requests.post(compressed_pdf_endpoint_url, data=mp_encoder_compressedPdf, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>The code above is sourced from the pdfRest API samples repository on GitHub, specifically from \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fcompressed-pdf.py\">this file\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Python Code\u003C\u002Fh2>\n\n\u003Cp>The sample uses \u003Ccode>requests\u003C\u002Fcode> to send the HTTP request, \u003Ccode>MultipartEncoder\u003C\u002Fcode> from \u003Ccode>requests-toolbelt\u003C\u002Fcode> to build a multipart body, and \u003Ccode>json\u003C\u002Fcode> to format the response. Install the two external packages with \u003Ccode>python -m pip install requests requests-toolbelt\u003C\u002Fcode> if they are not already available.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">compressed_pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fcompressed-pdf'\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>\u002Fcompressed-pdf\u003C\u002Fcode> accepts either an uploaded PDF or an existing pdfRest resource ID. This multipart example uploads the source directly.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_compressedPdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output': 'example_compressedPdf_out',\n        'compression_level': 'medium',\n    }\n)\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>file\u003C\u002Fcode> tuple supplies the multipart filename, binary stream, and PDF media type. \u003Ccode>output\u003C\u002Fcode> sets the generated filename without its extension. \u003Ccode>compression_level\u003C\u002Fcode> accepts \u003Ccode>low\u003C\u002Fcode>, \u003Ccode>medium\u003C\u002Fcode>, \u003Ccode>high\u003C\u002Fcode>, or \u003Ccode>custom\u003C\u002Fcode>. The preset levels balance output fidelity against size reduction; \u003Ccode>custom\u003C\u002Fcode> additionally requires a compression profile or profile resource ID.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_compressedPdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>MultipartEncoder.content_type\u003C\u002Fcode> contains both \u003Ccode>multipart\u002Fform-data\u003C\u002Fcode> and the generated boundary, so it must be passed through unchanged. \u003Ccode>Api-Key\u003C\u002Fcode> authenticates the call, while \u003Ccode>Accept: application\u002Fjson\u003C\u002Fcode> requests the standard resource response.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(\n    compressed_pdf_endpoint_url,\n    data=mp_encoder_compressedPdf,\n    headers=headers\n)\u003C\u002Fpre>\n\n\u003Cp>The encoder is supplied as the request body rather than through \u003Ccode>json=\u003C\u002Fcode> or \u003Ccode>files=\u003C\u002Fcode>. This keeps the file and conversion parameters in the same multipart request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent=2))\nelse:\n    print(response.text)\u003C\u002Fpre>\n\n\u003Cp>A successful response describes the generated PDF resource, including the ID and retrieval information used by later API calls. The failure branch prints the service response so validation and processing errors are not hidden.\u003C\u002Fp>\n\n\u003Ch2>Compression and So Much More\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we walked through a Python script that calls the pdfRest Compress PDF API to compress a PDF file. By following the steps outlined, you can integrate this functionality into your own applications. To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcompress-pdf\u002F\">API Reference documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fcompressed-pdf.py\">this GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","658216352d4014c9499b3a02","2023-12-19T22:16:21.000+00:00","2026-09-02T18:27:04.000+00:00","Learn how to make a PDF smaller with Python by calling the Compress PDF API Tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Compress PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-with-python\u002F\",\n      \"datePublished\": \"2023-12-19T22:16:21.000Z\",\n      \"dateModified\": \"2026-09-01T14:25:28.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to make a PDF smaller with Python by calling the Compress PDF API Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Compress PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcompress-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fcompressed-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcompress-pdf\"\n        }\n      ],\n      \"keywords\": \"Compress PDF, File Size, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Compress PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-compress-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3960,3961,3962,3963,3964],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1736,"name":1737,"slug":1738,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1740,"name":1741,"slug":1742,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-compress-pdf-with-python\u002F","How to Compress PDF with Python, Tutorial | pdfRest",{"id":3969,"uuid":3970,"title":3971,"slug":3972,"html":3973,"comment_id":3969,"feature_image":48,"featured":284,"visibility":1257,"created_at":3974,"updated_at":3975,"published_at":3974,"custom_excerpt":3976,"codeinjection_head":3977,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3978,"primary_tag":3983,"url":3984,"excerpt":3976,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":3985,"meta_description":3976,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65c6a7c9533c9f26b943624d","6cc5091f-9c09-4c32-bb4a-c7b691dfd146","How to Convert BMP to PDF in .NET with C#","how-to-convert-bmp-to-pdf-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert BMP to PDF with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> is a powerful resource for developers who need to convert documents into PDF format programmatically. This tutorial will guide you through the process of sending an API call to Convert to PDF using C#.\u003C\u002Fp> \n  \n\u003Cp>A real-world example of why a user might use Convert to PDF could be an enterprise application that generates reports in various formats and needs to standardize them into PDFs for archiving, sharing, or printing.\u003C\u002Fp>\n\n\u003Ch2>Convert BMP to PDF with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name.bmp\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"text\u002Fhtml\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"output.pdf\"));\n        multipartContent.Add(byteArrayOption, \"output\");\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.cs\">pdfRest API C# Sample Code\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code above demonstrates how to make a multipart\u002Fform-data POST request to the pdfRest API to convert a document to PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>This line initializes a new \u003Ccode>HttpClient\u003C\u002Fcode> instance with the base address set to the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>The API key is added to the request headers. Replace \u003Ccode>\"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\u003C\u002Fcode> with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\nmultipartContent.Add(byteAryContent, \"file\", \"file_name\");\n\u003C\u002Fpre>\n\n\u003Cp>Here, the file to be converted is read into a byte array and added to the multipart form data content with the name \u003Ccode>\"file\"\u003C\u002Fcode>. Replace \u003Ccode>\"\u002Fpath\u002Fto\u002Ffile\"\u003C\u002Fcode> with the path to your source file, and \u003Ccode>\"file_name\"\u003C\u002Fcode> with the actual file name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"text\u002Fhtml\");\n\u003C\u002Fpre>\n\n\u003Cp>The content type for the file is set to \u003Ccode>\"text\u002Fhtml\"\u003C\u002Fcode>. This should be changed to match the content type of your source file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\nvar apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the request is sent asynchronously, and the response is read as a string. The result is then printed to the console.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've accomplished the task of converting a document to PDF using the pdfRest API and C#. The code sample provided demonstrates a multipart\u002Fform-data request, which is suitable for file uploads. We encourage you to demo all of the pdfRest API Tools in the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\u003C\u002Fa> and to refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa> for further exploration and understanding of the full capabilities of the API.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.cs\">JSON Payload Examples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-09T22:31:37.000+00:00","2026-09-02T18:27:05.000+00:00","Learn how to use .NET to convert BMP image files to PDF files by calling Convert to PDF API Tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert BMP to PDF in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-02-09T22:31:37.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:49.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use .NET to convert BMP image files to PDF files by calling Convert to PDF API Tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Convert to PDF\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert BMP to PDF in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3979,3980,3981,3982],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-bmp-to-pdf-in-net-with-c\u002F","How to Convert BMP to PDF in .NET with C#, Tutorial | pdfRest",{"id":3987,"uuid":3988,"title":3989,"slug":3990,"html":3991,"comment_id":3987,"feature_image":48,"featured":284,"visibility":1257,"created_at":3992,"updated_at":2995,"published_at":2995,"custom_excerpt":3993,"codeinjection_head":3994,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":3995,"primary_tag":4002,"url":4003,"excerpt":3993,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4004,"meta_description":3993,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a9750cb533c9f26b943b74a","e7aa8bac-5d87-49d4-b25f-9fa03a9431cd","How to Convert BMP to PDF with cURL","how-to-convert-bmp-to-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This tutorial shows you how to convert BMP to PDF with cURL through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool\u003C\u002Fa>. You'll see how the upload, headers, operation fields, and JSON response fit together in a command that can convert BMP to PDF from a terminal or script.\u003C\u002Fp>\n\n\u003Ch2>Why Convert BMP to PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>BMP files still appear in equipment exports, legacy imaging systems, and older desktop workflows, but their large uncompressed images are inconvenient to distribute. Converting them to PDF gives downstream applications a familiar document format.\u003C\u002Fp>\n\n\u003Cp>A manufacturing system, for example, might export a diagnostic diagram as BMP while a service portal expects every case artifact to be a PDF. A simple cURL conversion can normalize that image before it is merged into the customer record.\u003C\u002Fp>\n\n\u003Cp>The filename supplied with the multipart upload identifies the source format. For that reason, the example uses a \u003Ccode>.bmp\u003C\u002Fcode> path rather than sending an extensionless file.\u003C\u002Fp>\n\n\u003Ch2>cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\ncurl -X POST \"$API_URL\u002Fpdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Finput.bmp\" \\\n  -F \"output=pdfrest_bmp_to_pdf\"\u003C\u002Fpre>\n\n\u003Cp>Source for Convert BMP to PDF: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.sh\">View the cURL sample on GitHub\u003C\u002Fa>. The repository's generic Convert to PDF scaffold is configured here with a \u003Ccode>.bmp\u003C\u002Fcode> input for this tutorial.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Choose the pdfRest service region\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>The BMP sample stores the selected pdfRest hostname in \u003Ccode>API_URL\u003C\u002Fcode>. Uncomment the EU value only when the BMP upload and every later request that uses its PDF output will remain in that same region.\u003C\u002Fp>\n\n\u003Ch3>Build the authenticated multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"$API_URL\u002Fpdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\u003C\u002Fpre>\n\n\u003Cp>cURL posts the bitmap to \u003Ccode>\u002Fpdf\u003C\u002Fcode> and asks for a JSON result. The multipart header prepares the request for a binary file part, while \u003Ccode>Api-Key\u003C\u002Fcode> authorizes this BMP conversion.\u003C\u002Fp>\n\n\u003Ch3>Upload the input file data\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Finput.bmp\" \\\u003C\u002Fpre>\n\n\u003Cp>The Convert BMP to PDF request reads the local source from the path after \u003Ccode>@\u003C\u002Fcode> and sends its bytes in the multipart \u003Ccode>file\u003C\u002Fcode> field. For Convert BMP to PDF, cURL treats the path as an upload rather than ordinary form text.\u003C\u002Fp>\n\n\u003Ch3>Set the operation-specific fields\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">-F \"output=pdfrest_bmp_to_pdf\"\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>output\u003C\u002Fcode> field requests a recognizable base name for the PDF created from the BMP. The source extension, rather than another form setting, tells the shared endpoint which conversion path to use.\u003C\u002Fp>\n\n\u003Ch3>Read the generated resource response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"$API_URL\u002Fpdf\" \\\u003C\u002Fpre>\n\n\u003Cp>After BMP conversion, the JSON response identifies the new PDF with an output ID and download information. Capture that PDF resource data before using the result in a merge or another document operation.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This walkthrough gives you a reusable cURL pattern for turning BMP output into a PDF resource that can participate in later merge, security, or document-management steps.\u003C\u002Fp>\n\n\u003Cp>BMP inputs can be unusually large or have unexpected pixel dimensions. Test representative device exports and review the generated page orientation and image scale before automating a high-volume intake workflow.\u003C\u002Fp>\n\n\u003Cp>Continue exploring the Convert BMP to PDF workflow in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the complete Convert BMP to PDF request contract, accepted values, defaults, and limitations, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: The Convert BMP to PDF example above uploads a file with multipart form data. For source content already stored in pdfRest, the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.sh\">Convert BMP to PDF JSON payload example\u003C\u002Fa> shows the resource-ID request shape.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T22:25:15.000+00:00","Learn how to convert a BMP image into a standardized PDF document with cURL and the pdfRest Convert to PDF API Tool.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Convert BMP to PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-curl\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert a BMP image into a standardized PDF document with cURL and the pdfRest Convert to PDF API Tool.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"BMP, Conversion, Convert to PDF, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert BMP to PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[3996,3997,3998,3999,4000,4001],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1530,"name":1531,"slug":1532,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-bmp-to-pdf-with-curl\u002F","How to Convert BMP to PDF with cURL, Tutorial | pdfRest",{"id":4006,"uuid":4007,"title":4008,"slug":4009,"html":4010,"comment_id":4006,"feature_image":48,"featured":284,"visibility":1257,"created_at":4011,"updated_at":3975,"published_at":3788,"custom_excerpt":4012,"codeinjection_head":4013,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4014,"primary_tag":4021,"url":4022,"excerpt":4012,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4023,"meta_description":4012,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c56533c9f26b943b492","4fb30d0b-fa3c-4587-9874-11c93a587276","How to Convert BMP to PDF with Java","how-to-convert-bmp-to-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>Follow this Java walkthrough to convert BMP to PDF with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool\u003C\u002Fa>. The example adapts the shared \u003Ccode>\u002Fpdf\u003C\u002Fcode> request with a BMP filename and media type so the service selects the correct conversion path. Along the way, you'll see which fields are needed to convert BMP to PDF and how the response fits into later processing.\u003C\u002Fp>\n\n\u003Ch2>Why Convert BMP to PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>Legacy imaging systems and device exports still produce BMP files that are inconvenient to distribute or combine with ordinary business documents. Converting each image to PDF gives downstream systems a consistent document format.\u003C\u002Fp>\n\n\u003Cp>The adapted Java example uploads a \u003Ccode>.bmp\u003C\u002Fcode> file to \u003Ccode>\u002Fpdf\u003C\u002Fcode> with the \u003Ccode>image\u002Fbmp\u003C\u002Fcode> media type. The uploaded filename is important because Convert to PDF uses the extension when selecting its converter.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class ConvertBMPToPDF {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.bmp\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"image\u002Fbmp\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_bmp_to_pdf\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPDF.java\">Java sample on GitHub\u003C\u002Fa>. This version adjusts the general Java example to make Convert BMP to PDF explicit.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The library group brings together the HTTP client, environment-based API key loading, and JSON utilities used later in the example.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.bmp\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>This initialization step shows where the input comes from and keeps the credential outside the request-building logic.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"image\u002Fbmp\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_bmp_to_pdf\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The adapted Java example uploads a \u003Ccode>.bmp\u003C\u002Fcode> file to \u003Ccode>\u002Fpdf\u003C\u002Fcode> with the \u003Ccode>image\u002Fbmp\u003C\u002Fcode> media type. The uploaded filename is important because Convert to PDF uses the extension when selecting its converter. The multipart builder packages fields and files together without hard-coding a \u003Ccode>Content-Type\u003C\u002Fcode> boundary.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The authenticated call reads the credential through dotenv and targets the endpoint shown in the source, with the EU hostname documented beside the default US value.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>The final section checks the server result before treating the body as output and exposes diagnostic JSON when the operation cannot be completed.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial showed how a Java application can convert BMP to PDF. With that foundation, this approach supports archival intake, equipment output, scanned diagrams, and image-to-document normalization.\u003C\u002Fp>\n\n\u003Cp>For production use, keep in mind that bMP sources can be large and may have unusual pixel dimensions, so verify page orientation and visual scale with representative device exports. When several images belong in one deliverable, convert them individually and pass the resulting PDF resource IDs to Merge PDFs in the required order.\u003C\u002Fp>\n\n\u003Cp>Use \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> to inspect the request and output from the Convert BMP to PDF operation. For the complete set of options supported by Convert BMP to PDF, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: The Convert BMP to PDF example above uses multipart form data; for an existing resource rather than a new upload, follow the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPDF.java\">JSON payload example\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T17:33:10.000+00:00","Convert BMP images into standardized PDF documents from a Java application.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Convert BMP to PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:32.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:32.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert BMP images into standardized PDF documents from a Java application.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"BMP, Conversion, Convert to PDF, Java\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert BMP to PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4015,4016,4017,4018,4019,4020],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1530,"name":1531,"slug":1532,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-bmp-to-pdf-with-java\u002F","Convert BMP to PDF with Java | pdfRest",{"id":4025,"uuid":4026,"title":4027,"slug":4028,"html":4029,"comment_id":4025,"feature_image":48,"featured":284,"visibility":1257,"created_at":4030,"updated_at":3975,"published_at":4030,"custom_excerpt":4031,"codeinjection_head":4032,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4033,"primary_tag":4038,"url":4039,"excerpt":4031,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4040,"meta_description":4031,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65f7aee8533c9f26b9436aa6","02c9df6b-cb60-4178-be5a-18a3dd835b0a","How to Convert BMP to PDF with JavaScript in NodeJS","how-to-convert-bmp-to-pdf-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert BMP to PDF with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> is a powerful resource for developers who need to convert various document formats into PDFs programmatically. This API provides a seamless way to integrate PDF conversion into web applications or services, enabling automated document workflows.\u003C\u002Fp>\n  \n\u003Cp>This tutorial will guide you through the process of sending an API call to Convert to PDF using JavaScript, which is a popular language for web development and can be easily included in Node.js scripts or server-side applications.\u003C\u002Fp>\n\n\u003Cp>In the real world, a user might need to convert documents to PDF for consistent viewing across different platforms and devices, ensuring that the formatting remains intact. For instance, a business might need to convert invoices, reports, or contracts into PDFs before sending them to clients. By automating this process with JavaScript, the business can save time and reduce the potential for human error, while maintaining a professional standard for their documents.\u003C\u002Fp>\n\n\u003Ch2>Convert BMP to PDF with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('compression', 'lossy'); \ndata.append('downsample', '300'); \ndata.append('tagged_pdf', 'off'); \ndata.append('output', 'pdfrest_pdf');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Reference to the code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.js\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code above demonstrates how to create a multipart request to the pdfRest API for converting a document to PDF. Let's break it down:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var FormData = require('form-data');\nvar fs = require('fs');\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\n\u003C\u002Fpre>\n\n\u003Cp>This snippet initializes a new FormData object and appends a file to it for conversion. The 'fs.createReadStream' function reads the file from the specified path, which should be replaced with the actual file path.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">data.append('compression', 'lossy'); \ndata.append('downsample', '300'); \ndata.append('tagged_pdf', 'off'); \ndata.append('output', 'pdfrest_pdf');\n\u003C\u002Fpre>\n\n\u003Cp>These lines add additional parameters to the form data:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Cstrong>compression\u003C\u002Fstrong>: The type of compression to be applied to the PDF. 'lossy' allows for smaller file sizes at the cost of some quality.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>downsample\u003C\u002Fstrong>: The resolution to which images should be downsampled, specified in dots per inch (DPI).\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>tagged_pdf\u003C\u002Fstrong>: Whether to create a tagged PDF ('on' or 'off'). Tagged PDFs are useful for accessibility purposes.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>output\u003C\u002Fstrong>: The name of the output parameter, which in this case is set to 'pdfrest_pdf'.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\n\u003C\u002Fpre>\n\n\u003Cp>This configuration object includes the request method, URL, headers (including the API key which you must replace with your own), and the data payload. The 'maxBodyLength' is set to Infinity to allow for large files.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\u003C\u002Fpre>\n\n\u003Cp>The 'axios' library is used to send the request. Upon success, the response data is logged to the console. In case of an error, it is also logged to the console.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps in this tutorial, you've learned how to convert documents to PDF using the pdfRest API and JavaScript. This can be integrated into your applications to automate the process of document conversion and streamline your document management workflows.\u003C\u002Fp>\n\n\u003Cp>Feel free to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, check out the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.js\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-18T03:03:04.000+00:00","Learn how to use JavaScript in NodeJS to turn BMP images into PDF documents by calling the Convert to PDF API Tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert BMP to PDF with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-03-18T03:03:04.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:39.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use JavaScript in NodeJS to turn BMP images into PDF documents by calling the Convert to PDF API Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF, JavaScript\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert BMP to PDF with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4034,4035,4036,4037],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-bmp-to-pdf-with-javascript-in-nodejs\u002F","How to Convert BMP to PDF with JavaScript in NodeJS, Tutorial | pdfRest",{"id":4042,"uuid":4043,"title":4044,"slug":4045,"html":4046,"comment_id":4042,"feature_image":48,"featured":284,"visibility":1257,"created_at":4047,"updated_at":4048,"published_at":4047,"custom_excerpt":4049,"codeinjection_head":4050,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4051,"primary_tag":4056,"url":4057,"excerpt":4049,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4058,"meta_description":4049,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65f7af7a533c9f26b9436ab0","d258c4ec-db92-4464-9f20-9f3429952352","How to Convert BMP to PDF with PHP","how-to-convert-bmp-to-pdf-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert BMP to PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to automate the conversion of various file types to PDF format. Utilizing this API, you can easily integrate PDF conversion functionality into your PHP applications, enhancing the capabilities of your software and providing a seamless user experience.\u003C\u002Fp>\n\n\u003Cp>This tutorial will guide you through the process of sending an API call to Convert to PDF with PHP, illustrating how to interact with the pdfRest API to achieve your document processing goals.\u003C\u002Fp>\n\n\u003Cp>In the real world, there are countless scenarios where converting documents to PDF can be beneficial. For instance, a business might need to convert invoices, reports, or contracts from their native formats into PDFs for archiving, sharing, or compliance purposes. By automating this process with a PHP script, the business can save time, reduce errors, and ensure consistency across all documents. The pdfRest API makes this automation possible, offering a reliable and straightforward method for converting documents to PDF.\u003C\u002Fp>\n\n\u003Ch2>Convert BMP to PDF with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'compression',\n      'contents' => 'lossless'\n    ],\n    [\n      'name' => 'downsample',\n      'contents' => '300'\n    ],\n    [\n      'name' => 'tagged_pdf',\n      'contents' => 'off'\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_pdf'\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source of the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.php\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided PHP script uses the Guzzle HTTP client to send an API request to the pdfRest Convert to PDF endpoint. Here's a breakdown of the key components:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\u003C\u002Fpre>\n\n\u003Cp>This line includes the Composer-generated autoload file to automatically load the Guzzle HTTP client and other dependencies.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>$headers\u003C\u002Fcode> array contains the API key required for authentication with the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n    ]\n  ]\n];\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>$options\u003C\u002Fcode> array specifies the multipart form data to be sent with the request. Each element in the 'multipart' array represents a different field to be included in the form data:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Ccode>'file'\u003C\u002Fcode>: The file to be converted. It includes the file path, the file contents, and the Content-Type header.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>'compression'\u003C\u002Fcode>: The compression setting for the PDF.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>'downsample'\u003C\u002Fcode>: The downsample resolution for images within the PDF.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>'tagged_pdf'\u003C\u002Fcode>: Whether to create a tagged PDF (useful for accessibility).\u003C\u002Fli>\n  \u003Cli>\u003Ccode>'output'\u003C\u002Fcode>: The name of the output file.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-php\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', $headers);\n$res = $client->sendAsync($request, $options)->wait();\n\u003C\u002Fpre>\n\n\u003Cp>A new HTTP POST request is created and sent asynchronously. The response is then waited on and the body of the response, which contains the processed PDF content, is outputted.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps in this tutorial, you've learned how to make an API call to pdfRest's Convert to PDF endpoint using PHP. This allows you to programmatically convert files to PDF format, which can be integrated into various applications and workflows.\u003C\u002Fp>\n\n\u003Cp>To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For a comprehensive understanding of the capabilities and options available, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.php\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-18T03:05:30.000+00:00","2026-09-10T20:19:07.000+00:00","Learn how to use PHP to turn BMP images into PDF documents by calling the Convert to PDF API Tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-php\u002F#article\",\n      \"headline\": \"How to Convert BMP to PDF with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-php\u002F\",\n      \"datePublished\": \"2024-03-18T03:05:30.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:39.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use PHP to turn BMP images into PDF documents by calling the Convert to PDF API Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert BMP to PDF with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4052,4053,4054,4055],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-bmp-to-pdf-with-php\u002F","How to Convert BMP to PDF with PHP, Tutorial | pdfRest",{"id":4060,"uuid":4061,"title":4062,"slug":4063,"html":4064,"comment_id":4060,"feature_image":48,"featured":284,"visibility":1257,"created_at":4065,"updated_at":4066,"published_at":4065,"custom_excerpt":4067,"codeinjection_head":4068,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4069,"primary_tag":4076,"url":4077,"excerpt":4067,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4078,"meta_description":4067,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65f7b19f533c9f26b9436ac6","d3088b75-126e-4e5f-b063-557223731873","How to Convert BMP to PDF with Python","how-to-convert-bmp-to-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert BMP to PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> is a powerful resource for developers needing to convert various file formats into PDF. This API provides a simple way to programmatically convert files like images, text documents, and more into a universally accepted PDF format.\u003C\u002Fp>\n  \n\u003Cp>This tutorial will guide you through the process of sending an API call to Convert to PDF using Python, a popular programming language known for its simplicity and readability.\u003C\u002Fp>\n\n\u003Cp>In the real world, converting files to PDF can be essential for ensuring compatibility across different systems and devices. For example, a business might need to convert scanned documents (in BMP format) into PDFs to archive them or to make them easier to share with clients who may not have specialized image viewers. Using Python to automate this process can save time and reduce the risk of human error, especially when dealing with large numbers of files.\u003C\u002Fp>\n\n\u003Ch2>Convert BMP to PDF with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\npdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf'\n\nmp_encoder_pdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.bmp', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'image\u002Fbmp'),\n        'output' : 'example_pdf_out',\n    }\n)\n\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to pdf endpoint...\")\nresponse = requests.post(pdf_endpoint_url, data=mp_encoder_pdf, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Code source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.py\">pdfRest API Python samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code example above demonstrates how to make a multipart\u002Fform-data POST request to the pdfRest Convert to PDF API endpoint using Python. Let's break down the key parts of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\u003C\u002Fpre>\n\n\u003Cp>These lines import the necessary Python modules. The \u003Ccode>MultipartEncoder\u003C\u002Fcode> is used for creating the multipart\u002Fform-data payload, \u003Ccode>requests\u003C\u002Fcode> is for making HTTP requests, and \u003Ccode>json\u003C\u002Fcode> is for handling JSON data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_pdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.bmp', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'image\u002Fbmp'),\n        'output' : 'example_pdf_out',\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>This snippet creates a \u003Ccode>MultipartEncoder\u003C\u002Fcode> object with the file to convert and the desired output name. The 'file' field includes the filename, the file object, and its MIME type.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\u003C\u002Fpre>\n\n\u003Cp>Here, the request headers are set, including the 'Content-Type' which is automatically generated by the \u003Ccode>MultipartEncoder\u003C\u002Fcode>, and the 'Api-Key' which should be replaced with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(pdf_endpoint_url, data=mp_encoder_pdf, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This line sends the POST request to the pdfRest API endpoint with the multipart data and headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>After the request, the code checks if the response is successful. If so, it prints the JSON response; otherwise, it prints the error text.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you've learned how to use Python to call the pdfRest Convert to PDF API, which converts a BMP image to a PDF. This is just one of many possible conversions supported by the API. By successfully making this API call, you've taken a step towards automating document conversion processes within your applications.\u003C\u002Fp>\n\n\u003Cp>To explore further, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for more detailed information about the API's capabilities.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. For code samples using JSON payloads, visit the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.py\">pdfRest API Python samples with JSON payloads\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-18T03:14:39.000+00:00","2026-09-02T18:27:06.000+00:00","Learn how to use Python to turn BMP images into PDF documents by calling the Convert to PDF API Tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Convert BMP to PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-python\u002F\",\n      \"datePublished\": \"2024-03-18T03:14:39.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:39.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use Python to turn BMP images into PDF documents by calling the Convert to PDF API Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"BMP, Conversion, Convert to PDF, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert BMP to PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-bmp-to-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4070,4071,4072,4073,4074,4075],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1530,"name":1531,"slug":1532,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-bmp-to-pdf-with-python\u002F","How to Convert BMP to PDF with Python, Tutorial | pdfRest",{"id":4080,"uuid":4081,"title":4082,"slug":4083,"html":4084,"comment_id":4080,"feature_image":48,"featured":284,"visibility":1257,"created_at":4085,"updated_at":4086,"published_at":4087,"custom_excerpt":4088,"codeinjection_head":4089,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4090,"primary_tag":4099,"url":4100,"excerpt":4088,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4101,"meta_description":4088,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a965176533c9f26b943adba","a798132c-ebb3-410a-8650-1527b86b64e4","How to Convert CSV to PDF in .NET with C#","how-to-convert-csv-to-pdf-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This .NET walkthrough shows how C# can transform CSV data into a styled, tagged PDF table with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. The request defines column widths and alignment along with header, border, row, padding, and pagination behavior.\u003C\u002Fp>\n\n\u003Ch2>Why Convert CSV to PDF in .NET with C#?\u003C\u002Fh2>\n\n\u003Cp>Line-of-business .NET applications often receive CSV exports from ERP, manufacturing, and finance platforms. Although users can open those files in spreadsheet software, the raw export does not provide a controlled layout for approval packets, shift records, or management review.\u003C\u002Fp>\n\n\u003Cp>A production system might export work-center names, exception descriptions, and affected-unit counts at the end of each shift. C# can convert the file into a PDF with a broad description column, right-aligned counts, and repeating headers. The report then fits naturally beside other PDF records for the shift without an operator reformatting the data.\u003C\u002Fp>\n\n\u003Cp>This automation makes the generated document reproducible. Table colors, border rules, spacing, page margins, metadata, and tagging come from application-owned options instead of a workbook that can be changed accidentally.\u003C\u002Fp>\n\n\u003Ch2>C# Code Example for Converting CSV to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">\u002F*\n * What this sample does:\n * - Converts structured CSV input to PDF through the \u002Fpdf endpoint.\n *\n * Setup (environment):\n * - Set PDFREST_API_KEY=your_api_key_here\n * - Optional: set PDFREST_URL to override the API region.\n *\n * Usage:\n *   dotnet run -- pdf-from-csv-multipart \u003CinputFile>\n *\u002F\nusing Newtonsoft.Json.Linq;\nusing System.Net.Http.Headers;\nusing System.Text;\n\nnamespace Samples.EndpointExamples.MultipartPayload;\n\npublic static class PdfFromCsv\n{\n    public static async Task Execute(string[] args)\n    {\n        var inputPath = args.Length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.csv\";\n        var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\n        if (string.IsNullOrWhiteSpace(apiKey)) throw new InvalidOperationException(\"Missing PDFREST_API_KEY\");\n        var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n        using var client = new HttpClient { BaseAddress = new Uri(baseUrl) };\n        client.DefaultRequestHeaders.TryAddWithoutValidation(\"Api-Key\", apiKey);\n        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(\"application\u002Fjson\"));\n        var options = JObject.Parse(@\"{\"\"title\"\":\"\"Structured Content Sample\"\",\"\"language\"\":\"\"en-US\"\",\"\"enable_tagging\"\":true,\"\"page_setup\"\":{\"\"size\"\":\"\"Letter\"\",\"\"orientation\"\":\"\"portrait\"\",\"\"margin\"\":{\"\"top\"\":36,\"\"right\"\":42,\"\"bottom\"\":36,\"\"left\"\":42}},\"\"style\"\":{\"\"font\"\":\"\"Arial\"\",\"\"heading_font\"\":\"\"Arial\"\",\"\"code_font\"\":\"\"Courier\"\",\"\"text_size\"\":11,\"\"text_color_rgb\"\":[34,34,34],\"\"heading_scale\"\":1.35,\"\"table\"\":{\"\"column_width_weights\"\":[2,3,2],\"\"keep_header_with_first_row\"\":true,\"\"repeat_headers_on_overflow\"\":true,\"\"show_borders\"\":true,\"\"border_width\"\":0.75,\"\"border_color_rgb\"\":[180,188,200],\"\"header_fill_color_rgb\"\":[33,64,98],\"\"header_text_color_rgb\"\":[255,255,255],\"\"row_fill_color_rgb\"\":[250,250,252],\"\"alternate_row_fill_color_rgb\"\":[235,240,246],\"\"cell_padding\"\":{\"\"top\"\":6,\"\"right\"\":8,\"\"bottom\"\":6,\"\"left\"\":8}}},\"\"csv\"\":{\"\"first_row_is_header\"\":true,\"\"delimiter\"\":\"\",\"\",\"\"columns\"\":[{\"\"index\"\":0,\"\"width_weight\"\":2,\"\"text_align\"\":\"\"left\"\"},{\"\"index\"\":1,\"\"width_weight\"\":3,\"\"text_align\"\":\"\"left\"\"},{\"\"index\"\":2,\"\"width_weight\"\":1,\"\"text_align\"\":\"\"right\"\"}]}}\");\n        using var form = new MultipartFormDataContent();\n        var inputContent = new ByteArrayContent(await File.ReadAllBytesAsync(inputPath));\n        inputContent.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Foctet-stream\");\n        form.Add(inputContent, \"file\", Path.GetFileName(inputPath));\n        form.Add(new StringContent(options.ToString()), \"structured_text_options\");\n        var response = await client.PostAsync(\"pdf\", form);\n        var result = await response.Content.ReadAsStringAsync();\n        Console.WriteLine(result);\n        if (!response.IsSuccessStatusCode) Environment.ExitCode = 1;\n    }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-csv.cs\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The C# CSV sample uses the framework \u003Ccode>HttpClient\u003C\u002Fcode> APIs and Newtonsoft JSON types for \u003Ccode>structured_text_options\u003C\u002Fcode>. A project adopting this code must retain the Newtonsoft.Json package reference used by the samples repository.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using Newtonsoft.Json.Linq;\nusing System.Net.Http.Headers;\nusing System.Text;\n        using var client = new HttpClient { BaseAddress = new Uri(baseUrl) };\n        using var form = new MultipartFormDataContent();\u003C\u002Fpre>\n\n\u003Cp>The .NET endpoint block shows which regional service receives this CSV request:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">        if (string.IsNullOrWhiteSpace(apiKey)) throw new InvalidOperationException(\"Missing PDFREST_API_KEY\");\n        var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n        using var client = new HttpClient { BaseAddress = new Uri(baseUrl) };\n        client.DefaultRequestHeaders.TryAddWithoutValidation(\"Api-Key\", apiKey);\u003C\u002Fpre>\n\n\u003Cp>C# turns the .csv source into \u003Ccode>StreamContent\u003C\u002Fcode> and preserves its filename in the multipart part. That extension directs the shared \u003Ccode>\u002Fpdf\u003C\u002Fcode> endpoint to the CSV converter.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">    {\n        var inputPath = args.Length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.csv\";\n        var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\u003C\u002Fpre>\n\n\u003Cp>The Newtonsoft \u003Ccode>JObject\u003C\u002Fcode> represents pdfRest’s structured conversion settings. It defines the output title and language, explicitly enables tags, configures Letter portrait pages and margins, and carries the typography and CSV-related style properties used by the renderer.\u003C\u002Fp>\n\n\u003Cpre class=\"language-json\">{\n  \"csv\": {\n    \"first_row_is_header\": true,\n    \"delimiter\": \",\",\n    \"columns\": [\n      {\n        \"index\": 0,\n        \"width_weight\": 2,\n        \"text_align\": \"left\"\n      },\n      {\n        \"index\": 1,\n        \"width_weight\": 3,\n        \"text_align\": \"left\"\n      },\n      {\n        \"index\": 2,\n        \"width_weight\": 1,\n        \"text_align\": \"right\"\n      }\n    ]\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>first_row_is_header\u003C\u002Fcode> defaults to \u003Ccode>true\u003C\u002Fcode>; setting it to \u003Ccode>false\u003C\u002Fcode> renders every record as a body row. \u003Ccode>delimiter\u003C\u002Fcode> defaults to a comma and must contain exactly one character, so a tab or semicolon can be selected but a multi-character separator cannot.\u003C\u002Fp>\n\n\u003Cp>Column indexes are zero-based. Unspecified columns default to weight \u003Ccode>1\u003C\u002Fcode> and left alignment. Width weights are positive relative proportions, not points or pixels, and \u003Ccode>text_align\u003C\u002Fcode> accepts only \u003Ccode>left\u003C\u002Fcode>, \u003Ccode>center\u003C\u002Fcode>, or \u003Ccode>right\u003C\u002Fcode>. An index outside the parsed CSV, a nonpositive weight, or another alignment value produces a validation error.\u003C\u002Fp>\n\n\u003Cp>The per-column CSV weights take precedence over \u003Ccode>style.table.column_width_weights\u003C\u002Fcode>; the broader table list is only a fallback when CSV-specific widths are absent. The remaining table style controls borders, colors, row striping, and padding. \u003Ccode>keep_header_with_first_row\u003C\u002Fcode> prevents a header from appearing alone, and \u003Ccode>repeat_headers_on_overflow\u003C\u002Fcode> repeats it as rows continue onto later pages.\u003C\u002Fp>\n\n\u003Cp>For CSV, \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> owns the source stream, serialized settings, and output field. \u003Ccode>HttpClient\u003C\u002Fcode> generates the matching multipart boundary and content type when it sends the container.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">        var inputContent = new ByteArrayContent(await File.ReadAllBytesAsync(inputPath));\n        inputContent.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Foctet-stream\");\n        form.Add(inputContent, \"file\", Path.GetFileName(inputPath));\n        form.Add(new StringContent(options.ToString()), \"structured_text_options\");\n        var response = await client.PostAsync(\"pdf\", form);\n        var result = await response.Content.ReadAsStringAsync();\n        Console.WriteLine(result);\n        if (!response.IsSuccessStatusCode) Environment.ExitCode = 1;\n    }\n}\u003C\u002Fpre>\n\n\u003Cp>The C# client authenticates and posts the CSV form, then reads the response as text. Reporting both status and payload lets an integration distinguish a generated PDF resource from validation or processing errors.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">        var inputContent = new ByteArrayContent(await File.ReadAllBytesAsync(inputPath));\n        inputContent.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Foctet-stream\");\n        form.Add(inputContent, \"file\", Path.GetFileName(inputPath));\n        form.Add(new StringContent(options.ToString()), \"structured_text_options\");\n        var response = await client.PostAsync(\"pdf\", form);\n        var result = await response.Content.ReadAsStringAsync();\n        Console.WriteLine(result);\n        if (!response.IsSuccessStatusCode) Environment.ExitCode = 1;\n    }\n}\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>Useful adaptations include quality-control lists, production summaries, ledger extracts, and service-level reports. Column definitions can be tailored to each export while the larger document style remains consistent across the organization.\u003C\u002Fp>\n\n\u003Cp>The requested tags describe table relationships for compatible consumers but do not guarantee PDF\u002FUA or WCAG compliance. Prototype the table in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF documentation\u003C\u002Fa> for validation requirements and option details.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T04:15:50.000+00:00","2026-09-02T18:27:07.000+00:00","2026-09-01T04:35:12.000+00:00","Generate styled and tagged PDF tables from CSV in .NET with C# using precise column and pagination settings.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert CSV to PDF in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-in-net-with-c\u002F\",\n      \"datePublished\": \"2026-09-01T04:35:12.000Z\",\n      \"dateModified\": \"2026-09-01T05:07:12.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Generate styled and tagged PDF tables from CSV in .NET with C# using precise column and pagination settings.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Conversion, Convert to PDF\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert CSV to PDF in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4091,4092,4093,4094,4095,4096,4097,4098],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1418,"name":1419,"slug":1420,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-csv-to-pdf-in-net-with-c\u002F","Convert CSV to PDF in .NET with C# | pdfRest",{"id":4103,"uuid":4104,"title":4105,"slug":4106,"html":4107,"comment_id":4103,"feature_image":48,"featured":284,"visibility":1257,"created_at":4108,"updated_at":4109,"published_at":4110,"custom_excerpt":4111,"codeinjection_head":4112,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4113,"primary_tag":4122,"url":4123,"excerpt":4111,"reading_time":369,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4124,"meta_description":4111,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a965175533c9f26b943ad9c","c19463c2-2299-4f33-9d4d-8adf93b07882","How to Convert CSV to PDF with cURL","how-to-convert-csv-to-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This tutorial shows how to convert CSV to PDF with cURL and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. The request turns comma-separated data into a tagged table with configured columns, header styling, alternating row colors, borders, padding, and page behavior.\u003C\u002Fp>\n\n\u003Ch2>Why Convert CSV to PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>CSV is ideal for moving rows of data between spreadsheets, databases, and automated systems, but it does not define a dependable presentation. Opening the same file in different tools can change column widths, wrapping, and print layout, while nontechnical recipients may not know how the values are meant to be read.\u003C\u002Fp>\n\n\u003Cp>A scheduled sales export illustrates the benefit. A shell job can retrieve regional totals as CSV, convert them to a PDF with a branded header row and right-aligned numeric column, and place the document in a shared reporting folder. If the data spans multiple pages, repeated headers keep each page understandable without manual spreadsheet formatting.\u003C\u002Fp>\n\n\u003Cp>The conversion profile makes those decisions explicit and repeatable. It identifies the delimiter and header row, assigns relative widths and alignment by column, and controls borders, fills, padding, margins, and tagging so every generated report follows the same table design.\u003C\u002Fp>\n\n\u003Ch2>cURL Code Example for Converting CSV to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">#!\u002Fbin\u002Fsh\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# This sample converts CSV input to a tagged PDF through multipart \u002Fpdf.\nINPUT_PATH=\"\u002Fpath\u002Fto\u002Fsample.csv\"\nOPTIONS='{\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"csv\":{\"first_row_is_header\":true,\"delimiter\":\",\",\"columns\":[{\"index\":0,\"width_weight\":2,\"text_align\":\"left\"},{\"index\":1,\"width_weight\":3,\"text_align\":\"left\"},{\"index\":2,\"width_weight\":1,\"text_align\":\"right\"}]}}'\n\ncurl --location \"$API_URL\u002Fpdf\" \\\n  --header \"Accept: application\u002Fjson\" \\\n  --header \"Content-Type: multipart\u002Fform-data\" \\\n  --header \"Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  --form \"file=@$INPUT_PATH\" \\\n  --form \"structured_text_options=$OPTIONS\" \\\n  --form \"output=pdf_from_csv\"\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-csv.sh\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The CSV shell example calls cURL directly, so no language package is required. \u003Ccode>API_URL\u003C\u002Fcode> keeps regional routing visible: the active value uses the US service, and the commented alternative selects the EU service.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">#!\u002Fbin\u002Fsh\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# This sample converts CSV input to a tagged PDF through multipart \u002Fpdf.\nINPUT_PATH=\"\u002Fpath\u002Fto\u002Fsample.csv\"\u003C\u002Fpre>\n\n\u003Cp>For this CSV request, the endpoint excerpt makes the regional service choice explicit:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>INPUT_PATH\u003C\u002Fcode> identifies the local .csv source. The \u003Ccode>@\u003C\u002Fcode> prefix in the later \u003Ccode>--form\u003C\u002Fcode> argument instructs cURL to upload that file’s contents instead of sending its path as text.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\"># This sample converts CSV input to a tagged PDF through multipart \u002Fpdf.\nINPUT_PATH=\"\u002Fpath\u002Fto\u002Fsample.csv\"\nOPTIONS='{\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"csv\":{\"first_row_is_header\":true,\"delimiter\":\",\",\"columns\":[{\"index\":0,\"width_weight\":2,\"text_align\":\"left\"},{\"index\":1,\"width_weight\":3,\"text_align\":\"left\"},{\"index\":2,\"width_weight\":1,\"text_align\":\"right\"}]}}'\u003C\u002Fpre>\n\n\u003Cp>The JSON assigned to \u003Ccode>OPTIONS\u003C\u002Fcode> is pdfRest-specific rather than shell syntax. \u003Ccode>title\u003C\u002Fcode> becomes document metadata, \u003Ccode>language\u003C\u002Fcode> identifies the document language, and \u003Ccode>enable_tagging\u003C\u002Fcode> explicitly requests logical structure. \u003Ccode>page_setup\u003C\u002Fcode> selects Letter portrait pages with 36-point margins, while \u003Ccode>style\u003C\u002Fcode> supplies fonts, text size, color, and format-specific presentation.\u003C\u002Fp>\n\n\u003Cpre class=\"language-json\">{\n  \"csv\": {\n    \"first_row_is_header\": true,\n    \"delimiter\": \",\",\n    \"columns\": [\n      {\n        \"index\": 0,\n        \"width_weight\": 2,\n        \"text_align\": \"left\"\n      },\n      {\n        \"index\": 1,\n        \"width_weight\": 3,\n        \"text_align\": \"left\"\n      },\n      {\n        \"index\": 2,\n        \"width_weight\": 1,\n        \"text_align\": \"right\"\n      }\n    ]\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>first_row_is_header\u003C\u002Fcode> defaults to \u003Ccode>true\u003C\u002Fcode>; setting it to \u003Ccode>false\u003C\u002Fcode> renders every record as a body row. \u003Ccode>delimiter\u003C\u002Fcode> defaults to a comma and must contain exactly one character, so a tab or semicolon can be selected but a multi-character separator cannot.\u003C\u002Fp>\n\n\u003Cp>Column indexes are zero-based. Unspecified columns default to weight \u003Ccode>1\u003C\u002Fcode> and left alignment. Width weights are positive relative proportions, not points or pixels, and \u003Ccode>text_align\u003C\u002Fcode> accepts only \u003Ccode>left\u003C\u002Fcode>, \u003Ccode>center\u003C\u002Fcode>, or \u003Ccode>right\u003C\u002Fcode>. An index outside the parsed CSV, a nonpositive weight, or another alignment value produces a validation error.\u003C\u002Fp>\n\n\u003Cp>The per-column CSV weights take precedence over \u003Ccode>style.table.column_width_weights\u003C\u002Fcode>; the broader table list is only a fallback when CSV-specific widths are absent. The remaining table style controls borders, colors, row striping, and padding. \u003Ccode>keep_header_with_first_row\u003C\u002Fcode> prevents a header from appearing alone, and \u003Ccode>repeat_headers_on_overflow\u003C\u002Fcode> repeats it as rows continue onto later pages.\u003C\u002Fp>\n\n\u003Cp>For CSV conversion, the \u003Ccode>--form\u003C\u002Fcode> arguments create the multipart fields: \u003Ccode>file\u003C\u002Fcode> carries the structured source, \u003Ccode>structured_text_options\u003C\u002Fcode> carries serialized settings, and \u003Ccode>output\u003C\u002Fcode> names the requested PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">  --header \"Content-Type: multipart\u002Fform-data\" \\\n  --header \"Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  --form \"file=@$INPUT_PATH\" \\\n  --form \"structured_text_options=$OPTIONS\" \\\n  --form \"output=pdf_from_csv\"\u003C\u002Fpre>\n\n\u003Cp>The CSV request asks for JSON with \u003Ccode>Accept\u003C\u002Fcode>, declares multipart form data with \u003Ccode>Content-Type\u003C\u002Fcode>, and authenticates through \u003Ccode>Api-Key\u003C\u002Fcode>. Success returns the generated PDF resource and download URL; failure returns API error information.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\"># This sample converts CSV input to a tagged PDF through multipart \u002Fpdf.\nINPUT_PATH=\"\u002Fpath\u002Fto\u002Fsample.csv\"\nOPTIONS='{\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"csv\":{\"first_row_is_header\":true,\"delimiter\":\",\",\"columns\":[{\"index\":0,\"width_weight\":2,\"text_align\":\"left\"},{\"index\":1,\"width_weight\":3,\"text_align\":\"left\"},{\"index\":2,\"width_weight\":1,\"text_align\":\"right\"}]}}'\n\ncurl --location \"$API_URL\u002Fpdf\" \\\n  --header \"Accept: application\u002Fjson\" \\\n  --header \"Content-Type: multipart\u002Fform-data\" \\\n  --header \"Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  --form \"file=@$INPUT_PATH\" \\\n  --form \"structured_text_options=$OPTIONS\" \\\n  --form \"output=pdf_from_csv\"\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This pattern works well for recurring operational reports, exports attached to support cases, and tabular snapshots that need to remain readable outside a spreadsheet application. Adjusting the column profile lets the same command accommodate identifiers, descriptions, dates, and numeric measures.\u003C\u002Fp>\n\n\u003Cp>Tagged output adds logical table structure that can assist navigation and downstream processing, but it does not by itself certify accessibility conformance. Test profile variations in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF documentation\u003C\u002Fa> for the complete parameter contract.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T04:15:49.000+00:00","2026-09-02T18:27:08.000+00:00","2026-09-01T04:35:11.000+00:00","Use cURL to convert CSV data into a styled, tagged PDF table with controlled columns, headers, and pagination.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Convert CSV to PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-curl\u002F\",\n      \"datePublished\": \"2026-09-01T04:35:11.000Z\",\n      \"dateModified\": \"2026-09-01T05:07:11.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Use cURL to convert CSV data into a styled, tagged PDF table with controlled columns, headers, and pagination.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert CSV to PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4114,4115,4116,4117,4118,4119,4120,4121],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1418,"name":1419,"slug":1420,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-csv-to-pdf-with-curl\u002F","Convert CSV to PDF with cURL | pdfRest",{"id":4126,"uuid":4127,"title":4128,"slug":4129,"html":4130,"comment_id":4126,"feature_image":48,"featured":284,"visibility":1257,"created_at":4108,"updated_at":4131,"published_at":4110,"custom_excerpt":4132,"codeinjection_head":4133,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4134,"primary_tag":4143,"url":4144,"excerpt":4132,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4145,"meta_description":4132,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a965175533c9f26b943ada6","ace415fd-d1c8-4973-a20e-69ec401c216d","How to Convert CSV to PDF with Java","how-to-convert-csv-to-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This Java example converts CSV records into a styled PDF table through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. It demonstrates tagged output, per-column width and alignment choices, repeated headers, alternating row fills, and multipart upload from a server application.\u003C\u002Fp>\n\n\u003Ch2>Why Convert CSV to PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>Enterprise Java systems commonly export inventory, transactions, and reconciliation data as CSV because the format is lightweight and widely supported. That portability does not solve the presentation problem when managers or customers need a document with clear columns, page breaks, and labels.\u003C\u002Fp>\n\n\u003Cp>Consider a warehouse platform that produces a daily CSV of item numbers, descriptions, and quantities requiring review. The Java service can turn the export into a PDF where the description receives more width, quantities align to the right, and header rows repeat across pages. Supervisors receive a report they can print or annotate without first opening and styling a spreadsheet.\u003C\u002Fp>\n\n\u003Cp>Generating the table through a service also keeps recurring reports consistent. Page geometry, border rules, colors, padding, typography, and structural tags live in the conversion profile rather than in desktop templates maintained by individual users.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example for Converting CSV to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class PdfFromCsv {\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) throws IOException {\n    File inputFile = new File(args.length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.csv\");\n    Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n    String apiKey = dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY);\n    JSONObject options =\n        new JSONObject(\n            \"{\\\"title\\\":\\\"Structured Content Sample\\\",\\\"language\\\":\\\"en-US\\\",\\\"enable_tagging\\\":true,\\\"page_setup\\\":{\\\"size\\\":\\\"Letter\\\",\\\"orientation\\\":\\\"portrait\\\",\\\"margin\\\":{\\\"top\\\":36,\\\"right\\\":42,\\\"bottom\\\":36,\\\"left\\\":42}},\\\"style\\\":{\\\"font\\\":\\\"Arial\\\",\\\"heading_font\\\":\\\"Arial\\\",\\\"code_font\\\":\\\"Courier\\\",\\\"text_size\\\":11,\\\"text_color_rgb\\\":[34,34,34],\\\"heading_scale\\\":1.35,\\\"table\\\":{\\\"column_width_weights\\\":[2,3,2],\\\"keep_header_with_first_row\\\":true,\\\"repeat_headers_on_overflow\\\":true,\\\"show_borders\\\":true,\\\"border_width\\\":0.75,\\\"border_color_rgb\\\":[180,188,200],\\\"header_fill_color_rgb\\\":[33,64,98],\\\"header_text_color_rgb\\\":[255,255,255],\\\"row_fill_color_rgb\\\":[250,250,252],\\\"alternate_row_fill_color_rgb\\\":[235,240,246],\\\"cell_padding\\\":{\\\"top\\\":6,\\\"right\\\":8,\\\"bottom\\\":6,\\\"left\\\":8}}},\\\"csv\\\":{\\\"first_row_is_header\\\":true,\\\"delimiter\\\":\\\",\\\",\\\"columns\\\":[{\\\"index\\\":0,\\\"width_weight\\\":2,\\\"text_align\\\":\\\"left\\\"},{\\\"index\\\":1,\\\"width_weight\\\":3,\\\"text_align\\\":\\\"left\\\"},{\\\"index\\\":2,\\\"width_weight\\\":1,\\\"text_align\\\":\\\"right\\\"}]}}\");\n    MultipartBody.Builder form =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\n                \"file\",\n                inputFile.getName(),\n                RequestBody.create(inputFile, MediaType.parse(\"application\u002Foctet-stream\")))\n            .addFormDataPart(\"structured_text_options\", options.toString());\n    Request request =\n        new Request.Builder()\n            .url(API_URL + \"\u002Fpdf\")\n            .header(\"Api-Key\", apiKey)\n            .post(form.build())\n            .build();\n    send(request);\n  }\n\n  private static void send(Request request) throws IOException {\n    OkHttpClient client = new OkHttpClient.Builder().readTimeout(60, TimeUnit.SECONDS).build();\n    try (Response response = client.newCall(request).execute()) {\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) System.out.println(response.body().string());\n      if (!response.isSuccessful()) System.exit(1);\n    }\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPdfFromCsv.java\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This Java CSV example combines OkHttp for transport, \u003Ccode>org.json\u003C\u002Fcode> for conversion settings, and dotenv support for repository configuration. Those project dependencies must remain available when the class is moved into another application.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The Java endpoint excerpt exposes the regional service selection used for this CSV conversion:\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">public class PdfFromCsv {\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) throws IOException {\n    File inputFile = new File(args.length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.csv\");\n    Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n    String apiKey = dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY);\u003C\u002Fpre>\n\n\u003Cp>Java wraps the .csv path in an OkHttp request body and retains the filename in the multipart upload. The shared \u003Ccode>\u002Fpdf\u003C\u002Fcode> endpoint uses that extension to select CSV conversion.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">  public static void main(String[] args) throws IOException {\n    File inputFile = new File(args.length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.csv\");\n    Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>JSONObject\u003C\u002Fcode> is the pdfRest conversion profile. Its title and language describe the PDF, \u003Ccode>enable_tagging\u003C\u002Fcode> explicitly requests logical tags, and \u003Ccode>page_setup\u003C\u002Fcode> establishes Letter portrait pages with 36-point margins. The \u003Ccode>style\u003C\u002Fcode> member controls the fonts, text size, color, and any CSV-specific rendering choices.\u003C\u002Fp>\n\n\u003Cpre class=\"language-json\">{\n  \"csv\": {\n    \"first_row_is_header\": true,\n    \"delimiter\": \",\",\n    \"columns\": [\n      {\n        \"index\": 0,\n        \"width_weight\": 2,\n        \"text_align\": \"left\"\n      },\n      {\n        \"index\": 1,\n        \"width_weight\": 3,\n        \"text_align\": \"left\"\n      },\n      {\n        \"index\": 2,\n        \"width_weight\": 1,\n        \"text_align\": \"right\"\n      }\n    ]\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>first_row_is_header\u003C\u002Fcode> defaults to \u003Ccode>true\u003C\u002Fcode>; setting it to \u003Ccode>false\u003C\u002Fcode> renders every record as a body row. \u003Ccode>delimiter\u003C\u002Fcode> defaults to a comma and must contain exactly one character, so a tab or semicolon can be selected but a multi-character separator cannot.\u003C\u002Fp>\n\n\u003Cp>Column indexes are zero-based. Unspecified columns default to weight \u003Ccode>1\u003C\u002Fcode> and left alignment. Width weights are positive relative proportions, not points or pixels, and \u003Ccode>text_align\u003C\u002Fcode> accepts only \u003Ccode>left\u003C\u002Fcode>, \u003Ccode>center\u003C\u002Fcode>, or \u003Ccode>right\u003C\u002Fcode>. An index outside the parsed CSV, a nonpositive weight, or another alignment value produces a validation error.\u003C\u002Fp>\n\n\u003Cp>The per-column CSV weights take precedence over \u003Ccode>style.table.column_width_weights\u003C\u002Fcode>; the broader table list is only a fallback when CSV-specific widths are absent. The remaining table style controls borders, colors, row striping, and padding. \u003Ccode>keep_header_with_first_row\u003C\u002Fcode> prevents a header from appearing alone, and \u003Ccode>repeat_headers_on_overflow\u003C\u002Fcode> repeats it as rows continue onto later pages.\u003C\u002Fp>\n\n\u003Cp>For the CSV upload, \u003Ccode>MultipartBody.Builder\u003C\u002Fcode> combines the source file, serialized \u003Ccode>structured_text_options\u003C\u002Fcode>, and ordinary \u003Ccode>output\u003C\u002Fcode> text field in one request body.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">                \"file\",\n                inputFile.getName(),\n                RequestBody.create(inputFile, MediaType.parse(\"application\u002Foctet-stream\")))\n            .addFormDataPart(\"structured_text_options\", options.toString());\n    Request request =\n        new Request.Builder()\n            .url(API_URL + \"\u002Fpdf\")\n            .header(\"Api-Key\", apiKey)\n            .post(form.build())\n            .build();\n    send(request);\u003C\u002Fpre>\n\n\u003Cp>OkHttp submits the CSV conversion with the API key and checks the HTTP result. The printed body contains generated-resource JSON after success or API error details when processing fails.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">  }\n\n  private static void send(Request request) throws IOException {\n    OkHttpClient client = new OkHttpClient.Builder().readTimeout(60, TimeUnit.SECONDS).build();\n    try (Response response = client.newCall(request).execute()) {\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) System.out.println(response.body().string());\n      if (!response.isSuccessful()) System.exit(1);\n    }\n  }\n}\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>Java teams can adapt this workflow for inventory reviews, financial reconciliations, exception lists, and customer-facing data extracts. Explicit column rules are especially valuable when long descriptions and compact numeric fields must share the same page.\u003C\u002Fp>\n\n\u003Cp>Tags provide a logical table hierarchy for assistive and automated consumers without guaranteeing a specific compliance level. Explore the layout interactively with \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, then reference the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API guide\u003C\u002Fa> for supported values and limits.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-02T18:27:09.000+00:00","Convert CSV records into styled, multipage PDF tables with Java using column, header, and tagging controls.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Convert CSV to PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T04:35:11.000Z\",\n      \"dateModified\": \"2026-09-01T05:07:11.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert CSV records into styled, multipage PDF tables with Java using column, header, and tagging controls.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, Java\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert CSV to PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4135,4136,4137,4138,4139,4140,4141,4142],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1418,"name":1419,"slug":1420,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-csv-to-pdf-with-java\u002F","Convert CSV to PDF with Java | pdfRest",{"id":4147,"uuid":4148,"title":4149,"slug":4150,"html":4151,"comment_id":4147,"feature_image":48,"featured":284,"visibility":1257,"created_at":4085,"updated_at":4152,"published_at":4110,"custom_excerpt":4153,"codeinjection_head":4154,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4155,"primary_tag":4164,"url":4165,"excerpt":4153,"reading_time":369,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4166,"meta_description":4153,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a965176533c9f26b943adb0","a54df7c9-30fa-41c8-aca0-a9940403379e","How to Convert CSV to PDF with JavaScript in NodeJS","how-to-convert-csv-to-pdf-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This NodeJS tutorial uses JavaScript to convert CSV into a formatted, tagged PDF with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. The example controls table columns, alignment, borders, header treatment, row striping, padding, and multipage behavior.\u003C\u002Fp>\n\n\u003Ch2>Why Convert CSV to PDF with JavaScript in NodeJS?\u003C\u002Fh2>\n\n\u003Cp>SaaS applications frequently expose analytics and account data as CSV, which is useful for further computation but less effective as a finished report. Users who simply need to read, present, or approve the information may prefer a PDF that already communicates the table’s structure.\u003C\u002Fp>\n\n\u003Cp>A usage dashboard provides one concrete scenario. Its NodeJS backend can export plan names, usage descriptions, and totals to CSV, then create a PDF for a quarterly account review. Wider descriptive columns prevent cramped text, right alignment clarifies totals, and alternating row colors help readers track values across a dense table.\u003C\u002Fp>\n\n\u003Cp>By defining the layout in the API request, the product can offer a consistent PDF export without rendering a hidden web page or depending on a user’s spreadsheet settings. Header repetition also keeps long datasets usable after pagination.\u003C\u002Fp>\n\n\u003Ch2>JavaScript Code Example for Converting CSV to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar fs = require(\"fs\");\nvar FormData = require(\"form-data\");\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n\u002F\u002F This sample converts CSV input to a tagged PDF through multipart \u002Fpdf.\n\u002F\u002F It demonstrates structured_text_options and the format-specific conversion options.\nvar inputPath = \"\u002Fpath\u002Fto\u002Fsample.csv\";\nvar form = new FormData();\nform.append(\"file\", fs.createReadStream(inputPath));\nform.append(\"structured_text_options\", JSON.stringify({\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"csv\":{\"first_row_is_header\":true,\"delimiter\":\",\",\"columns\":[{\"index\":0,\"width_weight\":2,\"text_align\":\"left\"},{\"index\":1,\"width_weight\":3,\"text_align\":\"left\"},{\"index\":2,\"width_weight\":1,\"text_align\":\"right\"}]}}));\nform.append(\"output\", \"pdf_from_csv\");\n\naxios.post(apiUrl + \"\u002Fpdf\", form, { headers: { \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", ...form.getHeaders() }, maxBodyLength: Infinity })\n.then((response) => { console.log(JSON.stringify(response.data, null, 2)); })\n.catch((error) => { console.error(error.response ? error.response.data : error.message); process.exitCode = 1; });\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-csv.js\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The NodeJS CSV walkthrough uses \u003Ccode>axios\u003C\u002Fcode>, \u003Ccode>form-data\u003C\u002Fcode>, and Node’s file-system module. Outside the samples project, install its HTTP and multipart dependencies with \u003Ccode>npm install axios form-data\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar fs = require(\"fs\");\nvar FormData = require(\"form-data\");\u003C\u002Fpre>\n\n\u003Cp>This NodeJS excerpt keeps the regional endpoint visible for the CSV workflow:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\u003C\u002Fpre>\n\n\u003Cp>JavaScript streams the .csv source into the form while preserving its filename. pdfRest infers CSV conversion from that extension, so \u003Ccode>structured_text_options\u003C\u002Fcode> does not need an \u003Ccode>input_format\u003C\u002Fcode> property.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F It demonstrates structured_text_options and the format-specific conversion options.\nvar inputPath = \"\u002Fpath\u002Fto\u002Fsample.csv\";\nvar form = new FormData();\u003C\u002Fpre>\n\n\u003Cp>The object passed through \u003Ccode>JSON.stringify\u003C\u002Fcode> is interpreted by pdfRest as \u003Ccode>structured_text_options\u003C\u002Fcode>. It sets PDF metadata, explicitly enables tagging, defines Letter portrait geometry and margins, and supplies the font and color choices used when laying out the CSV content.\u003C\u002Fp>\n\n\u003Cpre class=\"language-json\">{\n  \"csv\": {\n    \"first_row_is_header\": true,\n    \"delimiter\": \",\",\n    \"columns\": [\n      {\n        \"index\": 0,\n        \"width_weight\": 2,\n        \"text_align\": \"left\"\n      },\n      {\n        \"index\": 1,\n        \"width_weight\": 3,\n        \"text_align\": \"left\"\n      },\n      {\n        \"index\": 2,\n        \"width_weight\": 1,\n        \"text_align\": \"right\"\n      }\n    ]\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>first_row_is_header\u003C\u002Fcode> defaults to \u003Ccode>true\u003C\u002Fcode>; setting it to \u003Ccode>false\u003C\u002Fcode> renders every record as a body row. \u003Ccode>delimiter\u003C\u002Fcode> defaults to a comma and must contain exactly one character, so a tab or semicolon can be selected but a multi-character separator cannot.\u003C\u002Fp>\n\n\u003Cp>Column indexes are zero-based. Unspecified columns default to weight \u003Ccode>1\u003C\u002Fcode> and left alignment. Width weights are positive relative proportions, not points or pixels, and \u003Ccode>text_align\u003C\u002Fcode> accepts only \u003Ccode>left\u003C\u002Fcode>, \u003Ccode>center\u003C\u002Fcode>, or \u003Ccode>right\u003C\u002Fcode>. An index outside the parsed CSV, a nonpositive weight, or another alignment value produces a validation error.\u003C\u002Fp>\n\n\u003Cp>The per-column CSV weights take precedence over \u003Ccode>style.table.column_width_weights\u003C\u002Fcode>; the broader table list is only a fallback when CSV-specific widths are absent. The remaining table style controls borders, colors, row striping, and padding. \u003Ccode>keep_header_with_first_row\u003C\u002Fcode> prevents a header from appearing alone, and \u003Ccode>repeat_headers_on_overflow\u003C\u002Fcode> repeats it as rows continue onto later pages.\u003C\u002Fp>\n\n\u003Cp>NodeJS uses \u003Ccode>FormData\u003C\u002Fcode> to append the CSV file, stringified \u003Ccode>structured_text_options\u003C\u002Fcode>, and output name. The generated form headers provide the multipart boundary for those fields.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var inputPath = \"\u002Fpath\u002Fto\u002Fsample.csv\";\nvar form = new FormData();\nform.append(\"file\", fs.createReadStream(inputPath));\nform.append(\"structured_text_options\", JSON.stringify({\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"csv\":{\"first_row_is_header\":true,\"delimiter\":\",\",\"columns\":[{\"index\":0,\"width_weight\":2,\"text_align\":\"left\"},{\"index\":1,\"width_weight\":3,\"text_align\":\"left\"},{\"index\":2,\"width_weight\":1,\"text_align\":\"right\"}]}}));\nform.append(\"output\", \"pdf_from_csv\");\n\naxios.post(apiUrl + \"\u002Fpdf\", form, { headers: { \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", ...form.getHeaders() }, maxBodyLength: Infinity })\n.then((response) => { console.log(JSON.stringify(response.data, null, 2)); })\n.catch((error) => { console.error(error.response ? error.response.data : error.message); process.exitCode = 1; });\u003C\u002Fpre>\n\n\u003Cp>Axios sends the CSV request to \u003Ccode>\u002Fpdf\u003C\u002Fcode> with the form headers and \u003Ccode>Api-Key\u003C\u002Fcode>. Its success path prints resource JSON, while the rejection path exposes either the API response or the client-side error.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">form.append(\"file\", fs.createReadStream(inputPath));\nform.append(\"structured_text_options\", JSON.stringify({\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"csv\":{\"first_row_is_header\":true,\"delimiter\":\",\",\"columns\":[{\"index\":0,\"width_weight\":2,\"text_align\":\"left\"},{\"index\":1,\"width_weight\":3,\"text_align\":\"left\"},{\"index\":2,\"width_weight\":1,\"text_align\":\"right\"}]}}));\nform.append(\"output\", \"pdf_from_csv\");\n\naxios.post(apiUrl + \"\u002Fpdf\", form, { headers: { \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", ...form.getHeaders() }, maxBodyLength: Infinity })\n.then((response) => { console.log(JSON.stringify(response.data, null, 2)); })\n.catch((error) => { console.error(error.response ? error.response.data : error.message); process.exitCode = 1; });\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>The same technique can support billing summaries, event exports, survey results, and application health reports. Applications can construct different column arrays for each dataset while retaining a shared visual style.\u003C\u002Fp>\n\n\u003Cp>Tagged tables can improve structural interpretation for accessibility tools and later processing, though tags alone are not a conformance claim. Try representative datasets in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and review the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF reference\u003C\u002Fa> before finalizing production options.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-02T18:27:10.000+00:00","Create styled, tagged PDF tables from CSV in NodeJS with custom columns, row colors, headers, and page flow.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert CSV to PDF with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2026-09-01T04:35:11.000Z\",\n      \"dateModified\": \"2026-09-01T05:07:12.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Create styled, tagged PDF tables from CSV in NodeJS with custom columns, row colors, headers, and page flow.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, JavaScript\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert CSV to PDF with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4156,4157,4158,4159,4160,4161,4162,4163],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1418,"name":1419,"slug":1420,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-csv-to-pdf-with-javascript-in-nodejs\u002F","Convert CSV to PDF with NodeJS | pdfRest",{"id":4168,"uuid":4169,"title":4170,"slug":4171,"html":4172,"comment_id":4168,"feature_image":48,"featured":284,"visibility":1257,"created_at":4173,"updated_at":4152,"published_at":4087,"custom_excerpt":4174,"codeinjection_head":4175,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4176,"primary_tag":4185,"url":4186,"excerpt":4174,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4187,"meta_description":4174,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a965177533c9f26b943adc4","4e7edb07-ab26-485c-a5e7-311750e89fb6","How to Convert CSV to PDF with PHP","how-to-convert-csv-to-pdf-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This PHP tutorial converts CSV data into a polished, tagged PDF table with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. It combines the upload with settings for column proportions, alignment, header colors, alternating rows, borders, padding, and overflow.\u003C\u002Fp>\n\n\u003Ch2>Why Convert CSV to PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>Commerce and portal applications often generate CSV for orders, commissions, and account activity. That format is convenient for importing data, but customers and internal reviewers may need a ready-to-read document rather than a dataset they must style themselves.\u003C\u002Fp>\n\n\u003Cp>An affiliate platform, for example, can export campaign names, transaction descriptions, and commission amounts as CSV at month end. PHP can convert the data to PDF with readable descriptions, aligned currency values, and repeated column labels. The partner receives a statement-like report while the platform retains CSV for downstream analysis.\u003C\u002Fp>\n\n\u003Cp>A server-generated table also avoids differences between spreadsheet applications and print settings. The PHP workflow controls page dimensions and table appearance consistently for every account and reporting period.\u003C\u002Fp>\n\n\u003Ch2>PHP Code Example for Converting CSV to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n$inputPath = '\u002Fpath\u002Fto\u002Fsample.csv';\n$options = json_decode('{\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"csv\":{\"first_row_is_header\":true,\"delimiter\":\",\",\"columns\":[{\"index\":0,\"width_weight\":2,\"text_align\":\"left\"},{\"index\":1,\"width_weight\":3,\"text_align\":\"left\"},{\"index\":2,\"width_weight\":1,\"text_align\":\"right\"}]}}', true);\n\n\u002F\u002F This sample converts CSV input to a tagged PDF through multipart \u002Fpdf.\n\u002F\u002F It demonstrates structured_text_options and the format-specific conversion options.\n$multipart = [\n  ['name' => 'file', 'contents' => Utils::tryFopen($inputPath, 'r'), 'filename' => basename($inputPath)],\n  ['name' => 'structured_text_options', 'contents' => json_encode($options)],\n  ['name' => 'output', 'contents' => 'pdf_from_csv'],\n];\n$response = (new Client())->post($apiUrl . '\u002Fpdf', ['headers' => ['Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'Accept' => 'application\u002Fjson'], 'multipart' => $multipart]);\necho $response->getBody();\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-csv.php\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This PHP CSV example relies on Guzzle for HTTP and PSR-7 stream utilities for the upload. When using the code outside this repository, add the client with \u003Ccode>composer require guzzlehttp\u002Fguzzle\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\u003C\u002Fpre>\n\n\u003Cp>The PHP endpoint excerpt keeps regional routing explicit for this CSV operation:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\u003C\u002Fpre>\n\n\u003Cp>PHP opens the .csv source as a PSR-7 stream and includes its filename in the multipart part. The extension selects CSV processing without duplicating the format in the options JSON.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$inputPath = '\u002Fpath\u002Fto\u002Fsample.csv';\n$options = json_decode('{\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"csv\":{\"first_row_is_header\":true,\"delimiter\":\",\",\"columns\":[{\"index\":0,\"width_weight\":2,\"text_align\":\"left\"},{\"index\":1,\"width_weight\":3,\"text_align\":\"left\"},{\"index\":2,\"width_weight\":1,\"text_align\":\"right\"}]}}', true);\u003C\u002Fpre>\n\n\u003Cp>The array decoded into \u003Ccode>$options\u003C\u002Fcode> is serialized as pdfRest’s \u003Ccode>structured_text_options\u003C\u002Fcode>. It describes the PDF title and language, explicitly turns on tagging, chooses Letter portrait pages with 36-point margins, and provides typography plus CSV-specific styling.\u003C\u002Fp>\n\n\u003Cpre class=\"language-json\">{\n  \"csv\": {\n    \"first_row_is_header\": true,\n    \"delimiter\": \",\",\n    \"columns\": [\n      {\n        \"index\": 0,\n        \"width_weight\": 2,\n        \"text_align\": \"left\"\n      },\n      {\n        \"index\": 1,\n        \"width_weight\": 3,\n        \"text_align\": \"left\"\n      },\n      {\n        \"index\": 2,\n        \"width_weight\": 1,\n        \"text_align\": \"right\"\n      }\n    ]\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>first_row_is_header\u003C\u002Fcode> defaults to \u003Ccode>true\u003C\u002Fcode>; setting it to \u003Ccode>false\u003C\u002Fcode> renders every record as a body row. \u003Ccode>delimiter\u003C\u002Fcode> defaults to a comma and must contain exactly one character, so a tab or semicolon can be selected but a multi-character separator cannot.\u003C\u002Fp>\n\n\u003Cp>Column indexes are zero-based. Unspecified columns default to weight \u003Ccode>1\u003C\u002Fcode> and left alignment. Width weights are positive relative proportions, not points or pixels, and \u003Ccode>text_align\u003C\u002Fcode> accepts only \u003Ccode>left\u003C\u002Fcode>, \u003Ccode>center\u003C\u002Fcode>, or \u003Ccode>right\u003C\u002Fcode>. An index outside the parsed CSV, a nonpositive weight, or another alignment value produces a validation error.\u003C\u002Fp>\n\n\u003Cp>The per-column CSV weights take precedence over \u003Ccode>style.table.column_width_weights\u003C\u002Fcode>; the broader table list is only a fallback when CSV-specific widths are absent. The remaining table style controls borders, colors, row striping, and padding. \u003Ccode>keep_header_with_first_row\u003C\u002Fcode> prevents a header from appearing alone, and \u003Ccode>repeat_headers_on_overflow\u003C\u002Fcode> repeats it as rows continue onto later pages.\u003C\u002Fp>\n\n\u003Cp>The PHP multipart array assigns \u003Ccode>name\u003C\u002Fcode> and \u003Ccode>contents\u003C\u002Fcode> values to the CSV stream, serialized \u003Ccode>structured_text_options\u003C\u002Fcode>, and requested output name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">\u002F\u002F It demonstrates structured_text_options and the format-specific conversion options.\n$multipart = [\n  ['name' => 'file', 'contents' => Utils::tryFopen($inputPath, 'r'), 'filename' => basename($inputPath)],\n  ['name' => 'structured_text_options', 'contents' => json_encode($options)],\n  ['name' => 'output', 'contents' => 'pdf_from_csv'],\n];\n$response = (new Client())->post($apiUrl . '\u002Fpdf', ['headers' => ['Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'Accept' => 'application\u002Fjson'], 'multipart' => $multipart]);\necho $response->getBody();\u003C\u002Fpre>\n\n\u003Cp>Guzzle prepares and submits the CSV multipart body with the API key. The response body contains generated-resource information on success and service error details when the conversion cannot be completed.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">  ['name' => 'file', 'contents' => Utils::tryFopen($inputPath, 'r'), 'filename' => basename($inputPath)],\n  ['name' => 'structured_text_options', 'contents' => json_encode($options)],\n  ['name' => 'output', 'contents' => 'pdf_from_csv'],\n];\n$response = (new Client())->post($apiUrl . '\u002Fpdf', ['headers' => ['Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'Accept' => 'application\u002Fjson'], 'multipart' => $multipart]);\necho $response->getBody();\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This approach can produce payout statements, order summaries, subscription exports, and downloadable account reports without building an HTML table for each document. Per-column options preserve clarity even when one field contains much longer text than another.\u003C\u002Fp>\n\n\u003Cp>Logical table tags support navigation and document processing but are not a promise of full accessibility conformance. Exercise the request with sample data in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and use the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API documentation\u003C\u002Fa> as the authoritative field reference.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T04:15:51.000+00:00","Turn CSV exports into readable, tagged PDF tables with PHP and configurable columns, styles, and page headers.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-php\u002F#article\",\n      \"headline\": \"How to Convert CSV to PDF with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-php\u002F\",\n      \"datePublished\": \"2026-09-01T04:35:12.000Z\",\n      \"dateModified\": \"2026-09-01T05:07:12.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Turn CSV exports into readable, tagged PDF tables with PHP and configurable columns, styles, and page headers.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert CSV to PDF with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4177,4178,4179,4180,4181,4182,4183,4184],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1418,"name":1419,"slug":1420,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-csv-to-pdf-with-php\u002F","Convert CSV to PDF with PHP | pdfRest",{"id":4189,"uuid":4190,"title":4191,"slug":4192,"html":4193,"comment_id":4189,"feature_image":48,"featured":284,"visibility":1257,"created_at":4173,"updated_at":4194,"published_at":4087,"custom_excerpt":4195,"codeinjection_head":4196,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4197,"primary_tag":4206,"url":4207,"excerpt":4195,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4208,"meta_description":4195,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a965177533c9f26b943adce","f6d7dae5-5733-4691-8b6a-7495cb6f69ff","How to Convert CSV to PDF with Python","how-to-convert-csv-to-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This Python example sends CSV data to the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa> and creates a styled, tagged PDF table. The conversion profile controls column widths, alignment, header formatting, row shading, borders, padding, page setup, and repeated headers.\u003C\u002Fp>\n\n\u003Ch2>Why Convert CSV to PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>Python data workflows produce CSV at nearly every stage because it is simple to generate and analyze. When results are delivered to auditors, clients, or project leaders, a designed PDF table can communicate the dataset more clearly and preserve a consistent reporting artifact.\u003C\u002Fp>\n\n\u003Cp>A data-quality pipeline might write rule names, failure descriptions, and affected-record counts to CSV after validating an import. Python can immediately convert that output into a PDF for the review package. The description column receives extra room, counts align to the right, and alternating fills make a long exception list easier to scan.\u003C\u002Fp>\n\n\u003Cp>Keeping this step in the pipeline eliminates manual spreadsheet formatting and makes every run reproducible. The source remains available for analysis, while the PDF serves the human review and documentation need.\u003C\u002Fp>\n\n\u003Ch2>Python Code Example for Converting CSV to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">import json\nimport os\nimport requests\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# This sample converts CSV input to a tagged PDF through multipart \u002Fpdf.\n# It demonstrates structured_text_options and the format-specific conversion options.\ninput_path = \"\u002Fpath\u002Fto\u002Fsample.csv\"\noptions = json.loads(r'''{\n  \"title\": \"Structured Content Sample\",\n  \"language\": \"en-US\",\n  \"enable_tagging\": true,\n  \"page_setup\": {\n    \"size\": \"Letter\",\n    \"orientation\": \"portrait\",\n    \"margin\": {\n      \"top\": 36,\n      \"right\": 42,\n      \"bottom\": 36,\n      \"left\": 42\n    }\n  },\n  \"style\": {\n    \"font\": \"Arial\",\n    \"heading_font\": \"Arial\",\n    \"code_font\": \"Courier\",\n    \"text_size\": 11,\n    \"text_color_rgb\": [\n      34,\n      34,\n      34\n    ],\n    \"heading_scale\": 1.35,\n    \"table\": {\n      \"column_width_weights\": [\n        2,\n        3,\n        2\n      ],\n      \"keep_header_with_first_row\": true,\n      \"repeat_headers_on_overflow\": true,\n      \"show_borders\": true,\n      \"border_width\": 0.75,\n      \"border_color_rgb\": [\n        180,\n        188,\n        200\n      ],\n      \"header_fill_color_rgb\": [\n        33,\n        64,\n        98\n      ],\n      \"header_text_color_rgb\": [\n        255,\n        255,\n        255\n      ],\n      \"row_fill_color_rgb\": [\n        250,\n        250,\n        252\n      ],\n      \"alternate_row_fill_color_rgb\": [\n        235,\n        240,\n        246\n      ],\n      \"cell_padding\": {\n        \"top\": 6,\n        \"right\": 8,\n        \"bottom\": 6,\n        \"left\": 8\n      }\n    }\n  },\n  \"csv\": {\n    \"first_row_is_header\": true,\n    \"delimiter\": \",\",\n    \"columns\": [\n      {\n        \"index\": 0,\n        \"width_weight\": 2,\n        \"text_align\": \"left\"\n      },\n      {\n        \"index\": 1,\n        \"width_weight\": 3,\n        \"text_align\": \"left\"\n      },\n      {\n        \"index\": 2,\n        \"width_weight\": 1,\n        \"text_align\": \"right\"\n      }\n    ]\n  }\n}''')\n\nfrom requests_toolbelt import MultipartEncoder\nwith open(input_path, \"rb\") as input_file:\n    fields = {\n        \"file\": (os.path.basename(input_path), input_file, \"text\u002Fplain\"),\n        \"structured_text_options\": json.dumps(options),\n    }\n    form = MultipartEncoder(fields=fields)\n    response = requests.post(api_url + \"\u002Fpdf\", data=form, headers={\n        \"Accept\": \"application\u002Fjson\",\n        \"Content-Type\": form.content_type,\n        \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    })\n\nprint(\"Response status code: \" + str(response.status_code))\nif response.ok:\n    print(json.dumps(response.json(), indent=2))\nelse:\n    print(response.text)\n    raise SystemExit(1)\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-csv.py\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The Python CSV sample uses \u003Ccode>requests\u003C\u002Fcode> and \u003Ccode>MultipartEncoder\u003C\u002Fcode> from \u003Ccode>requests-toolbelt\u003C\u002Fcode>. Install both with \u003Ccode>python -m pip install requests requests-toolbelt\u003C\u002Fcode> when they are not already present.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">import json\nimport os\nimport requests\u003C\u002Fpre>\n\n\u003Cp>This Python endpoint excerpt identifies the regional service used for CSV conversion:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\"># By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>Python opens the .csv input in binary mode and sends its base filename with the stream. \u003Ccode>\u002Fpdf\u003C\u002Fcode> uses that filename extension to infer the CSV input type.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\"># It demonstrates structured_text_options and the format-specific conversion options.\ninput_path = \"\u002Fpath\u002Fto\u002Fsample.csv\"\noptions = json.loads(r'''{\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>options\u003C\u002Fcode> dictionary becomes pdfRest’s \u003Ccode>structured_text_options\u003C\u002Fcode> field. It supplies document metadata, explicitly requests tags, establishes Letter portrait pages and 36-point margins, and selects the fonts, text size, color, and CSV-specific presentation values.\u003C\u002Fp>\n\n\u003Cpre class=\"language-json\">{\n  \"csv\": {\n    \"first_row_is_header\": true,\n    \"delimiter\": \",\",\n    \"columns\": [\n      {\n        \"index\": 0,\n        \"width_weight\": 2,\n        \"text_align\": \"left\"\n      },\n      {\n        \"index\": 1,\n        \"width_weight\": 3,\n        \"text_align\": \"left\"\n      },\n      {\n        \"index\": 2,\n        \"width_weight\": 1,\n        \"text_align\": \"right\"\n      }\n    ]\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>first_row_is_header\u003C\u002Fcode> defaults to \u003Ccode>true\u003C\u002Fcode>; setting it to \u003Ccode>false\u003C\u002Fcode> renders every record as a body row. \u003Ccode>delimiter\u003C\u002Fcode> defaults to a comma and must contain exactly one character, so a tab or semicolon can be selected but a multi-character separator cannot.\u003C\u002Fp>\n\n\u003Cp>Column indexes are zero-based. Unspecified columns default to weight \u003Ccode>1\u003C\u002Fcode> and left alignment. Width weights are positive relative proportions, not points or pixels, and \u003Ccode>text_align\u003C\u002Fcode> accepts only \u003Ccode>left\u003C\u002Fcode>, \u003Ccode>center\u003C\u002Fcode>, or \u003Ccode>right\u003C\u002Fcode>. An index outside the parsed CSV, a nonpositive weight, or another alignment value produces a validation error.\u003C\u002Fp>\n\n\u003Cp>The per-column CSV weights take precedence over \u003Ccode>style.table.column_width_weights\u003C\u002Fcode>; the broader table list is only a fallback when CSV-specific widths are absent. The remaining table style controls borders, colors, row striping, and padding. \u003Ccode>keep_header_with_first_row\u003C\u002Fcode> prevents a header from appearing alone, and \u003Ccode>repeat_headers_on_overflow\u003C\u002Fcode> repeats it as rows continue onto later pages.\u003C\u002Fp>\n\n\u003Cp>For the CSV call, \u003Ccode>MultipartEncoder\u003C\u002Fcode> combines the file tuple with serialized \u003Ccode>structured_text_options\u003C\u002Fcode>. Its \u003Ccode>content_type\u003C\u002Fcode>, including the boundary, becomes the request’s \u003Ccode>Content-Type\u003C\u002Fcode> header.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">with open(input_path, \"rb\") as input_file:\n    fields = {\n        \"file\": (os.path.basename(input_path), input_file, \"text\u002Fplain\"),\n        \"structured_text_options\": json.dumps(options),\n    }\n    form = MultipartEncoder(fields=fields)\n    response = requests.post(api_url + \"\u002Fpdf\", data=form, headers={\n        \"Accept\": \"application\u002Fjson\",\n        \"Content-Type\": form.content_type,\n        \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    })\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>requests.post\u003C\u002Fcode> sends the encoded CSV form with the API key. The script pretty-prints resource JSON after success and otherwise displays the API message before exiting with a nonzero status.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">        \"file\": (os.path.basename(input_path), input_file, \"text\u002Fplain\"),\n        \"structured_text_options\": json.dumps(options),\n    }\n    form = MultipartEncoder(fields=fields)\n    response = requests.post(api_url + \"\u002Fpdf\", data=form, headers={\n        \"Accept\": \"application\u002Fjson\",\n        \"Content-Type\": form.content_type,\n        \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    })\n\nprint(\"Response status code: \" + str(response.status_code))\nif response.ok:\n    print(json.dumps(response.json(), indent=2))\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>Teams can reuse the pattern for experiment results, validation summaries, survey data, and scheduled KPI extracts. A different columns array can adapt the table to each schema without replacing the overall report design.\u003C\u002Fp>\n\n\u003Cp>Tagged structure can make headers and cells more understandable to assistive and automated tools, but additional evaluation is needed for any accessibility claim. Validate representative files in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and review the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF reference\u003C\u002Fa> for all available settings.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-02T18:27:11.000+00:00","Convert CSV datasets into styled, tagged PDF tables with Python using column sizing, alignment, and pagination controls.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Convert CSV to PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-python\u002F\",\n      \"datePublished\": \"2026-09-01T04:35:12.000Z\",\n      \"dateModified\": \"2026-09-01T05:07:13.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert CSV datasets into styled, tagged PDF tables with Python using column sizing, alignment, and pagination controls.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert CSV to PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-csv-to-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4198,4199,4200,4201,4202,4203,4204,4205],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1418,"name":1419,"slug":1420,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-csv-to-pdf-with-python\u002F","Convert CSV to PDF with Python | pdfRest",{"id":4210,"uuid":4211,"title":4212,"slug":4213,"html":4214,"comment_id":4210,"feature_image":48,"featured":284,"visibility":1257,"created_at":4215,"updated_at":4216,"published_at":2995,"custom_excerpt":4217,"codeinjection_head":4218,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4219,"primary_tag":4226,"url":4227,"excerpt":4217,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4228,"meta_description":4217,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a989aedd1b70dd2e29789d3","639fa173-d7e3-4cbe-8ae4-f50b926d2ff5","How to Convert Email to PDF in .NET with C#","how-to-convert-email-to-pdf-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This .NET walkthrough uses C# and \u003Ccode>HttpClient\u003C\u002Fcode> to submit the request. It converts an Email (\u003Ccode>.eml\u003C\u002Fcode>) file into a PDF through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. The complete sample is included below so .NET with C# developers can see the file handling, request construction, and response path together.\u003C\u002Fp>\n\n\u003Ch2>Why Email to PDF in .NET with C#?\u003C\u002Fh2>\n\n\u003Cp>.NET services often need to turn communications received by a business workflow into documents that can travel with case records, approval packages, or customer correspondence. An \u003Ccode>.eml\u003C\u002Fcode>-to-PDF conversion makes that step available directly from C#.\u003C\u002Fp>\n\n\u003Cp>An ASP.NET application handling employee-relations cases could convert a submitted Email file, retain the returned PDF resource ID with the case, and show reviewers a familiar document view alongside the original evidence. The source Email remains a distinct input resource.\u003C\u002Fp>\n\n\u003Cp>The example uses disposable request content and \u003Ccode>HttpClient\u003C\u002Fcode>, which matches the resource-management model C# developers expect when a service uploads a file and then parses its result.\u003C\u002Fp>\n\n\u003Ch2>C# Code Example for Email to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">\u002F*\n * What this sample does:\n * - Converts an Email (.eml) file to PDF through the \u002Fpdf endpoint.\n * - Sends the Email file directly in a multipart request.\n *\n * Setup (environment):\n * - Set PDFREST_API_KEY=your_api_key_here\n * - Optional: set PDFREST_URL to override the API region.\n *\n * Usage:\n *   dotnet run -- pdf-from-email-multipart \u003CinputFile>\n *\u002F\nusing System.Net.Http.Headers;\n\nnamespace Samples.EndpointExamples.MultipartPayload;\n\npublic static class PdfFromEmail\n{\n    public static async Task Execute(string[] args)\n    {\n        var inputPath = args.Length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.eml\";\n        var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\n        if (string.IsNullOrWhiteSpace(apiKey)) throw new InvalidOperationException(\"Missing PDFREST_API_KEY\");\n        var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n        using var client = new HttpClient { BaseAddress = new Uri(baseUrl) };\n        client.DefaultRequestHeaders.TryAddWithoutValidation(\"Api-Key\", apiKey);\n        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(\"application\u002Fjson\"));\n        using var form = new MultipartFormDataContent();\n        var inputContent = new ByteArrayContent(await File.ReadAllBytesAsync(inputPath));\n        inputContent.Headers.ContentType = new MediaTypeHeaderValue(\"message\u002Frfc822\");\n        form.Add(inputContent, \"file\", Path.GetFileName(inputPath));\n        form.Add(new StringContent(\"pdf_from_email\"), \"output\");\n        var response = await client.PostAsync(\"pdf\", form);\n        var result = await response.Content.ReadAsStringAsync();\n        Console.WriteLine(result);\n        if (!response.IsSuccessStatusCode) Environment.ExitCode = 1;\n    }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-email.cs\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Configure the service and input\u003C\u002Fh3>\n\n\u003Cpre class=\"language-csharp\">var inputPath = args.Length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.eml\";\n        var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\n        if (string.IsNullOrWhiteSpace(apiKey)) throw new InvalidOperationException(\"Missing PDFREST_API_KEY\");\n        var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n        using var client = new HttpClient { BaseAddress = new Uri(baseUrl) };\n        client.DefaultRequestHeaders.TryAddWithoutValidation(\"Api-Key\", apiKey);\n        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(\"application\u002Fjson\"));\u003C\u002Fpre>\n\n\u003Cp>For this Email to PDF example, .NET with C# sends the multipart request to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. The C# samples use framework \u003Ccode>HttpClient\u003C\u002Fcode> APIs and disposable content objects. API credentials come from \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode>, keeping the secret out of the source file and request body. The sample’s placeholder path and API key make the moving pieces visible; replace them with a real local path and protected runtime credential before using the request.\u003C\u002Fp>\n\n\u003Ch3>Upload the Email File\u003C\u002Fh3>\n\n\u003Cpre class=\"language-csharp\">using var form = new MultipartFormDataContent();\n        var inputContent = new ByteArrayContent(await File.ReadAllBytesAsync(inputPath));\n        inputContent.Headers.ContentType = new MediaTypeHeaderValue(\"message\u002Frfc822\");\n        form.Add(inputContent, \"file\", Path.GetFileName(inputPath));\n        form.Add(new StringContent(\"pdf_from_email\"), \"output\");\n        var response = await client.PostAsync(\"pdf\", form);\n        var result = await response.Content.ReadAsStringAsync();\n        Console.WriteLine(result);\n        if (!response.IsSuccessStatusCode) Environment.ExitCode = 1;\n    }\n}\u003C\u002Fpre>\n\n\u003Cp>The .NET with C# request places the Email source in the multipart part named \u003Ccode>file\u003C\u002Fcode>. Retain its \u003Ccode>.eml\u003C\u002Fcode> filename extension because Convert to PDF uses the uploaded name to identify the source type, then use the optional \u003Ccode>output\u003C\u002Fcode> field to choose the generated resource name without a PDF extension.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-csharp\">client.DefaultRequestHeaders.TryAddWithoutValidation(\"Api-Key\", apiKey);\n        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(\"application\u002Fjson\"));\n        using var form = new MultipartFormDataContent();\n        var inputContent = new ByteArrayContent(await File.ReadAllBytesAsync(inputPath));\n        inputContent.Headers.ContentType = new MediaTypeHeaderValue(\"message\u002Frfc822\");\n        form.Add(inputContent, \"file\", Path.GetFileName(inputPath));\n        form.Add(new StringContent(\"pdf_from_email\"), \"output\");\n        var response = await client.PostAsync(\"pdf\", form);\n        var result = await response.Content.ReadAsStringAsync();\n        Console.WriteLine(result);\n        if (!response.IsSuccessStatusCode) Environment.ExitCode = 1;\u003C\u002Fpre>\n\n\u003Cp>For the Email to PDF form, \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> owns the uploaded streams and text values. The .NET runtime calculates the multipart boundary and content type when \u003Ccode>HttpClient\u003C\u002Fcode> sends the container.\u003C\u002Fp>\n\n\u003Ch3>Read the output resource\u003C\u002Fh3>\n\n\u003Cpre class=\"language-csharp\">inputContent.Headers.ContentType = new MediaTypeHeaderValue(\"message\u002Frfc822\");\n        form.Add(inputContent, \"file\", Path.GetFileName(inputPath));\n        form.Add(new StringContent(\"pdf_from_email\"), \"output\");\n        var response = await client.PostAsync(\"pdf\", form);\n        var result = await response.Content.ReadAsStringAsync();\n        Console.WriteLine(result);\n        if (!response.IsSuccessStatusCode) Environment.ExitCode = 1;\n    }\n}\u003C\u002Fpre>\n\n\u003Cp>After the Email to PDF call, the client reads the response text and reports non-success status through the process exit code. A successful JSON body identifies the managed output resource, while an unsuccessful body should be surfaced to the calling application.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this .NET with C# tutorial, you converted an Email file into a PDF resource with a direct multipart request. The pattern gives a message-based workflow a document output that can be reviewed, downloaded, or passed to another pdfRest operation.\u003C\u002Fp>\n\n\u003Cp>Try representative email to pdf inputs in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the authoritative request fields, accepted values, and response contract, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool documentation\u003C\u002Fa>. The same request pattern can then be adapted to your .NET with C# application’s error handling, retention policy, and delivery workflow.\u003C\u002Fp>\n\n\u003Cp>The repository also provides a JSON-payload Email-to-PDF version for .NET with C#. It uploads the message first and then posts its resource ID to \u003Ccode>\u002Fpdf\u003C\u002Fcode>, which is useful when an application stages inputs for several later operations. \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-from-email.cs\">View the JSON-payload sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-02T21:53:49.000+00:00","2026-09-03T20:36:27.000+00:00","Convert Email (.eml) files to PDF with .NET with C# using a multipart pdfRest API request.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-email-to-pdf-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert Email to PDF in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-email-to-pdf-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-email-to-pdf-in-net-with-c\u002F\",\n      \"datePublished\": \"2026-09-03T17:04:35.000Z\",\n      \"dateModified\": \"2026-09-03T17:04:35.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert Email (.eml) files to PDF with .NET with C# using a multipart pdfRest API request.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Conversion, Convert to PDF, Email\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Email to PDF in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-email-to-pdf-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4220,4221,4222,4223,4224,4225],{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1398,"name":1399,"slug":1400,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-email-to-pdf-in-net-with-c\u002F","How to Convert Email to PDF in .NET with C# | pdfRest",{"id":4230,"uuid":4231,"title":4232,"slug":4233,"html":4234,"comment_id":4230,"feature_image":48,"featured":284,"visibility":1257,"created_at":4235,"updated_at":4236,"published_at":2995,"custom_excerpt":4237,"codeinjection_head":4238,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4239,"primary_tag":4246,"url":4247,"excerpt":4237,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4248,"meta_description":4237,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a989aebd1b70dd2e29789b8","bfea58dd-555c-404a-94b1-08e888439b43","How to Convert Email to PDF with cURL","how-to-convert-email-to-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This cURL walkthrough uses the public pdfRest API directly from a shell script. It converts an Email (\u003Ccode>.eml\u003C\u002Fcode>) file into a PDF through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. The complete sample is included below so cURL developers can see the file handling, request construction, and response path together.\u003C\u002Fp>\n\n\u003Ch2>Why Email to PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>Shell scripts often sit at the edge of intake jobs, release processes, and operations tooling. Converting an \u003Ccode>.eml\u003C\u002Fcode> file there creates a document artifact that can move through the same storage, review, and delivery steps as other PDFs.\u003C\u002Fp>\n\n\u003Cp>A compliance export job, for instance, can receive a mailbox archive item, send the selected message to pdfRest, and save the resulting PDF beside a case bundle. The script stays focused on the request and resource response instead of embedding a mail-rendering engine.\u003C\u002Fp>\n\n\u003Cp>Because the call is standard multipart HTTP, the same command can be run interactively for a one-off record or placed in a scheduled shell workflow. The output ID provides the handoff point for an immediate download or a later pdfRest request.\u003C\u002Fp>\n\n\u003Ch2>cURL Code Example for Email to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">#!\u002Fbin\u002Fsh\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# This sample converts an Email (.eml) file to PDF by sending it directly in a\n# multipart \u002Fpdf request.\nINPUT_PATH=\"\u002Fpath\u002Fto\u002Fsample.eml\"\n\ncurl --location \"$API_URL\u002Fpdf\" \\\n  --header \"Accept: application\u002Fjson\" \\\n  --header \"Content-Type: multipart\u002Fform-data\" \\\n  --header \"Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  --form \"file=@$INPUT_PATH;type=message\u002Frfc822\" \\\n  --form \"output=pdf_from_email\"\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-email.sh\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Configure the service and input\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>For this Email to PDF example, cURL sends the multipart request to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. cURL needs no language package installation. The sample keeps the service URL, API key, input path, and output name together near the top of the shell script so those values can be replaced before the request is sent. The sample’s placeholder path and API key make the moving pieces visible; replace them with a real local path and protected runtime credential before using the request.\u003C\u002Fp>\n\n\u003Ch3>Upload the Email File\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">--header \"Accept: application\u002Fjson\" \\\n  --header \"Content-Type: multipart\u002Fform-data\" \\\n  --header \"Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  --form \"file=@$INPUT_PATH;type=message\u002Frfc822\" \\\n  --form \"output=pdf_from_email\"\u003C\u002Fpre>\n\n\u003Cp>The cURL request places the Email source in the multipart part named \u003Ccode>file\u003C\u002Fcode>. Retain its \u003Ccode>.eml\u003C\u002Fcode> filename extension because Convert to PDF uses the uploaded name to identify the source type, then use the optional \u003Ccode>output\u003C\u002Fcode> field to choose the generated resource name without a PDF extension.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">--header \"Content-Type: multipart\u002Fform-data\" \\\n  --header \"Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  --form \"file=@$INPUT_PATH;type=message\u002Frfc822\" \\\n  --form \"output=pdf_from_email\"\u003C\u002Fpre>\n\n\u003Cp>For the Email to PDF form, each \u003Ccode>--form\u003C\u002Fcode> option creates one multipart field. cURL reads file fields from disk when their value begins with \u003Ccode>@\u003C\u002Fcode>, while ordinary quoted values become text fields.\u003C\u002Fp>\n\n\u003Ch3>Read the output resource\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\"># multipart \u002Fpdf request.\nINPUT_PATH=\"\u002Fpath\u002Fto\u002Fsample.eml\"\n\ncurl --location \"$API_URL\u002Fpdf\" \\\n  --header \"Accept: application\u002Fjson\" \\\n  --header \"Content-Type: multipart\u002Fform-data\" \\\n  --header \"Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  --form \"file=@$INPUT_PATH;type=message\u002Frfc822\" \\\n  --form \"output=pdf_from_email\"\u003C\u002Fpre>\n\n\u003Cp>After the Email to PDF call, the command prints the JSON response. Read \u003Ccode>outputId\u003C\u002Fcode> to retain the generated resource for a later call or download it from the returned URL before the service retention period ends.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this cURL tutorial, you converted an Email file into a PDF resource with a direct multipart request. The pattern gives a message-based workflow a document output that can be reviewed, downloaded, or passed to another pdfRest operation.\u003C\u002Fp>\n\n\u003Cp>Try representative email to pdf inputs in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the authoritative request fields, accepted values, and response contract, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool documentation\u003C\u002Fa>. The same request pattern can then be adapted to your cURL application’s error handling, retention policy, and delivery workflow.\u003C\u002Fp>\n\n\u003Cp>The repository also provides a JSON-payload Email-to-PDF version for cURL. It uploads the message first and then posts its resource ID to \u003Ccode>\u002Fpdf\u003C\u002Fcode>, which is useful when an application stages inputs for several later operations. \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-from-email.sh\">View the JSON-payload sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-02T21:53:47.000+00:00","2026-09-03T20:36:28.000+00:00","Convert Email (.eml) files to PDF with cURL using a multipart pdfRest API request.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-email-to-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Convert Email to PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-email-to-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-email-to-pdf-with-curl\u002F\",\n      \"datePublished\": \"2026-09-03T17:04:35.000Z\",\n      \"dateModified\": \"2026-09-03T17:04:35.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert Email (.eml) files to PDF with cURL using a multipart pdfRest API request.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, Email, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Email to PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-email-to-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4240,4241,4242,4243,4244,4245],{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1398,"name":1399,"slug":1400,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-email-to-pdf-with-curl\u002F","How to Convert Email to PDF with cURL | pdfRest",{"id":4250,"uuid":4251,"title":4252,"slug":4253,"html":4254,"comment_id":4250,"feature_image":48,"featured":284,"visibility":1257,"created_at":4255,"updated_at":4236,"published_at":2995,"custom_excerpt":4256,"codeinjection_head":4257,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4258,"primary_tag":4265,"url":4266,"excerpt":4256,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4267,"meta_description":4256,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a989aecd1b70dd2e29789c1","c47b67bf-1649-4026-b858-b0e13c92aa53","How to Convert Email to PDF with Java","how-to-convert-email-to-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This Java walkthrough uses an OkHttp multipart request from a JVM application. It converts an Email (\u003Ccode>.eml\u003C\u002Fcode>) file into a PDF through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. The complete sample is included below so Java developers can see the file handling, request construction, and response path together.\u003C\u002Fp>\n\n\u003Ch2>Why Email to PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>Java services commonly handle structured business events while message files arrive from gateways, records systems, or customer portals. Turning an \u003Ccode>.eml\u003C\u002Fcode> message into PDF gives the service a shareable record without introducing a separate mail-viewing component.\u003C\u002Fp>\n\n\u003Cp>A Spring-based case service could convert correspondence attached to a complaint, store the returned PDF ID with the case, and let reviewers retrieve the same rendered document from the case screen. The original Email file can remain in the source repository according to its own policy.\u003C\u002Fp>\n\n\u003Cp>OkHttp handles the file upload and response in the same client style used elsewhere in Java integrations. That makes it straightforward to add normal retry, audit, and resource-lifecycle handling around the sample.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example for Email to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\n\npublic class PdfFromEmail {\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, replace the URL above\n  \u002F\u002F with https:\u002F\u002Feu-api.pdfrest.com. For more information, visit\n  \u002F\u002F https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  \u002F\u002F Converts an Email (.eml) file to PDF by sending the file directly in a\n  \u002F\u002F multipart request.\n  public static void main(String[] args) throws IOException {\n    File inputFile = new File(args.length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.eml\");\n    Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n    String apiKey = dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY);\n    MultipartBody.Builder form =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\n                \"file\",\n                inputFile.getName(),\n                RequestBody.create(inputFile, MediaType.parse(\"message\u002Frfc822\")))\n            .addFormDataPart(\"output\", \"pdf_from_email\");\n    Request request =\n        new Request.Builder()\n            .url(API_URL + \"\u002Fpdf\")\n            .header(\"Api-Key\", apiKey)\n            .post(form.build())\n            .build();\n    send(request);\n  }\n\n  private static void send(Request request) throws IOException {\n    OkHttpClient client = new OkHttpClient.Builder().readTimeout(60, TimeUnit.SECONDS).build();\n    try (Response response = client.newCall(request).execute()) {\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) System.out.println(response.body().string());\n      if (!response.isSuccessful()) System.exit(1);\n    }\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPdfFromEmail.java\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Configure the service and input\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, replace the URL above\n  \u002F\u002F with https:\u002F\u002Feu-api.pdfrest.com. For more information, visit\n  \u002F\u002F https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\u003C\u002Fpre>\n\n\u003Cp>For this Email to PDF example, Java sends the multipart request to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. The Java samples use OkHttp for multipart HTTP requests and dotenv support for repository configuration. The sample project supplies those dependencies; applications that copy the class elsewhere need equivalent dependencies and secure runtime configuration. The sample’s placeholder path and API key make the moving pieces visible; replace them with a real local path and protected runtime credential before using the request.\u003C\u002Fp>\n\n\u003Ch3>Upload the Email File\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\n                \"file\",\n                inputFile.getName(),\n                RequestBody.create(inputFile, MediaType.parse(\"message\u002Frfc822\")))\n            .addFormDataPart(\"output\", \"pdf_from_email\");\n    Request request =\n        new Request.Builder()\n            .url(API_URL + \"\u002Fpdf\")\n            .header(\"Api-Key\", apiKey)\u003C\u002Fpre>\n\n\u003Cp>The Java request places the Email source in the multipart part named \u003Ccode>file\u003C\u002Fcode>. Retain its \u003Ccode>.eml\u003C\u002Fcode> filename extension because Convert to PDF uses the uploaded name to identify the source type, then use the optional \u003Ccode>output\u003C\u002Fcode> field to choose the generated resource name without a PDF extension.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n    String apiKey = dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY);\n    MultipartBody.Builder form =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\n                \"file\",\n                inputFile.getName(),\n                RequestBody.create(inputFile, MediaType.parse(\"message\u002Frfc822\")))\n            .addFormDataPart(\"output\", \"pdf_from_email\");\n    Request request =\u003C\u002Fpre>\n\n\u003Cp>For the Email to PDF form, okHttp’s \u003Ccode>MultipartBody.Builder\u003C\u002Fcode> constructs the form and assigns its boundary. Each file part carries a filename and media type, while conversion options are ordinary text parts.\u003C\u002Fp>\n\n\u003Ch3>Read the output resource\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">private static void send(Request request) throws IOException {\n    OkHttpClient client = new OkHttpClient.Builder().readTimeout(60, TimeUnit.SECONDS).build();\n    try (Response response = client.newCall(request).execute()) {\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) System.out.println(response.body().string());\n      if (!response.isSuccessful()) System.exit(1);\n    }\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>After the Email to PDF call, the response block checks the HTTP status before printing its body. On success, the JSON contains the output resource ID and URL; on failure, the printed body gives the API error detail needed for diagnosis.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this Java tutorial, you converted an Email file into a PDF resource with a direct multipart request. The pattern gives a message-based workflow a document output that can be reviewed, downloaded, or passed to another pdfRest operation.\u003C\u002Fp>\n\n\u003Cp>Try representative email to pdf inputs in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the authoritative request fields, accepted values, and response contract, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool documentation\u003C\u002Fa>. The same request pattern can then be adapted to your Java application’s error handling, retention policy, and delivery workflow.\u003C\u002Fp>\n\n\u003Cp>The repository also provides a JSON-payload Email-to-PDF version for Java. It uploads the message first and then posts its resource ID to \u003Ccode>\u002Fpdf\u003C\u002Fcode>, which is useful when an application stages inputs for several later operations. \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPdfFromEmail.java\">View the JSON-payload sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-02T21:53:48.000+00:00","Convert Email (.eml) files to PDF with Java using a multipart pdfRest API request.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-email-to-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Convert Email to PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-email-to-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-email-to-pdf-with-java\u002F\",\n      \"datePublished\": \"2026-09-03T17:04:35.000Z\",\n      \"dateModified\": \"2026-09-03T17:04:35.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert Email (.eml) files to PDF with Java using a multipart pdfRest API request.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, Email, Java\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Email to PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-email-to-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4259,4260,4261,4262,4263,4264],{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1398,"name":1399,"slug":1400,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-email-to-pdf-with-java\u002F","How to Convert Email to PDF with Java | pdfRest",{"id":4269,"uuid":4270,"title":4271,"slug":4272,"html":4273,"comment_id":4269,"feature_image":48,"featured":284,"visibility":1257,"created_at":4215,"updated_at":4274,"published_at":4275,"custom_excerpt":4276,"codeinjection_head":4277,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4278,"primary_tag":4285,"url":4286,"excerpt":4276,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4287,"meta_description":4276,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a989aedd1b70dd2e29789ca","b072d26e-b2d5-418c-94da-c76bcd5c28f1","How to Convert Email to PDF with JavaScript in NodeJS","how-to-convert-email-to-pdf-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This NodeJS walkthrough uses JavaScript, Axios, and multipart form data. It converts an Email (\u003Ccode>.eml\u003C\u002Fcode>) file into a PDF through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. The complete sample is included below so JavaScript in NodeJS developers can see the file handling, request construction, and response path together.\u003C\u002Fp>\n\n\u003Ch2>Why Email to PDF with JavaScript in NodeJS?\u003C\u002Fh2>\n\n\u003Cp>NodeJS services frequently collect messages from webhooks, support tooling, and customer-upload flows. Converting an \u003Ccode>.eml\u003C\u002Fcode> input to PDF lets the service expose a stable document attachment without depending on the recipient’s email client.\u003C\u002Fp>\n\n\u003Cp>A customer-success application could receive a mailed escalation, create the PDF through its Node worker, and make the resulting resource available with the associated support record. Reviewers gain a consistent document while the original mail data remains available to the application.\u003C\u002Fp>\n\n\u003Cp>The asynchronous Axios flow surfaces the resource JSON through the normal promise path, so an application can queue a download, attach the ID to a case, or continue into another PDF operation after the request resolves.\u003C\u002Fp>\n\n\u003Ch2>JavaScript in NodeJS Code Example for Email to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar fs = require(\"fs\");\nvar FormData = require(\"form-data\");\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n\u002F\u002F This sample converts an Email (.eml) file to PDF by sending it directly in a\n\u002F\u002F multipart \u002Fpdf request.\nvar inputPath = \"\u002Fpath\u002Fto\u002Fsample.eml\";\nvar form = new FormData();\nform.append(\"file\", fs.createReadStream(inputPath), { contentType: \"message\u002Frfc822\" });\nform.append(\"output\", \"pdf_from_email\");\n\naxios.post(apiUrl + \"\u002Fpdf\", form, { headers: { \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", ...form.getHeaders() }, maxBodyLength: Infinity })\n.then((response) => { console.log(JSON.stringify(response.data, null, 2)); })\n.catch((error) => { console.error(error.response ? error.response.data : error.message); process.exitCode = 1; });\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-email.js\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Configure the service and input\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\u003C\u002Fpre>\n\n\u003Cp>For this Email to PDF example, JavaScript in NodeJS sends the multipart request to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. The NodeJS samples use \u003Ccode>axios\u003C\u002Fcode> for HTTP, \u003Ccode>form-data\u003C\u002Fcode> for multipart encoding, and Node’s file-system module for local inputs. Install the packages listed in the repository’s JavaScript package manifest when adapting the example. The sample’s placeholder path and API key make the moving pieces visible; replace them with a real local path and protected runtime credential before using the request.\u003C\u002Fp>\n\n\u003Ch3>Upload the Email File\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F multipart \u002Fpdf request.\nvar inputPath = \"\u002Fpath\u002Fto\u002Fsample.eml\";\nvar form = new FormData();\nform.append(\"file\", fs.createReadStream(inputPath), { contentType: \"message\u002Frfc822\" });\nform.append(\"output\", \"pdf_from_email\");\n\naxios.post(apiUrl + \"\u002Fpdf\", form, { headers: { \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", ...form.getHeaders() }, maxBodyLength: Infinity })\n.then((response) => { console.log(JSON.stringify(response.data, null, 2)); })\n.catch((error) => { console.error(error.response ? error.response.data : error.message); process.exitCode = 1; });\u003C\u002Fpre>\n\n\u003Cp>The JavaScript in NodeJS request places the Email source in the multipart part named \u003Ccode>file\u003C\u002Fcode>. Retain its \u003Ccode>.eml\u003C\u002Fcode> filename extension because Convert to PDF uses the uploaded name to identify the source type, then use the optional \u003Ccode>output\u003C\u002Fcode> field to choose the generated resource name without a PDF extension.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar fs = require(\"fs\");\nvar FormData = require(\"form-data\");\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\u003C\u002Fpre>\n\n\u003Cp>For the Email to PDF form, \u003Ccode>FormData\u003C\u002Fcode> appends a readable file stream and the text options. Its generated headers include the multipart boundary, so the request combines \u003Ccode>form.getHeaders()\u003C\u002Fcode> with the \u003Ccode>Api-Key\u003C\u002Fcode> header rather than setting a boundary by hand.\u003C\u002Fp>\n\n\u003Ch3>Read the output resource\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar fs = require(\"fs\");\nvar FormData = require(\"form-data\");\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\u003C\u002Fpre>\n\n\u003Cp>After the Email to PDF call, axios resolves successful responses to a JSON object and sends API failures to the catch block. The sample prints either the output-resource details or the returned error payload, which is a useful starting point for production logging.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this JavaScript in NodeJS tutorial, you converted an Email file into a PDF resource with a direct multipart request. The pattern gives a message-based workflow a document output that can be reviewed, downloaded, or passed to another pdfRest operation.\u003C\u002Fp>\n\n\u003Cp>Try representative email to pdf inputs in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the authoritative request fields, accepted values, and response contract, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool documentation\u003C\u002Fa>. The same request pattern can then be adapted to your JavaScript in NodeJS application’s error handling, retention policy, and delivery workflow.\u003C\u002Fp>\n\n\u003Cp>The repository also provides a JSON-payload Email-to-PDF version for JavaScript in NodeJS. It uploads the message first and then posts its resource ID to \u003Ccode>\u002Fpdf\u003C\u002Fcode>, which is useful when an application stages inputs for several later operations. \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-from-email.js\">View the JSON-payload sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-03T20:36:29.000+00:00","2026-09-03T17:04:36.000+00:00","Convert Email (.eml) files to PDF with JavaScript in NodeJS using a multipart pdfRest API request.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-email-to-pdf-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert Email to PDF with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-email-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-email-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2026-09-03T17:04:36.000Z\",\n      \"dateModified\": \"2026-09-03T17:04:36.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert Email (.eml) files to PDF with JavaScript in NodeJS using a multipart pdfRest API request.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, Email, JavaScript\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Email to PDF with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-email-to-pdf-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4279,4280,4281,4282,4283,4284],{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1398,"name":1399,"slug":1400,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-email-to-pdf-with-javascript-in-nodejs\u002F","How to Convert Email to PDF with JavaScript in NodeJS | pdfRest",{"id":4289,"uuid":4290,"title":4291,"slug":4292,"html":4293,"comment_id":4289,"feature_image":48,"featured":284,"visibility":1257,"created_at":4215,"updated_at":4294,"published_at":4275,"custom_excerpt":4295,"codeinjection_head":4296,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4297,"primary_tag":4304,"url":4305,"excerpt":4295,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4306,"meta_description":4295,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a989aedd1b70dd2e29789dc","3358c94f-1ed5-4100-ad14-dac33ea342e6","How to Convert Email to PDF with PHP","how-to-convert-email-to-pdf-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This PHP walkthrough uses Guzzle to send the file and conversion options. It converts an Email (\u003Ccode>.eml\u003C\u002Fcode>) file into a PDF through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. The complete sample is included below so PHP developers can see the file handling, request construction, and response path together.\u003C\u002Fp>\n\n\u003Ch2>Why Email to PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>PHP portals and workflow applications often receive Email files as part of customer cases, requests, or uploaded evidence. Creating a PDF copy gives staff a predictable document to review without asking them to open a mailbox-format file.\u003C\u002Fp>\n\n\u003Cp>A web-based legal-intake portal could take an \u003Ccode>.eml\u003C\u002Fcode> message submitted with a matter, send it to pdfRest from a PHP worker, and associate the output resource with the case record. That supports a document-oriented review process while retaining the original input separately.\u003C\u002Fp>\n\n\u003Cp>Guzzle’s multipart API makes the request structure direct: stream the Email file, name the output, and process the returned JSON. The surrounding PHP application can then decide whether to download the result or pass its ID to another tool.\u003C\u002Fp>\n\n\u003Ch2>PHP Code Example for Email to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Utils;\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n\u002F\u002F This sample converts an Email (.eml) file to PDF by sending it directly in a\n\u002F\u002F multipart \u002Fpdf request.\n$inputPath = '\u002Fpath\u002Fto\u002Fsample.eml';\n$multipart = [\n  ['name' => 'file', 'contents' => Utils::tryFopen($inputPath, 'r'), 'filename' => basename($inputPath), 'headers' => ['Content-Type' => 'message\u002Frfc822']],\n  ['name' => 'output', 'contents' => 'pdf_from_email'],\n];\n$response = (new Client())->post($apiUrl . '\u002Fpdf', ['headers' => ['Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'Accept' => 'application\u002Fjson'], 'multipart' => $multipart]);\necho $response->getBody();\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-email.php\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Configure the service and input\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\u003C\u002Fpre>\n\n\u003Cp>For this Email to PDF example, PHP sends the multipart request to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. The PHP samples use Guzzle for HTTP and PSR-7 stream utilities for uploads. Install Guzzle with Composer when moving the code outside the repository, and provide the API key through protected runtime configuration. The sample’s placeholder path and API key make the moving pieces visible; replace them with a real local path and protected runtime credential before using the request.\u003C\u002Fp>\n\n\u003Ch3>Upload the Email File\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">\u002F\u002F multipart \u002Fpdf request.\n$inputPath = '\u002Fpath\u002Fto\u002Fsample.eml';\n$multipart = [\n  ['name' => 'file', 'contents' => Utils::tryFopen($inputPath, 'r'), 'filename' => basename($inputPath), 'headers' => ['Content-Type' => 'message\u002Frfc822']],\n  ['name' => 'output', 'contents' => 'pdf_from_email'],\n];\n$response = (new Client())->post($apiUrl . '\u002Fpdf', ['headers' => ['Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'Accept' => 'application\u002Fjson'], 'multipart' => $multipart]);\necho $response->getBody();\u003C\u002Fpre>\n\n\u003Cp>The PHP request places the Email source in the multipart part named \u003Ccode>file\u003C\u002Fcode>. Retain its \u003Ccode>.eml\u003C\u002Fcode> filename extension because Convert to PDF uses the uploaded name to identify the source type, then use the optional \u003Ccode>output\u003C\u002Fcode> field to choose the generated resource name without a PDF extension.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">\u002F\u002F multipart \u002Fpdf request.\n$inputPath = '\u002Fpath\u002Fto\u002Fsample.eml';\n$multipart = [\n  ['name' => 'file', 'contents' => Utils::tryFopen($inputPath, 'r'), 'filename' => basename($inputPath), 'headers' => ['Content-Type' => 'message\u002Frfc822']],\n  ['name' => 'output', 'contents' => 'pdf_from_email'],\n];\n$response = (new Client())->post($apiUrl . '\u002Fpdf', ['headers' => ['Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'Accept' => 'application\u002Fjson'], 'multipart' => $multipart]);\necho $response->getBody();\u003C\u002Fpre>\n\n\u003Cp>For the Email to PDF form, guzzle accepts multipart fields as an array. Each entry names a field and supplies either stream content for a file or a simple string for an option, then Guzzle produces the correct multipart boundary.\u003C\u002Fp>\n\n\u003Ch3>Read the output resource\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">['name' => 'file', 'contents' => Utils::tryFopen($inputPath, 'r'), 'filename' => basename($inputPath), 'headers' => ['Content-Type' => 'message\u002Frfc822']],\n  ['name' => 'output', 'contents' => 'pdf_from_email'],\n];\n$response = (new Client())->post($apiUrl . '\u002Fpdf', ['headers' => ['Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'Accept' => 'application\u002Fjson'], 'multipart' => $multipart]);\necho $response->getBody();\u003C\u002Fpre>\n\n\u003Cp>After the Email to PDF call, the example prints Guzzle’s response body. A production caller can decode that JSON, retain \u003Ccode>outputId\u003C\u002Fcode>, and branch on an unsuccessful response instead of assuming every submitted conversion completed.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this PHP tutorial, you converted an Email file into a PDF resource with a direct multipart request. The pattern gives a message-based workflow a document output that can be reviewed, downloaded, or passed to another pdfRest operation.\u003C\u002Fp>\n\n\u003Cp>Try representative email to pdf inputs in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the authoritative request fields, accepted values, and response contract, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool documentation\u003C\u002Fa>. The same request pattern can then be adapted to your PHP application’s error handling, retention policy, and delivery workflow.\u003C\u002Fp>\n\n\u003Cp>The repository also provides a JSON-payload Email-to-PDF version for PHP. It uploads the message first and then posts its resource ID to \u003Ccode>\u002Fpdf\u003C\u002Fcode>, which is useful when an application stages inputs for several later operations. \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-from-email.php\">View the JSON-payload sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-03T20:36:30.000+00:00","Convert Email (.eml) files to PDF with PHP using a multipart pdfRest API request.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-email-to-pdf-with-php\u002F#article\",\n      \"headline\": \"How to Convert Email to PDF with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-email-to-pdf-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-email-to-pdf-with-php\u002F\",\n      \"datePublished\": \"2026-09-03T17:04:36.000Z\",\n      \"dateModified\": \"2026-09-03T17:04:36.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert Email (.eml) files to PDF with PHP using a multipart pdfRest API request.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, Email, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Email to PDF with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-email-to-pdf-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4298,4299,4300,4301,4302,4303],{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1398,"name":1399,"slug":1400,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-email-to-pdf-with-php\u002F","How to Convert Email to PDF with PHP | pdfRest",{"id":4308,"uuid":4309,"title":4310,"slug":4311,"html":4312,"comment_id":4308,"feature_image":48,"featured":284,"visibility":1257,"created_at":4313,"updated_at":4294,"published_at":4275,"custom_excerpt":4314,"codeinjection_head":4315,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4316,"primary_tag":4323,"url":4324,"excerpt":4314,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4325,"meta_description":4314,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a989aeed1b70dd2e29789e5","b4812865-941e-43aa-94e5-ee3586b45bda","How to Convert Email to PDF with Python","how-to-convert-email-to-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This Python walkthrough uses \u003Ccode>requests\u003C\u002Fcode> and a multipart encoder. It converts an Email (\u003Ccode>.eml\u003C\u002Fcode>) file into a PDF through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. The complete sample is included below so Python developers can see the file handling, request construction, and response path together.\u003C\u002Fp>\n\n\u003Ch2>Why Email to PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>Python ingestion pipelines commonly receive message files alongside other case, research, or operational inputs. Converting an \u003Ccode>.eml\u003C\u002Fcode> item to PDF creates a stable artifact that can join reports, review packets, and document-processing pipelines.\u003C\u002Fp>\n\n\u003Cp>A data-governance workflow could convert a notification email associated with a model run, keep the PDF with the run’s evidence package, and retain the source message in its normal data store. The resulting document is easy for a reviewer to open without mail-client context.\u003C\u002Fp>\n\n\u003Cp>The sample keeps upload and response handling explicit, so a Python application can add its own retry policy, output download, or resource cleanup after it receives the managed PDF ID.\u003C\u002Fp>\n\n\u003Ch2>Python Code Example for Email to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">import json\nimport os\nimport requests\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# This sample converts an Email (.eml) file to PDF by sending it directly in a\n# multipart \u002Fpdf request.\ninput_path = \"\u002Fpath\u002Fto\u002Fsample.eml\"\n\nfrom requests_toolbelt import MultipartEncoder\nwith open(input_path, \"rb\") as input_file:\n    fields = {\n        \"file\": (os.path.basename(input_path), input_file, \"message\u002Frfc822\"),\n        \"output\": \"pdf_from_email\",\n    }\n    form = MultipartEncoder(fields=fields)\n    response = requests.post(api_url + \"\u002Fpdf\", data=form, headers={\n        \"Accept\": \"application\u002Fjson\",\n        \"Content-Type\": form.content_type,\n        \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    })\n\nprint(\"Response status code: \" + str(response.status_code))\nif response.ok:\n    print(json.dumps(response.json(), indent=2))\nelse:\n    print(response.text)\n    raise SystemExit(1)\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-email.py\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Configure the service and input\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\"># By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>For this Email to PDF example, Python sends the multipart request to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. The Python samples use \u003Ccode>requests\u003C\u002Fcode> and \u003Ccode>MultipartEncoder\u003C\u002Fcode> from \u003Ccode>requests-toolbelt\u003C\u002Fcode>. Install both packages when using the file outside the samples project and keep the API key in environment configuration. The sample’s placeholder path and API key make the moving pieces visible; replace them with a real local path and protected runtime credential before using the request.\u003C\u002Fp>\n\n\u003Ch3>Upload the Email File\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nwith open(input_path, \"rb\") as input_file:\n    fields = {\n        \"file\": (os.path.basename(input_path), input_file, \"message\u002Frfc822\"),\n        \"output\": \"pdf_from_email\",\n    }\n    form = MultipartEncoder(fields=fields)\n    response = requests.post(api_url + \"\u002Fpdf\", data=form, headers={\n        \"Accept\": \"application\u002Fjson\",\n        \"Content-Type\": form.content_type,\n        \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\u003C\u002Fpre>\n\n\u003Cp>The Python request places the Email source in the multipart part named \u003Ccode>file\u003C\u002Fcode>. Retain its \u003Ccode>.eml\u003C\u002Fcode> filename extension because Convert to PDF uses the uploaded name to identify the source type, then use the optional \u003Ccode>output\u003C\u002Fcode> field to choose the generated resource name without a PDF extension.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\">input_path = \"\u002Fpath\u002Fto\u002Fsample.eml\"\n\nfrom requests_toolbelt import MultipartEncoder\nwith open(input_path, \"rb\") as input_file:\n    fields = {\n        \"file\": (os.path.basename(input_path), input_file, \"message\u002Frfc822\"),\n        \"output\": \"pdf_from_email\",\n    }\n    form = MultipartEncoder(fields=fields)\n    response = requests.post(api_url + \"\u002Fpdf\", data=form, headers={\n        \"Accept\": \"application\u002Fjson\",\u003C\u002Fpre>\n\n\u003Cp>For the Email to PDF form, \u003Ccode>MultipartEncoder\u003C\u002Fcode> combines the file tuple and text fields, then exposes a \u003Ccode>content_type\u003C\u002Fcode> value that includes the generated boundary. That value must be used as the request header.\u003C\u002Fp>\n\n\u003Ch3>Read the output resource\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\">\"output\": \"pdf_from_email\",\n    }\n    form = MultipartEncoder(fields=fields)\n    response = requests.post(api_url + \"\u002Fpdf\", data=form, headers={\n        \"Accept\": \"application\u002Fjson\",\n        \"Content-Type\": form.content_type,\n        \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    })\n\nprint(\"Response status code: \" + str(response.status_code))\nif response.ok:\n    print(json.dumps(response.json(), indent=2))\u003C\u002Fpre>\n\n\u003Cp>After the Email to PDF call, the sample prints formatted response JSON after a successful request and exits with an error after printing a failed response. Preserve the returned \u003Ccode>outputId\u003C\u002Fcode> when the next workflow step needs the generated resource.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this Python tutorial, you converted an Email file into a PDF resource with a direct multipart request. The pattern gives a message-based workflow a document output that can be reviewed, downloaded, or passed to another pdfRest operation.\u003C\u002Fp>\n\n\u003Cp>Try representative email to pdf inputs in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the authoritative request fields, accepted values, and response contract, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool documentation\u003C\u002Fa>. The same request pattern can then be adapted to your Python application’s error handling, retention policy, and delivery workflow.\u003C\u002Fp>\n\n\u003Cp>The repository also provides a JSON-payload Email-to-PDF version for Python. It uploads the message first and then posts its resource ID to \u003Ccode>\u002Fpdf\u003C\u002Fcode>, which is useful when an application stages inputs for several later operations. \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-from-email.py\">View the JSON-payload sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-02T21:53:50.000+00:00","Convert Email (.eml) files to PDF with Python using a multipart pdfRest API request.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-email-to-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Convert Email to PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-email-to-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-email-to-pdf-with-python\u002F\",\n      \"datePublished\": \"2026-09-03T17:04:36.000Z\",\n      \"dateModified\": \"2026-09-03T17:04:36.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert Email (.eml) files to PDF with Python using a multipart pdfRest API request.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, Email, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Email to PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-email-to-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4317,4318,4319,4320,4321,4322],{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1398,"name":1399,"slug":1400,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-email-to-pdf-with-python\u002F","How to Convert Email to PDF with Python | pdfRest",{"id":4327,"uuid":4328,"title":4329,"slug":4330,"html":4331,"comment_id":4327,"feature_image":48,"featured":284,"visibility":1257,"created_at":4332,"updated_at":4194,"published_at":4332,"custom_excerpt":4333,"codeinjection_head":4334,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4335,"primary_tag":4343,"url":4344,"excerpt":4333,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4345,"meta_description":4333,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"68279d2a533c9f26b943979e","e7d854c0-2b44-4804-a540-3e0265f92256","How to Convert HTML to PDF in .NET with C#","how-to-convert-html-to-pdf-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert HTML to PDF with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> is a powerful solution for developers looking to integrate HTML-to-PDF conversion capabilities into their applications. This tutorial will guide you through the process of sending an API call to convert HTML to PDF using C#. By leveraging the pdfRest API, you can easily convert HTML files into PDFs, enhancing the functionality of your application with minimal effort.\u003C\u002Fp>\n\n\n\u003Cp>Consider a scenario where a company needs to convert a batch of HTML reports into PDF documents for archival purposes. Using the Convert to PDF API, developers can automate this process, ensuring consistency and saving time. This not only streamlines workflows but also ensures that the output is in a universally accepted format, making it easier to share and store.\u003C\u002Fp>\n\n\n\u003Ch2>Convert HTML to PDF with C# Code Example\u003C\u002Fh2>\n\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"text\u002Fhtml\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"A4\"));\n        multipartContent.Add(byteArrayOption, \"page_size\");\n\n        var byteArrayOption2 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"output.pdf\"));\n        multipartContent.Add(byteArrayOption2, \"output\");\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.cs\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\n\u003Cp>The code begins by setting up an \u003Ccode>HttpClient\u003C\u002Fcode> with a base address pointing to the pdfRest API. This client will be used to send HTTP requests.\u003C\u002Fp>\n\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\n\u003Cp>Next, an \u003Ccode>HttpRequestMessage\u003C\u002Fcode> is created for a POST request to the \"pdf\" endpoint. The API key is added to the request headers to authenticate the request. The Accept header specifies that the response should be in JSON format.\u003C\u002Fp>\n\n\n\u003Cpre class=\"language-csharp\">using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf\"))\n{\n    request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n    request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n\u003C\u002Fpre>\n\n\n\u003Cp>A \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> object is created to hold the file and additional parameters. The file to be converted is read into a byte array, which is then added to the multipart content with a specified content type of \"text\u002Fhtml\".\u003C\u002Fp>\n\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"text\u002Fhtml\");\n\u003C\u002Fpre>\n\n\n\u003Cp>Additional options, such as \"page_size\" and \"output\", are added to the multipart content. These parameters control the page size of the PDF and the name of the output file, respectively.\u003C\u002Fp>\n\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"A4\"));\nmultipartContent.Add(byteArrayOption, \"page_size\");\n\nvar byteArrayOption2 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"output.pdf\"));\nmultipartContent.Add(byteArrayOption2, \"output\");\n\u003C\u002Fpre>\n\n\n\u003Cp>The request content is set to the multipart content, and the request is sent asynchronously. The response is read and printed to the console.\u003C\u002Fp>\n\n\n\u003Cpre class=\"language-csharp\">request.Content = multipartContent;\nvar response = await httpClient.SendAsync(request);\n\nvar apiResult = await response.Content.ReadAsStringAsync();\n\nConsole.WriteLine(\"API response received.\");\nConsole.WriteLine(apiResult);\n\u003C\u002Fpre>\n\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\n\u003Cp>In this tutorial, you learned how to use C# to send an API call to the pdfRest Convert to PDF endpoint for converting HTML files to PDF format using a multipart API call. To further explore the capabilities of pdfRest, you can demo all of the API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>.\u003C\u002Fp>\n\n\n\u003Cp>For more detailed information on the API endpoints and parameters, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. This is an example of a multipart API call, and code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.cs\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003C!--kg-card-end: html-->\n","2025-05-16T20:16:42.000+00:00","Learn how to convert HTML to PDF using C# with Convert to PDF API by pdfRest","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert HTML to PDF in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-in-net-with-c\u002F\",\n      \"datePublished\": \"2025-05-16T20:16:42.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:17.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert HTML to PDF using C# with Convert to PDF API by pdfRest\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Conversion, Convert, Convert to PDF, HTML\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert HTML to PDF in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4336,4337,4338,4339,4340,4341,4342],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1402,"name":1403,"slug":1404,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-html-to-pdf-in-net-with-c\u002F","How to Convert HTML to PDF in .NET with C#, Tutorial | pdfRest",{"id":4347,"uuid":4348,"title":4349,"slug":4350,"html":4351,"comment_id":4347,"feature_image":48,"featured":284,"visibility":1257,"created_at":4352,"updated_at":4194,"published_at":4352,"custom_excerpt":4353,"codeinjection_head":4354,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4355,"primary_tag":4363,"url":4364,"excerpt":4353,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4365,"meta_description":4353,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"68279d90533c9f26b94397b2","f4c03c6d-38cf-4b6e-9b08-d5712c0fa4bc","How to Convert HTML to PDF with cURL","how-to-convert-html-to-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert HTML to PDF with cURL?\u003C\u002Fh2>\n\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> is a powerful resource for developers who need to programmatically convert HTML files into PDF documents. This tutorial will guide you through the process of sending an API call to the Convert to PDF endpoint using cURL, a command-line tool for transferring data with URLs. By understanding how to use this tool, you can automate the conversion of HTML to PDF format, integrating seamlessly into your applications or workflows.\u003C\u002Fp>\n\n\n\u003Cp>Imagine you are managing a web application that generates dynamic HTML reports or invoices. To maintain consistency and ensure compatibility across different platforms, you might want to convert all generated HTML files into PDFs. Using the Convert to PDF API, you can automate this process, enhancing the user experience by providing a unified document format that is widely accepted and easily shareable.\u003C\u002Fp>\n\n\n\u003Ch2>Convert HTML to PDF with cURL Code Example\u003C\u002Fh2>\n\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile.html;type=text\u002Fhtml\" \\\n  -F \"output=example_out\"\n\u003C\u002Fpre>\n\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.sh\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\n\u003Cp>The provided cURL command is a POST request to the pdfRest API endpoint for converting HTML documents to PDF. Let's break down each part:\u003C\u002Fp>\n\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf\"\u003C\u002Fpre>\n\n\n\u003Cp>This line specifies that a POST request is being made to the URL \u003Ca href=\"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf\">https:\u002F\u002Fapi.pdfrest.com\u002Fpdf\u003C\u002Fa>, which is the endpoint for the Convert to PDF API.\u003C\u002Fp>\n\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\u003C\u002Fpre>\n\n\n\u003Cp>This header indicates that the client expects the server to respond with JSON-formatted data.\u003C\u002Fp>\n\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\u003C\u002Fpre>\n\n\n\u003Cp>This header specifies that the request body will be sent as multipart form data, which is necessary for file uploads.\u003C\u002Fp>\n\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\u003C\u002Fpre>\n\n\n\u003Cp>The API key is a unique identifier used to authenticate the request. Replace the placeholder with your actual API key.\u003C\u002Fp>\n\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile.html;type=text\u002Fhtml\"\u003C\u002Fpre>\n\n\n\u003Cp>This form field uploads the HTML file you want to convert. Replace \u003Ccode>\u002Fpath\u002Fto\u002Ffile.html\u003C\u002Fcode> with the path to your actual HTML file, and specify the content type as \u003Ccode>text\u002Fhtml\u003C\u002Fcode>.\u003C\u002Fp>\n\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\u003C\u002Fpre>\n\n\n\u003Cp>This form field specifies the output file name or identifier for the converted PDF. In this example, the output is named \u003Ccode>example_out\u003C\u002Fcode>.\u003C\u002Fp>\n\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\n\u003Cp>In this tutorial, you've learned how to use cURL to send a request to the pdfRest Convert to PDF API, enabling you to convert HTML files to PDFs programmatically. To further explore the capabilities of pdfRest, try out all the API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\n\u003Cp>Note: This example demonstrates a multipart API call. For code samples using JSON payloads, visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.sh\">this GitHub page\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003C!--kg-card-end: html-->\n","2025-05-16T20:18:24.000+00:00","Learn how to use cURL to convert HTML to PDF with the pdfRest Convert to PDF API","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Convert HTML to PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-curl\u002F\",\n      \"datePublished\": \"2025-05-16T20:18:24.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:16.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use cURL to convert HTML to PDF with the pdfRest Convert to PDF API\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert, Convert to PDF, HTML, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert HTML to PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4356,4357,4358,4359,4360,4361,4362],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1402,"name":1403,"slug":1404,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-html-to-pdf-with-curl\u002F","How to Convert HTML to PDF with cURL, Tutorial | pdfRest",{"id":4367,"uuid":4368,"title":4369,"slug":4370,"html":4371,"comment_id":4367,"feature_image":48,"featured":284,"visibility":1257,"created_at":4372,"updated_at":4373,"published_at":4372,"custom_excerpt":4374,"codeinjection_head":4375,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4376,"primary_tag":4384,"url":4385,"excerpt":4374,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4386,"meta_description":4374,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"68279dc2533c9f26b94397bc","28c09bbf-1488-4697-a527-6a722d115f3f","How to Convert HTML to PDF with Java","how-to-convert-html-to-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert HTML to PDF with Java?\u003C\u002Fh2>\n\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> provides a seamless way to convert HTML files into PDF documents using Java. This tutorial will guide you through the process of sending an API call to convert HTML to PDF using Java. By leveraging this API, developers can integrate HTML-to-PDF conversion capabilities into their Java applications, enhancing functionality and improving user experience.\u003C\u002Fp>\n\n\n\u003Cp>For example, a business might need to convert dynamically generated HTML reports or web pages into PDFs for standardized document handling and storage. Using this API, you can automate the conversion of HTML files to PDF, ensuring all documents are in a consistent format for archiving, sharing, or distribution to clients and partners.\u003C\u002Fp>\n\n\n\u003Ch2>Convert HTML to PDF with Java Code Example\u003C\u002Fh2>\n\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class PDF {\n\n  \u002F\u002F Specify the path to your HTML file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.html\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"text\u002Fhtml\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_pdf\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\n\u003C\u002Fpre>\n\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPDF.java\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\n\u003Cp>This code sets up the file path and API key, loads environment variables, and constructs a multipart form request. The HTML file is read and added to the request with the content type set to \u003Ccode>text\u002Fhtml\u003C\u002Fcode>. The API key is included in the header, and the request is sent to the pdfRest Convert to PDF endpoint. The response is then printed to the console in a readable format.\u003C\u002Fp>\n\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\n\u003Cp>In this tutorial, we demonstrated how to use Java to make an API call to pdfRest's Convert to PDF tool for converting HTML files into PDFs programmatically. This is particularly useful for automating document conversion tasks within your applications.\u003C\u002Fp>\n\n\n\u003Cp>To explore more features and tools offered by pdfRest, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed documentation, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPDF.java\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003C!--kg-card-end: html-->\n","2025-05-16T20:19:14.000+00:00","2026-09-02T18:27:12.000+00:00","Learn how to convert HTML to PDF with Java using Convert to PDF API by pdfRest","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Convert HTML to PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-java\u002F\",\n      \"datePublished\": \"2025-05-16T20:19:14.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:16.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert HTML to PDF with Java using Convert to PDF API by pdfRest\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert, Convert to PDF, HTML, Java\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert HTML to PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4377,4378,4379,4380,4381,4382,4383],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1402,"name":1403,"slug":1404,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-html-to-pdf-with-java\u002F","How to Convert HTML to PDF with Java, Tutorial | pdfRest",{"id":4388,"uuid":4389,"title":4390,"slug":4391,"html":4392,"comment_id":4388,"feature_image":48,"featured":284,"visibility":1257,"created_at":4393,"updated_at":4373,"published_at":4393,"custom_excerpt":4394,"codeinjection_head":4395,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4396,"primary_tag":4404,"url":4405,"excerpt":4394,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4406,"meta_description":4394,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"68279d67533c9f26b94397a8","a417475b-1e90-4a55-9643-7057d3092806","How to Convert HTML to PDF with JavaScript in NodeJS","how-to-convert-html-to-pdf-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert HTML to PDF with JavaScript?\u003C\u002Fh2>\n\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> is a powerful resource that allows developers to convert HTML files into PDFs using a simple API call. This tutorial will guide you through the process of sending an API call to convert HTML to PDF using JavaScript. By leveraging the capabilities of pdfRest, you can seamlessly integrate HTML-to-PDF conversion into your applications, enhancing their functionality and user experience.\u003C\u002Fp>\n\n\n\u003Cp>For example, a business might need to convert dynamically generated HTML reports or web pages into PDFs for standardized sharing, archiving, or printing. Using the Convert to PDF API, this process can be automated, saving time and reducing the potential for human error. This is especially useful for companies that handle large volumes of HTML content and need to ensure consistency and reliability in their document management processes.\u003C\u002Fp>\n\n\n\u003Ch2>Convert HTML to PDF with JavaScript Code Example\u003C\u002Fh2>\n\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the HTML file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile.html'));\ndata.append('output', 'pdfrest_pdf');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.js\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\n\u003Cp>The code begins by importing necessary modules: \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests, \u003Ccode>form-data\u003C\u002Fcode> for handling form data, and \u003Ccode>fs\u003C\u002Fcode> for file system operations.\u003C\u002Fp>\n\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile.html'));\ndata.append('output', 'pdfrest_pdf');\n\u003C\u002Fpre>\n\n\n\u003Cp>Here, a new \u003Ccode>FormData\u003C\u002Fcode> instance is created to hold the HTML file and parameters. The \u003Ccode>file\u003C\u002Fcode> parameter uses \u003Ccode>fs.createReadStream\u003C\u002Fcode> to read the HTML file from the specified path. The \u003Ccode>output\u003C\u002Fcode> specifies the desired output format.\u003C\u002Fp>\n\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\n\u003C\u002Fpre>\n\n\n\u003Cp>This snippet defines the configuration for the \u003Ccode>axios\u003C\u002Fcode> request. The \u003Ccode>method\u003C\u002Fcode> is set to 'post', and \u003Ccode>maxBodyLength\u003C\u002Fcode> is set to Infinity to accommodate large files. The \u003Ccode>url\u003C\u002Fcode> specifies the API endpoint. The \u003Ccode>headers\u003C\u002Fcode> include the API key (which should be replaced with a valid key) and headers from the \u003Ccode>FormData\u003C\u002Fcode> instance. The \u003Ccode>data\u003C\u002Fcode> field contains the form data to be sent.\u003C\u002Fp>\n\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\n\u003Cp>In this tutorial, you learned how to use JavaScript to call the pdfRest Convert to PDF API, enabling the conversion of HTML files to PDF format. This process can be a valuable asset for automating document workflows and ensuring consistency across digital documents.\u003C\u002Fp>\n\n\n\u003Cp>To explore more, try out all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.js\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003C!--kg-card-end: html-->\n","2025-05-16T20:17:43.000+00:00","Learn how to convert HTML to PDF with the pdfRest Convert to PDF API using JavaScript","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert HTML to PDF with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2025-05-16T20:17:43.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:17.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert HTML to PDF with the pdfRest Convert to PDF API using JavaScript\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert, Convert to PDF, HTML, JavaScript\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert HTML to PDF with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4397,4398,4399,4400,4401,4402,4403],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1402,"name":1403,"slug":1404,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-html-to-pdf-with-javascript-in-nodejs\u002F","How to Convert HTML to PDF with JavaScript in NodeJS, Tutorial | pdfRest",{"id":4408,"uuid":4409,"title":4410,"slug":4411,"html":4412,"comment_id":4408,"feature_image":48,"featured":284,"visibility":1257,"created_at":4413,"updated_at":4414,"published_at":4413,"custom_excerpt":4415,"codeinjection_head":4416,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4417,"primary_tag":4425,"url":4426,"excerpt":4415,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4427,"meta_description":4415,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"68279c39533c9f26b9439794","d8b8cc23-c061-4817-b16c-c5db2bbe77ca","How to Convert HTML to PDF with PHP","how-to-convert-html-to-pdf-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert HTML to PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> offers a powerful and efficient solution for converting HTML files into high-quality PDFs using PHP. This tutorial will walk you through the process of sending an API call to convert HTML content to PDF with PHP. By leveraging the pdfRest API, developers can easily integrate HTML-to-PDF conversion into their applications, streamlining workflows and enhancing the user experience.\u003C\u002Fp>\n\n\u003Cp>For example, if your business generates dynamic reports, invoices, or web pages in HTML and needs to provide them as downloadable PDFs, the Convert to PDF API tool makes this process straightforward. Developers can automate the conversion of HTML files to PDF directly from their PHP applications, saving time and ensuring consistent, professional results for document distribution and archiving.\u003C\u002Fp>\n\n\u003Ch2>Convert to PDF with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">\nrequire 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\n$headers = [\n  'Api-Key' =--> 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile', \u002F\u002F Set the filename for the file to be processed, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"text\u002Fhtml\">' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'compression', \u002F\u002F Specify the field name for the compression option.\n      'contents' => 'lossless' \u002F\u002F Set the value for the compression option (in this case, 'lossless').\n    ],\n    [\n      'name' => 'downsample', \u002F\u002F Specify the field name for the downsample option.\n      'contents' => '300' \u002F\u002F Set the value for the downsample option (in this case, '300').\n    ],\n    [\n      'name' => 'tagged_pdf', \u002F\u002F Specify the field name for the tagged PDF option.\n      'contents' => 'off' \u002F\u002F Set the value for the tagged PDF option (in this case, 'off').\n    ],\n    [\n      'name' => 'output', \u002F\u002F Specify the field name for the output option.\n      'contents' => 'pdfrest_pdf' \u002F\u002F Set the value for the output option (in this case, 'pdfrest_pdf').\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the processed PDF content.\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.php\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided code uses the Guzzle HTTP client to make an API call to the pdfRest Convert to PDF endpoint. Let's break down the code to understand its functionality:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">require 'vendor\u002Fautoload.php';\n\u003C\u002Fpre>\n\n\u003Cp>This line includes the Composer autoload file, which loads the necessary classes for the Guzzle HTTP client.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">use GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\u003C\u002Fpre>\n\n\u003Cp>These lines import the required namespaces for the Guzzle HTTP client, the PSR-7 Request class, and the Utils class for handling streams.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$client = new Client();\n\u003C\u002Fpre>\n\n\u003Cp>This line creates a new instance of the Guzzle HTTP client, which will be used to send the API request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The headers array contains the API key required for authentication. Replace 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"text\u002Fhtml\">'\n      ]\n    ],\n    [\n      'name' => 'compression',\n      'contents' => 'lossless'\n    ],\n    [\n      'name' => 'downsample',\n      'contents' => '300'\n    ],\n    [\n      'name' => 'tagged_pdf',\n      'contents' => 'off'\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_pdf'\n    ]\n  ]\n];\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>The options array defines the multipart form data for the request. It includes the file to be converted, compression settings, downsampling options, and output preferences. Each 'name' field corresponds to a parameter recognized by the API, and 'contents' specifies the value for that parameter.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', $headers);\n\u003C\u002Fpre>\n\n\u003Cp>This line creates a new HTTP POST request to the pdfRest API endpoint, including the specified headers for authentication.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$res = $client->sendAsync($request, $options)->wait();\n\u003C\u002Fpre>\n\n\u003Cp>The asynchronous request is sent to the API, and the script waits for the response. This allows the application to perform other tasks while waiting for the API to process the request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">echo $res->getBody();\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the response body, which contains the converted PDF content, is outputted to the screen.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use PHP to convert HTML to PDF with the pdfRest Convert to PDF API tool, allowing you to convert files to PDF format programmatically. This powerful tool can be integrated into various applications to automate and streamline document conversion processes.\u003C\u002Fp>\n\n\u003Cp>To explore more functionalities and experiment with different API tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on all available API options, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. This example demonstrates a multipart API call; for examples using JSON payloads, visit the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.php\">GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-05-16T20:12:41.000+00:00","2026-09-02T18:27:13.000+00:00","Learn how to use PHP to convert HTML to PDF with Convert to PDF API by pdfRest","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-php\u002F#article\",\n      \"headline\": \"How to Convert HTML to PDF with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-php\u002F\",\n      \"datePublished\": \"2025-05-16T20:12:41.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:17.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use PHP to convert HTML to PDF with Convert to PDF API by pdfRest\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert, Convert to PDF, HTML, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert HTML to PDF with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4418,4419,4420,4421,4422,4423,4424],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1402,"name":1403,"slug":1404,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-html-to-pdf-with-php\u002F","How to Convert HTML to PDF with PHP, Tutorial | pdfRest",{"id":4429,"uuid":4430,"title":4431,"slug":4432,"html":4433,"comment_id":4434,"feature_image":48,"featured":284,"visibility":1257,"created_at":4435,"updated_at":4414,"published_at":4435,"custom_excerpt":4436,"codeinjection_head":4437,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4438,"primary_tag":4446,"url":4447,"excerpt":4436,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4448,"meta_description":4436,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1374","6af37804-0cf8-4047-9d23-2578d089fd0d","How to Convert HTML to PDF with Python","how-to-convert-html-to-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert HTML to PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> is a powerful resource for developers who need to convert various file types to PDF. This tool simplifies the process of conversion by handling different file formats and providing a consistent output. Using Python to send an API call to Convert to PDF is practical for automating document workflows, integrating PDF generation into web services, or simply converting documents in batch processes.\u003C\u002Fp>\n    \n\u003Cp>For instance, a user might want to convert scanned TIFF images to PDFs for easier sharing and archiving, or to ensure compatibility with document viewers.\u003C\u002Fp>\n\n\u003Ch2>Convert HTML to PDF with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\npdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf'\n\n# The \u002Fpdf endpoint can take a single file, id, or url as input.\n# This sample passes an HTML file to the endpoint, but there's a variety of input file types that are accepted by this endpoint.\n# The 'text\u002Fhtml' string below is known as a MIME type, which is a label used to identify the type of a file so that it is handled properly by software.\n# Please see https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FWeb\u002FHTTP\u002FBasics_of_HTTP\u002FMIME_types\u002FCommon_types for more information about MIME types.\nmp_encoder_pdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.html', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'text\u002Fhtml'),\n        'output' : 'example_pdf_out',\n    }\n)\n\n# Let's set the headers that the pdf endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to pdf endpoint...\")\nresponse = requests.post(pdf_endpoint_url, data=mp_encoder_pdf, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>This code is sourced from the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.py\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Python Code\u003C\u002Fh2>\n\n\u003Cp>Let's break down the provided Python code snippet:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\u003C\u002Fpre>\n\n\u003Cp>This imports the necessary libraries. \u003Ccode>MultipartEncoder\u003C\u002Fcode> is used for encoding files as multipart\u002Fform-data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf'\n\u003C\u002Fpre>\n\n\u003Cp>This sets the API endpoint URL for the pdfRest Convert to PDF service.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_pdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.html', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'text\u002Fhtml'),\n        'output' : 'example_pdf_out',\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>Here, a \u003Ccode>MultipartEncoder\u003C\u002Fcode> object is created with the file to be converted and the desired output file name. The MIME type 'text\u002Fhtml' is specified for the input file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\n\u003C\u002Fpre>\n\n\u003Cp>The headers for the request are set, including the API key for authentication.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(pdf_endpoint_url, data=mp_encoder_pdf, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>A POST request is made to the pdfRest API with the encoded file and headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>After receiving the response, the code checks if the request was successful. If so, it prints the JSON response; otherwise, it prints the error text.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've learned how to use Python to send an .html file to the pdfRest Convert to PDF API and receive a JSON response. By following these steps, you can integrate HTML to PDF conversion into your applications or automate document processing tasks. To further explore the capabilities of pdfRest API Tools, you can demo them in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>\u003Cem>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found in our \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.py\">GitHub repository\u003C\u002Fa>.\u003C\u002Fem>\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","65a166572d4014c9499b3d71","2024-01-12T16:18:31.000+00:00","Learn how to use Python to convert HTML to PDF by calling Convert to PDF API Tool by pdfRest","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Convert HTML to PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-python\u002F\",\n      \"datePublished\": \"2024-01-12T16:18:31.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:55.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use Python to convert HTML to PDF by calling Convert to PDF API Tool by pdfRest\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert, Convert to PDF, HTML, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert HTML to PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-html-to-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4439,4440,4441,4442,4443,4444,4445],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1402,"name":1403,"slug":1404,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-html-to-pdf-with-python\u002F","How to Convert HTML to PDF with Python, Tutorial | pdfRest",{"id":4450,"uuid":4451,"title":4452,"slug":4453,"html":4454,"comment_id":4450,"feature_image":48,"featured":284,"visibility":1257,"created_at":4455,"updated_at":4414,"published_at":4455,"custom_excerpt":4456,"codeinjection_head":4457,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4458,"primary_tag":4465,"url":4466,"excerpt":4456,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4467,"meta_description":4456,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65c4fd10533c9f26b94360ce","76adf101-bfa9-4a26-b654-a4dcd8123340","How to Convert JPG to PDF in .NET with C#","how-to-convert-jpg-to-pdf-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert JPG to PDF with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> is a powerful resource that allows developers to convert various file formats into PDF documents. This tutorial will guide you through making an API call to Convert to PDF using C#. \u003C\u002Fp>\n  \n\u003Cp>You might need to convert JPG images depicting invoices, reports, or user manuals into a standardized PDF format for easy sharing, archiving, or printing.\u003C\u002Fp>\n\n\u003Ch2>Convert JPG to PDF with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.jpg\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file.jpg\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"image\u002Fjpeg\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"A4\"));\n        multipartContent.Add(byteArrayOption, \"page_size\");\n\n        var byteArrayOption2 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"output.pdf\"));\n        multipartContent.Add(byteArrayOption2, \"output\");\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.cs\">pdfRest API C# Sample Code\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code above demonstrates how to make a multipart\u002Fform-data request to the pdfRest API to convert a file to PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>This line initializes an \u003Ccode>HttpClient\u003C\u002Fcode> instance with the base address set to the pdfRest API endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf\"))\n\u003C\u002Fpre>\n\n\u003Cp>Here, a new \u003Ccode>HttpRequestMessage\u003C\u002Fcode> is created for a POST request to the \"pdf\" endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>The API key is added to the request headers. This key is essential for authentication and should be replaced with your actual pdfRest API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n\u003C\u002Fpre>\n\n\u003Cp>A new \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> object is created to hold the parts of the multipart request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.jpg\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file.jpg\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"image\u002Fjpeg\");\n\u003C\u002Fpre>\n\n\u003Cp>The file to be converted is read into a byte array, wrapped in a \u003Ccode>ByteArrayContent\u003C\u002Fcode>, and added to the multipart content. The \"Content-Type\" header is set to the MIME type of the file being sent.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"A4\"));\nmultipartContent.Add(byteArrayOption, \"page_size\");\n\u003C\u002Fpre>\n\n\u003Cp>This snippet sets the page size option for the PDF conversion.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption2 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"output.pdf\"));\nmultipartContent.Add(byteArrayOption2, \"output\");\n\u003C\u002Fpre>\n\n\u003Cp>The desired output file name is specified here.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\n\u003C\u002Fpre>\n\n\u003Cp>The request is sent asynchronously, and the response is awaited.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the response content is read as a string, which contains the API result.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've covered how to make a multipart API call to the pdfRest Convert to PDF endpoint using C#. This allows you to convert files to PDF programmatically within your C# applications. To explore all the capabilities of the pdfRest API Tools, you can demo them in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further details on the API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.cs\">pdfRest API JSON Payload Samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-08T16:10:56.000+00:00","Learn how to use .NET to Convert JPG to PDF by calling Convert to PDF API Tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert JPG to PDF in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-02-08T16:10:56.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:53.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use .NET to Convert JPG to PDF by calling Convert to PDF API Tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Conversion, Convert to PDF, JPG\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert JPG to PDF in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4459,4460,4461,4462,4463,4464],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1542,"name":1543,"slug":1544,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-jpg-to-pdf-in-net-with-c\u002F","How to Convert JPG to PDF in .NET with C#, Tutorial | pdfRest",{"id":4469,"uuid":4470,"title":4471,"slug":4472,"html":4473,"comment_id":4469,"feature_image":48,"featured":284,"visibility":1257,"created_at":4474,"updated_at":4475,"published_at":4474,"custom_excerpt":4476,"codeinjection_head":4477,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4478,"primary_tag":4485,"url":4486,"excerpt":4476,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4487,"meta_description":4476,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"662bf0b9533c9f26b94374f2","884d6217-f198-4cdc-9dc3-5db2cdda56bb","How to Convert JPG to PDF with cURL","how-to-convert-jpg-to-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert JPG to PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>\nThe pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> offers a straightforward and powerful way to convert various document formats, such as JPG image, into PDFs. By utilizing this API, developers can easily integrate PDF conversion capabilities into their applications, workflows, or services. This tutorial will guide you through the process of sending an API call to Convert to PDF using cURL, which is a versatile command-line tool used for making all sorts of HTTP requests.\n\u003C\u002Fp>\n\n\u003Cp>\nImagine you are working on an application that handles document management and you need to ensure that all documents are stored in a uniform format for consistency and ease of access. By using the Convert to PDF API, you can automatically convert incoming documents, such as JPGs, into PDFs. This is particularly useful in scenarios where documents need to be archived, shared across different platforms, or prepared for printing.\n\u003C\u002Fp>\n\n\u003Ch2>Convert JPG to PDF with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile.jpg\" \\\n  -F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>Reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.sh\">pdfRest cURL code example\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>\nThe code snippet provided is a cURL command that makes a POST request to the pdfRest Convert to PDF API endpoint. Here's what each part of the command does:\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-X POST\n\u003C\u002Fpre>\n\n\u003Cp>This specifies the HTTP method for the request, which is POST in this case, indicating that you are creating or updating a resource.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">\"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf\"\n\u003C\u002Fpre>\n\n\u003Cp>This is the URL of the API endpoint that handles the conversion to PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\n\u003C\u002Fpre>\n\n\u003Cp>This header tells the server that the client expects a response in JSON format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\n\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the request body will be sent as multipart\u002Fform-data, which is necessary for uploading files.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>This header includes your API key, which is required for authentication with the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile.jpg\"\n\u003C\u002Fpre>\n\n\u003Cp>The -F flag is used to specify each field that will be sent as part of the multipart request. In this case, it's the JPG that you want to convert, with the path to that file on your system.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>This field specifies the name of the output file after conversion.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>\nIn this tutorial, we've covered how to use cURL to call the pdfRest Convert to PDF API to convert a JPG to PDF format. By following the steps above, you can integrate PDF conversion into your applications or automate document processing tasks. To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information on the API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\n\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.sh\">pdfRest JSON payload examples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-04-26T18:21:45.000+00:00","2026-09-02T18:27:14.000+00:00","Learn how to use pdfRest Convert to PDF API Tool to convert JPG image files to PDF with cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Convert JPG to PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-curl\u002F\",\n      \"datePublished\": \"2024-04-26T18:21:45.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:32.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Convert to PDF API Tool to convert JPG image files to PDF with cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, JPG, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert JPG to PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4479,4480,4481,4482,4483,4484],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1542,"name":1543,"slug":1544,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-jpg-to-pdf-with-curl\u002F","How to Convert JPG to PDF with cURL, Tutorial | pdfRest",{"id":4489,"uuid":4490,"title":4491,"slug":4492,"html":4493,"comment_id":4489,"feature_image":48,"featured":284,"visibility":1257,"created_at":4011,"updated_at":4475,"published_at":3788,"custom_excerpt":4494,"codeinjection_head":4495,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4496,"primary_tag":4503,"url":4504,"excerpt":4494,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4505,"meta_description":4494,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c56533c9f26b943b49d","7f80dde0-0914-4066-b4fb-5aa19fd6547e","How to Convert JPG to PDF with Java","how-to-convert-jpg-to-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>In the following tutorial, you'll use Java and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool\u003C\u002Fa> to convert JPG to PDF. The Java request uploads the JPEG to \u003Ccode>\u002Fpdf\u003C\u002Fcode> and exposes the generated PDF resource information returned by the service. The example is designed to clarify both the API-specific fields and the surrounding HTTP request used to convert JPG to PDF.\u003C\u002Fp>\n\n\u003Ch2>Why Convert JPG to PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>Field-service applications often collect photographs that later need to join a case packet or customer report. Converting the JPEG first allows it to participate in PDF merging, security, and document-management workflows.\u003C\u002Fp>\n\n\u003Cp>The adapted request sends a \u003Ccode>.jpg\u003C\u002Fcode> file with the \u003Ccode>image\u002Fjpeg\u003C\u002Fcode> media type to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. The API returns a PDF resource ID and download information rather than image bytes embedded in the JSON response.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class ConvertJPGToPDF {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.jpg\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"image\u002Fjpeg\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_jpg_to_pdf\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPDF.java\">Java sample on GitHub\u003C\u002Fa>. The linked source provides the common request pattern; the code shown here applies it to Convert JPG to PDF.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>This client assigns a clear role to each library: HTTP communication, credential lookup, or JSON handling.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.jpg\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>The sample configuration keeps a visible default path, accepts an override from the command line, and reads the API key through dotenv.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"image\u002Fjpeg\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_jpg_to_pdf\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The adapted request sends a \u003Ccode>.jpg\u003C\u002Fcode> file with the \u003Ccode>image\u002Fjpeg\u003C\u002Fcode> media type to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. The API returns a PDF resource ID and download information rather than image bytes embedded in the JSON response. This request body leaves boundary construction to OkHttp so the header remains synchronized with the serialized content.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The HTTP request posts the multipart content to pdfRest and keeps deployment-region changes independent of the rest of the Java code.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>The example output logic prints the HTTP status and JSON body so generated resource IDs or API error details are visible.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>We have now covered the request and response flow for using Java to convert JPG to PDF. With that foundation, you can use the resulting PDF for photo evidence, receipts, inspection images, or scanned correspondence.\u003C\u002Fp>\n\n\u003Cp>Before relying on the result in an automated workflow, review the generated page dimensions and orientation when photographs come from different cameras or scanning applications. If multiple images form one report, keep each conversion resource ID and merge the PDFs afterward instead of assuming one conversion call accepts an image collection.\u003C\u002Fp>\n\n\u003Cp>Continue testing representative documents with the Convert JPG to PDF operation in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. The \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool documentation\u003C\u002Fa> provides authoritative defaults, accepted fields, and limitations for the Convert JPG to PDF operation.\u003C\u002Fp>\n\n\u003Cp>Note: The Convert JPG to PDF example above uses multipart form data; when the input is already stored in pdfRest, use the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPDF.java\">JSON payload example\u003C\u002Fa> as a guide.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Turn a JPEG photograph or scanned page into a PDF resource with Java.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Convert JPG to PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:32.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:32.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Turn a JPEG photograph or scanned page into a PDF resource with Java.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, JPG, Java\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert JPG to PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4497,4498,4499,4500,4501,4502],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1542,"name":1543,"slug":1544,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-jpg-to-pdf-with-java\u002F","Convert JPG to PDF with Java | pdfRest",{"id":4507,"uuid":4508,"title":4509,"slug":4510,"html":4511,"comment_id":4507,"feature_image":48,"featured":284,"visibility":1257,"created_at":4512,"updated_at":4513,"published_at":4512,"custom_excerpt":4514,"codeinjection_head":4515,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4516,"primary_tag":4523,"url":4524,"excerpt":4514,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4525,"meta_description":4514,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"662bf194533c9f26b94374fc","5030febc-62ee-46ba-a78e-5cfea7af4c80","How to Convert JPG to PDF with JavaScript in NodeJS","how-to-convert-jpg-to-pdf-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert JPG to PDF with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> is a powerful resource for developers who need to programmatically convert documents into PDF format. This tool can take various file types and convert them to a standardized PDF, which is essential for consistent document presentation, archiving, and sharing. This tutorial will demonstrate how to send an API call to Convert JPG to PDF using JavaScript, leveraging the capabilities of pdfRest to streamline document processing workflows.\u003C\u002Fp>\n\n\u003Cp>A user might need to convert batches of JPGs, such as scans of invoices, reports, or contracts, into PDFs for electronic distribution. For instance, a web application could allow users to upload documents in different formats and automatically convert them to PDFs before sending them to clients or storing them in a digital archive. This ensures that the documents are easily accessible and viewable across different platforms and devices.\u003C\u002Fp>\n\n\u003Ch2>Convert JPG to PDF with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile.jpg'));\ndata.append('output', 'pdfrest_pdf');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>This code is sourced from the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.js\">pdfRest API samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided JavaScript code uses the Axios library to make an HTTP POST request to the pdfRest Convert to PDF API endpoint. The FormData object is utilized to construct the multipart\u002Fform-data payload required for file uploads.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile.jpg'));\n\u003C\u002Fpre>\n\n\u003Cp>This snippet creates a new FormData instance and appends a JPG file to it. The 'file' field should contain the path to the document you wish to convert.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">\ndata.append('output', 'pdfrest_pdf');\n\u003C\u002Fpre>\n\n\u003Cp>The 'output' parameter defines the prefix of the output file name, without extension.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\n\u003C\u002Fpre>\n\n\u003Cp>The 'config' object contains the request configuration, including the method, URL, headers, and data. The 'Api-Key' header must be replaced with your actual API key from pdfRest.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you have learned how to make a multipart API call to convert JPG images to PDF using JavaScript and the pdfRest API. This capability can be integrated into various applications, enabling automated document conversions within your workflows.\u003C\u002Fp>\n\n\u003Cp>To explore more possibilities and try out all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For comprehensive documentation and additional details on the API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note that this is an example of a multipart API call. For code samples using JSON payloads, you can find them at the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.js\">pdfRest API samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-04-26T18:25:24.000+00:00","2026-09-02T18:27:15.000+00:00","Learn how to convert JPG images to PDF with pdfRest Convert to PDF API Tool using JavaScript","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert JPG to PDF with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-04-26T18:25:24.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:31.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert JPG images to PDF with pdfRest Convert to PDF API Tool using JavaScript\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, JPG, JavaScript\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert JPG to PDF with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4517,4518,4519,4520,4521,4522],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1542,"name":1543,"slug":1544,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-jpg-to-pdf-with-javascript-in-nodejs\u002F","How to Convert JPG to PDF with JavaScript in NodeJS, Tutorial | pdfRest",{"id":4527,"uuid":4528,"title":4529,"slug":4530,"html":4531,"comment_id":4527,"feature_image":48,"featured":284,"visibility":1257,"created_at":4532,"updated_at":4513,"published_at":4532,"custom_excerpt":4533,"codeinjection_head":4534,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4535,"primary_tag":4542,"url":4543,"excerpt":4533,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4544,"meta_description":4533,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"662bf1e9533c9f26b9437506","03cb5242-91cf-4653-b81f-90dc9072eca9","How to Convert JPG to PDF with PHP","how-to-convert-jpg-to-pdf-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert JPG to PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> offers a convenient way to programmatically convert various file types to PDF using a RESTful API. This tutorial will show you how to send an API call to Convert to PDF with PHP, which can be particularly useful when you need to integrate PDF conversion into your web applications or automate document workflows.\u003C\u002Fp>\n\n\u003Cp>You might need to convert documents such as invoices, reports, or forms to PDF format to ensure consistency in presentation, maintain document integrity, and ensure compatibility across different platforms and devices. For example, a web application that allows users to upload documents and receive them as PDFs can benefit from this API by providing a seamless user experience and ensuring that the documents are easy to view and share.\u003C\u002Fp>\n\n\u003Ch2>Convert JPG to PDF with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">\nrequire 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' =--> 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_pdf'\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source of the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.php\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided PHP script uses the Guzzle HTTP client to make a multipart\u002Fform-data POST request to the pdfRest API. Here's a breakdown of the key components:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\u003C\u002Fpre>\n\n\u003Cp>This section includes the necessary Guzzle library and imports the classes needed to create the HTTP client, the request, and handle file streams.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The headers array includes the API key for authentication with the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$options = [\n  'multipart' => [\n    \u002F\u002F ...multipart form data...\n  ]\n];\n\u003C\u002Fpre>\n\n\u003Cp>The options array contains the multipart form data to be sent with the request. Each entry in the 'multipart' array represents a different part of the form data:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Cstrong>file:\u003C\u002Fstrong> This is the file to be converted. The 'contents' key should be a stream of the file, and the 'filename' key should be the path to the file.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>output:\u003C\u002Fstrong> This option specifies the desired output filename prefix.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-php\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', $headers);\n$res = $client->sendAsync($request, $options)->wait();\necho $res->getBody();\n\u003C\u002Fpre>\n\n\u003Cp>A new Request object is created with the POST method, the API endpoint, and the headers. The request is sent asynchronously, and the script waits for the response. The response body, which should contain the processed PDF content, is then outputted.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial demonstrated how to make an API call to the pdfRest Convert to PDF API using PHP. The code sends a JPG file to the pdfRest API, which converts it to PDF. The resulting PDF is then returned in the response.\u003C\u002Fp>\n\n\u003Cp>For further exploration, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for more detailed information on the available options and tools.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.php\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-04-26T18:26:49.000+00:00","Learn how to use pdfRest Convert to PDF API Tool with PHP to convert JPG images to PDF documents","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-php\u002F#article\",\n      \"headline\": \"How to Convert JPG to PDF with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-php\u002F\",\n      \"datePublished\": \"2024-04-26T18:26:49.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:31.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Convert to PDF API Tool with PHP to convert JPG images to PDF documents\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, JPG, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert JPG to PDF with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4536,4537,4538,4539,4540,4541],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1542,"name":1543,"slug":1544,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-jpg-to-pdf-with-php\u002F","How to Convert JPG to PDF with PHP, Tutorial | pdfRest",{"id":4546,"uuid":4547,"title":4548,"slug":4549,"html":4550,"comment_id":4546,"feature_image":48,"featured":284,"visibility":1257,"created_at":4551,"updated_at":4552,"published_at":4551,"custom_excerpt":4553,"codeinjection_head":4554,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4555,"primary_tag":4562,"url":4563,"excerpt":4553,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4564,"meta_description":4553,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"662bf264533c9f26b9437510","f3b2edb9-da1e-4cb1-9b78-d3e9b6904fb2","How to Convert JPG to PDF with Python","how-to-convert-jpg-to-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Convert to PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to integrate PDF conversion functionality into their applications. By using this API, you can programmatically convert various file types to PDF, ensuring consistency and quality in document handling. This tutorial will guide you through the process of sending an API call to the \u003Ccode>\u002Fpdf\u003C\u002Fcode> endpoint using Python, a popular programming language known for its simplicity and readability.\u003C\u002Fp>\n\n\u003Cp>There are countless scenarios where converting files to PDF can be beneficial. For instance, a business may need to convert scanned documents, such as invoices or contracts, into PDF format to ensure that they are easily accessible, shareable, and compliant with archival standards. By automating this process with the Convert to PDF API, businesses can save time, reduce errors, and maintain a consistent workflow.\u003C\u002Fp>\n\n\u003Ch2>Convert JPG to PDF with Python Code Example\u003C\u002Fh2>\n\n\u003Cp>The following code is a complete example of how to call the pdfRest Convert to PDF API using Python. This code is sourced from the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.py\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\npdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf'\n\nmp_encoder_pdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.jpg', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'image\u002Fjpeg'),\n        'output' : 'example_pdf_out',\n    }\n)\n\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\n\nprint(\"Sending POST request to pdf endpoint...\")\nresponse = requests.post(pdf_endpoint_url, data=mp_encoder_pdf, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code snippet above demonstrates how to use Python to make a multipart API call to the pdfRest Convert to PDF endpoint. Let's break down the key components:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\u003C\u002Fpre>\n\n\u003Cp>This imports the necessary libraries. \u003Ccode>MultipartEncoder\u003C\u002Fcode> from \u003Ccode>requests_toolbelt\u003C\u002Fcode> is used to encode the files and fields for the multipart request, while \u003Ccode>requests\u003C\u002Fcode> handles the HTTP request, and \u003Ccode>json\u003C\u002Fcode> processes the JSON response.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf'\n\u003C\u002Fpre>\n\n\u003Cp>This sets the API endpoint URL that the request will be sent to.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_pdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.jpg', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'image\u002Fjpeg'),\n        'output' : 'example_pdf_out',\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>This section creates a \u003Ccode>MultipartEncoder\u003C\u002Fcode> object with the fields needed for the request. The 'file' field contains a tuple with the filename, file object, and MIME type. The 'output' field specifies the desired name for the output PDF file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\n\u003C\u002Fpre>\n\n\u003Cp>Here, we set the HTTP headers for the request. The 'Content-Type' is automatically set to 'multipart\u002Fform-data' by the \u003Ccode>MultipartEncoder\u003C\u002Fcode>, and 'Api-Key' should be replaced with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(pdf_endpoint_url, data=mp_encoder_pdf, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This sends a POST request to the specified endpoint with the encoded data and headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the code checks if the response is successful and prints the JSON response. If not, it prints the error text.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial has demonstrated how to call the pdfRest Convert to PDF API using Python to convert a JPG file to PDF. By understanding the structure of the API call and the necessary parameters, you can adapt this example to convert other file types supported by the API.\u003C\u002Fp>\n\n\u003Cp>To further explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For a comprehensive guide to the API, including additional endpoints and parameters, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example uses a multipart API call. For code samples using JSON payloads, visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.py\">this GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-04-26T18:28:52.000+00:00","2026-09-02T18:27:16.000+00:00","Learn how to use pdfRest Convert to PDF API Tool with Python to convert JPG to PDF","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Convert JPG to PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-python\u002F\",\n      \"datePublished\": \"2024-04-26T18:28:52.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:31.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Convert to PDF API Tool with Python to convert JPG to PDF\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, JPG, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert JPG to PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-jpg-to-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4556,4557,4558,4559,4560,4561],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1542,"name":1543,"slug":1544,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-jpg-to-pdf-with-python\u002F","How to Convert JPG to PDF with Python, Tutorial | pdfRest",{"id":4566,"uuid":4567,"title":4568,"slug":4569,"html":4570,"comment_id":4566,"feature_image":48,"featured":284,"visibility":1257,"created_at":4571,"updated_at":4552,"published_at":4572,"custom_excerpt":4573,"codeinjection_head":4574,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4575,"primary_tag":4584,"url":4585,"excerpt":4573,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4586,"meta_description":4573,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a965690533c9f26b943ae4b","67a6c4f3-b124-4ca7-9ff1-8e627c2d537b","How to Convert JSON to PDF in .NET with C#","how-to-convert-json-to-pdf-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This .NET tutorial shows how C# can turn JSON into a tagged PDF with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. The sample combines a JSON upload with metadata, layout, and style options, then reads the generated PDF resource response.\u003C\u002Fp>\n\n\u003Ch2>Why Convert JSON to PDF in .NET with C#?\u003C\u002Fh2>\n\n\u003Cp>.NET workflow systems often persist approvals, automation outcomes, and external-service responses as JSON. While that representation works well in storage and code, reviewers may need a document that fits naturally into an audit packet or case-management process.\u003C\u002Fp>\n\n\u003Cp>For example, an approval engine may record a completed request with nested approvers, timestamps, conditions, and decision values. C# can generate a hierarchy-formatted PDF that keeps those relationships clear and place it with the associated forms and correspondence. The source JSON remains the system record, while the PDF serves human review.\u003C\u002Fp>\n\n\u003Cp>This approach avoids mapping every possible payload shape into report classes or drawing instructions. The application can use hierarchy mode for business users and source mode for technical reviewers, with consistent page formatting and tags supplied by the same conversion profile.\u003C\u002Fp>\n\n\u003Ch2>C# Code Example for Converting JSON to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">\u002F*\n * What this sample does:\n * - Converts structured JSON input to PDF through the \u002Fpdf endpoint.\n *\n * Setup (environment):\n * - Set PDFREST_API_KEY=your_api_key_here\n * - Optional: set PDFREST_URL to override the API region.\n *\n * Usage:\n *   dotnet run -- pdf-from-json-multipart \u003CinputFile>\n *\u002F\nusing Newtonsoft.Json.Linq;\nusing System.Net.Http.Headers;\nusing System.Text;\n\nnamespace Samples.EndpointExamples.MultipartPayload;\n\npublic static class PdfFromJson\n{\n    public static async Task Execute(string[] args)\n    {\n        var inputPath = args.Length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.json\";\n        var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\n        if (string.IsNullOrWhiteSpace(apiKey)) throw new InvalidOperationException(\"Missing PDFREST_API_KEY\");\n        var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n        using var client = new HttpClient { BaseAddress = new Uri(baseUrl) };\n        client.DefaultRequestHeaders.TryAddWithoutValidation(\"Api-Key\", apiKey);\n        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(\"application\u002Fjson\"));\n        var options = JObject.Parse(@\"{\"\"title\"\":\"\"Structured Content Sample\"\",\"\"language\"\":\"\"en-US\"\",\"\"enable_tagging\"\":true,\"\"page_setup\"\":{\"\"size\"\":\"\"Letter\"\",\"\"orientation\"\":\"\"portrait\"\",\"\"margin\"\":{\"\"top\"\":36,\"\"right\"\":42,\"\"bottom\"\":36,\"\"left\"\":42}},\"\"style\"\":{\"\"font\"\":\"\"Arial\"\",\"\"heading_font\"\":\"\"Arial\"\",\"\"code_font\"\":\"\"Courier\"\",\"\"text_size\"\":11,\"\"text_color_rgb\"\":[34,34,34],\"\"heading_scale\"\":1.35,\"\"table\"\":{\"\"column_width_weights\"\":[2,3,2],\"\"keep_header_with_first_row\"\":true,\"\"repeat_headers_on_overflow\"\":true,\"\"show_borders\"\":true,\"\"border_width\"\":0.75,\"\"border_color_rgb\"\":[180,188,200],\"\"header_fill_color_rgb\"\":[33,64,98],\"\"header_text_color_rgb\"\":[255,255,255],\"\"row_fill_color_rgb\"\":[250,250,252],\"\"alternate_row_fill_color_rgb\"\":[235,240,246],\"\"cell_padding\"\":{\"\"top\"\":6,\"\"right\"\":8,\"\"bottom\"\":6,\"\"left\"\":8}}},\"\"data_presentation\"\":\"\"hierarchy\"\"}\");\n        using var form = new MultipartFormDataContent();\n        var inputContent = new ByteArrayContent(await File.ReadAllBytesAsync(inputPath));\n        inputContent.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Foctet-stream\");\n        form.Add(inputContent, \"file\", Path.GetFileName(inputPath));\n        form.Add(new StringContent(options.ToString()), \"structured_text_options\");\n        var response = await client.PostAsync(\"pdf\", form);\n        var result = await response.Content.ReadAsStringAsync();\n        Console.WriteLine(result);\n        if (!response.IsSuccessStatusCode) Environment.ExitCode = 1;\n    }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-json.cs\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The C# JSON sample uses the framework \u003Ccode>HttpClient\u003C\u002Fcode> APIs and Newtonsoft JSON types for \u003Ccode>structured_text_options\u003C\u002Fcode>. A project adopting this code must retain the Newtonsoft.Json package reference used by the samples repository.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using Newtonsoft.Json.Linq;\nusing System.Net.Http.Headers;\nusing System.Text;\n        using var client = new HttpClient { BaseAddress = new Uri(baseUrl) };\n        using var form = new MultipartFormDataContent();\u003C\u002Fpre>\n\n\u003Cp>The .NET endpoint block shows which regional service receives this JSON request:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">        if (string.IsNullOrWhiteSpace(apiKey)) throw new InvalidOperationException(\"Missing PDFREST_API_KEY\");\n        var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n        using var client = new HttpClient { BaseAddress = new Uri(baseUrl) };\n        client.DefaultRequestHeaders.TryAddWithoutValidation(\"Api-Key\", apiKey);\u003C\u002Fpre>\n\n\u003Cp>C# turns the .json source into \u003Ccode>StreamContent\u003C\u002Fcode> and preserves its filename in the multipart part. That extension directs the shared \u003Ccode>\u002Fpdf\u003C\u002Fcode> endpoint to the JSON converter.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">    {\n        var inputPath = args.Length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.json\";\n        var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\u003C\u002Fpre>\n\n\u003Cp>The Newtonsoft \u003Ccode>JObject\u003C\u002Fcode> represents pdfRest’s structured conversion settings. It defines the output title and language, explicitly enables tags, configures Letter portrait pages and margins, and carries the typography and JSON-related style properties used by the renderer.\u003C\u002Fp>\n\n\u003Cpre class=\"language-json\">{\n  \"data_presentation\": \"hierarchy\"\n}\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>source\u003C\u002Fcode> is the default. It validates and parses the input, then pretty-prints normalized JSON syntax in a code-style block; original indentation and insignificant whitespace are not preserved. \u003Ccode>hierarchy\u003C\u002Fcode> removes the syntax and creates a nested list in which property names are bold and primitive values appear as key-value items.\u003C\u002Fp>\n\n\u003Cp>Scalar arrays become ordinary nested values. Arrays containing objects or other arrays label their members \u003Ccode>Item 1\u003C\u002Fcode>, \u003Ccode>Item 2\u003C\u002Fcode>, and so on. The converter preserves JSON structure but intentionally does not infer application-specific report meaning. Malformed JSON is rejected in either presentation mode.\u003C\u002Fp>\n\n\u003Cp>The sample’s shared \u003Ccode>style.table\u003C\u002Fcode> object does not affect JSON source or hierarchy output. It can be omitted when the profile is used only for JSON conversion.\u003C\u002Fp>\n\n\u003Cp>For JSON, \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> owns the source stream, serialized settings, and output field. \u003Ccode>HttpClient\u003C\u002Fcode> generates the matching multipart boundary and content type when it sends the container.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">        var inputContent = new ByteArrayContent(await File.ReadAllBytesAsync(inputPath));\n        inputContent.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Foctet-stream\");\n        form.Add(inputContent, \"file\", Path.GetFileName(inputPath));\n        form.Add(new StringContent(options.ToString()), \"structured_text_options\");\n        var response = await client.PostAsync(\"pdf\", form);\n        var result = await response.Content.ReadAsStringAsync();\n        Console.WriteLine(result);\n        if (!response.IsSuccessStatusCode) Environment.ExitCode = 1;\n    }\n}\u003C\u002Fpre>\n\n\u003Cp>The C# client authenticates and posts the JSON form, then reads the response as text. Reporting both status and payload lets an integration distinguish a generated PDF resource from validation or processing errors.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">        var inputContent = new ByteArrayContent(await File.ReadAllBytesAsync(inputPath));\n        inputContent.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Foctet-stream\");\n        form.Add(inputContent, \"file\", Path.GetFileName(inputPath));\n        form.Add(new StringContent(options.ToString()), \"structured_text_options\");\n        var response = await client.PostAsync(\"pdf\", form);\n        var result = await response.Content.ReadAsStringAsync();\n        Console.WriteLine(result);\n        if (!response.IsSuccessStatusCode) Environment.ExitCode = 1;\n    }\n}\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>Potential .NET use cases include workflow histories, configuration baselines, automation results, and integration acknowledgements. Objects and arrays retain their nesting without the converter inventing business-specific labels or summaries.\u003C\u002Fp>\n\n\u003Cp>Tagging supplies logical organization for compatible consumers but does not itself prove accessibility conformance. Build a representative request in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and verify optional fields against the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF reference\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T04:37:36.000+00:00","2026-09-01T04:48:30.000+00:00","Generate structured, tagged PDFs from JSON in .NET with C# using hierarchy or normalized source output.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert JSON to PDF in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-in-net-with-c\u002F\",\n      \"datePublished\": \"2026-09-01T04:48:30.000Z\",\n      \"dateModified\": \"2026-09-01T05:08:58.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Generate structured, tagged PDFs from JSON in .NET with C# using hierarchy or normalized source output.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Conversion, Convert to PDF\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert JSON to PDF in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4576,4577,4578,4579,4580,4581,4582,4583],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1422,"name":1423,"slug":1424,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-json-to-pdf-in-net-with-c\u002F","Convert JSON to PDF in .NET with C# | pdfRest",{"id":4588,"uuid":4589,"title":4590,"slug":4591,"html":4592,"comment_id":4588,"feature_image":48,"featured":284,"visibility":1257,"created_at":4593,"updated_at":4552,"published_at":4594,"custom_excerpt":4595,"codeinjection_head":4596,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4597,"primary_tag":4606,"url":4607,"excerpt":4595,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4608,"meta_description":4595,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a96568e533c9f26b943ae2d","bad005b6-ec25-49e7-a962-af81c01b31be","How to Convert JSON to PDF with cURL","how-to-convert-json-to-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This tutorial shows how to convert JSON to PDF with cURL and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. The request creates tagged output, presents nested JSON as a reader-oriented hierarchy, and applies consistent page and typography settings without requiring a local PDF renderer.\u003C\u002Fp>\n\n\u003Ch2>Why Convert JSON to PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>JSON is designed for APIs and application state, not for people who need a paginated record. A raw payload may be difficult for support staff, project managers, or auditors to scan, and its appearance depends on whichever editor or browser opens it.\u003C\u002Fp>\n\n\u003Cp>A deployment pipeline provides a practical example. After promoting a service, a shell job may save a JSON manifest containing component versions, environment values, and feature flags. The same job can convert that manifest into a hierarchy-formatted PDF and store it with the release evidence, giving reviewers an accessible snapshot without replacing the machine-readable original.\u003C\u002Fp>\n\n\u003Cp>When exact syntax is more useful than a nested outline, the request can use source presentation instead. That mode validates and pretty-prints the JSON, making cURL suitable for both human-oriented operational records and code-oriented diagnostic artifacts.\u003C\u002Fp>\n\n\u003Ch2>cURL Code Example for Converting JSON to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">#!\u002Fbin\u002Fsh\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# This sample converts JSON input to a tagged PDF through multipart \u002Fpdf.\nINPUT_PATH=\"\u002Fpath\u002Fto\u002Fsample.json\"\nOPTIONS='{\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"data_presentation\":\"hierarchy\"}'\n\ncurl --location \"$API_URL\u002Fpdf\" \\\n  --header \"Accept: application\u002Fjson\" \\\n  --header \"Content-Type: multipart\u002Fform-data\" \\\n  --header \"Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  --form \"file=@$INPUT_PATH\" \\\n  --form \"structured_text_options=$OPTIONS\" \\\n  --form \"output=pdf_from_json\"\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-json.sh\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The JSON shell example calls cURL directly, so no language package is required. \u003Ccode>API_URL\u003C\u002Fcode> keeps regional routing visible: the active value uses the US service, and the commented alternative selects the EU service.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">#!\u002Fbin\u002Fsh\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# This sample converts JSON input to a tagged PDF through multipart \u002Fpdf.\nINPUT_PATH=\"\u002Fpath\u002Fto\u002Fsample.json\"\u003C\u002Fpre>\n\n\u003Cp>For this JSON request, the endpoint excerpt makes the regional service choice explicit:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>INPUT_PATH\u003C\u002Fcode> identifies the local .json source. The \u003Ccode>@\u003C\u002Fcode> prefix in the later \u003Ccode>--form\u003C\u002Fcode> argument instructs cURL to upload that file’s contents instead of sending its path as text.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\"># This sample converts JSON input to a tagged PDF through multipart \u002Fpdf.\nINPUT_PATH=\"\u002Fpath\u002Fto\u002Fsample.json\"\nOPTIONS='{\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"data_presentation\":\"hierarchy\"}'\u003C\u002Fpre>\n\n\u003Cp>The JSON assigned to \u003Ccode>OPTIONS\u003C\u002Fcode> is pdfRest-specific rather than shell syntax. \u003Ccode>title\u003C\u002Fcode> becomes document metadata, \u003Ccode>language\u003C\u002Fcode> identifies the document language, and \u003Ccode>enable_tagging\u003C\u002Fcode> explicitly requests logical structure. \u003Ccode>page_setup\u003C\u002Fcode> selects Letter portrait pages with 36-point margins, while \u003Ccode>style\u003C\u002Fcode> supplies fonts, text size, color, and format-specific presentation.\u003C\u002Fp>\n\n\u003Cpre class=\"language-json\">{\n  \"data_presentation\": \"hierarchy\"\n}\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>source\u003C\u002Fcode> is the default. It validates and parses the input, then pretty-prints normalized JSON syntax in a code-style block; original indentation and insignificant whitespace are not preserved. \u003Ccode>hierarchy\u003C\u002Fcode> removes the syntax and creates a nested list in which property names are bold and primitive values appear as key-value items.\u003C\u002Fp>\n\n\u003Cp>Scalar arrays become ordinary nested values. Arrays containing objects or other arrays label their members \u003Ccode>Item 1\u003C\u002Fcode>, \u003Ccode>Item 2\u003C\u002Fcode>, and so on. The converter preserves JSON structure but intentionally does not infer application-specific report meaning. Malformed JSON is rejected in either presentation mode.\u003C\u002Fp>\n\n\u003Cp>The sample’s shared \u003Ccode>style.table\u003C\u002Fcode> object does not affect JSON source or hierarchy output. It can be omitted when the profile is used only for JSON conversion.\u003C\u002Fp>\n\n\u003Cp>For JSON conversion, the \u003Ccode>--form\u003C\u002Fcode> arguments create the multipart fields: \u003Ccode>file\u003C\u002Fcode> carries the structured source, \u003Ccode>structured_text_options\u003C\u002Fcode> carries serialized settings, and \u003Ccode>output\u003C\u002Fcode> names the requested PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">  --header \"Content-Type: multipart\u002Fform-data\" \\\n  --header \"Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  --form \"file=@$INPUT_PATH\" \\\n  --form \"structured_text_options=$OPTIONS\" \\\n  --form \"output=pdf_from_json\"\u003C\u002Fpre>\n\n\u003Cp>The JSON request asks for JSON with \u003Ccode>Accept\u003C\u002Fcode>, declares multipart form data with \u003Ccode>Content-Type\u003C\u002Fcode>, and authenticates through \u003Ccode>Api-Key\u003C\u002Fcode>. Success returns the generated PDF resource and download URL; failure returns API error information.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\"># This sample converts JSON input to a tagged PDF through multipart \u002Fpdf.\nINPUT_PATH=\"\u002Fpath\u002Fto\u002Fsample.json\"\nOPTIONS='{\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"data_presentation\":\"hierarchy\"}'\n\ncurl --location \"$API_URL\u002Fpdf\" \\\n  --header \"Accept: application\u002Fjson\" \\\n  --header \"Content-Type: multipart\u002Fform-data\" \\\n  --header \"Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  --form \"file=@$INPUT_PATH\" \\\n  --form \"structured_text_options=$OPTIONS\" \\\n  --form \"output=pdf_from_json\"\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This pattern can support configuration snapshots, API response archives, processing manifests, and automated evidence packages. Hierarchy mode emphasizes relationships and values, while source mode retains normalized braces, brackets, and property syntax for technical inspection.\u003C\u002Fp>\n\n\u003Cp>Tagged output contributes logical structure for compatible assistive and downstream tools but does not independently establish accessibility conformance. Test representative payloads in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and use the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF documentation\u003C\u002Fa> for the authoritative option contract.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T04:37:34.000+00:00","2026-09-01T04:48:29.000+00:00","Use cURL to convert JSON into a styled, tagged PDF with either readable hierarchy or normalized source presentation.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Convert JSON to PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-curl\u002F\",\n      \"datePublished\": \"2026-09-01T04:48:29.000Z\",\n      \"dateModified\": \"2026-09-01T05:07:13.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Use cURL to convert JSON into a styled, tagged PDF with either readable hierarchy or normalized source presentation.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert JSON to PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4598,4599,4600,4601,4602,4603,4604,4605],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1422,"name":1423,"slug":1424,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-json-to-pdf-with-curl\u002F","Convert JSON to PDF with cURL | pdfRest",{"id":4610,"uuid":4611,"title":4612,"slug":4613,"html":4614,"comment_id":4610,"feature_image":48,"featured":284,"visibility":1257,"created_at":4593,"updated_at":4615,"published_at":4572,"custom_excerpt":4616,"codeinjection_head":4617,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4618,"primary_tag":4627,"url":4628,"excerpt":4616,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4629,"meta_description":4616,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a96568e533c9f26b943ae37","f82ca99c-1c0d-44eb-81db-b2a3e1fb9924","How to Convert JSON to PDF with Java","how-to-convert-json-to-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This Java example sends JSON to the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa> and receives a styled, tagged PDF. It demonstrates hierarchy presentation, document metadata, page setup, typography, multipart construction, and resource-response handling.\u003C\u002Fp>\n\n\u003Ch2>Why Convert JSON to PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>Enterprise Java services exchange JSON for orders, decisions, events, and integration results. Those payloads are efficient application contracts, but they are poor review documents when someone must understand nested properties or retain the information with a business case.\u003C\u002Fp>\n\n\u003Cp>Consider an order platform that receives a JSON decision from a fraud-screening service. Java can convert the response into a hierarchy-formatted PDF where decision fields, reason arrays, and nested account details remain visibly related. Operations staff can add the PDF to the order record while developers preserve the original payload for programmatic analysis.\u003C\u002Fp>\n\n\u003Cp>Using the API keeps the Java application from maintaining a second reporting model for arbitrary JSON shapes. It can choose a readable hierarchy for operational review or normalized source for engineers, while applying the same metadata, page design, and tagging rules to both.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example for Converting JSON to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class PdfFromJson {\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) throws IOException {\n    File inputFile = new File(args.length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.json\");\n    Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n    String apiKey = dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY);\n    JSONObject options =\n        new JSONObject(\n            \"{\\\"title\\\":\\\"Structured Content Sample\\\",\\\"language\\\":\\\"en-US\\\",\\\"enable_tagging\\\":true,\\\"page_setup\\\":{\\\"size\\\":\\\"Letter\\\",\\\"orientation\\\":\\\"portrait\\\",\\\"margin\\\":{\\\"top\\\":36,\\\"right\\\":42,\\\"bottom\\\":36,\\\"left\\\":42}},\\\"style\\\":{\\\"font\\\":\\\"Arial\\\",\\\"heading_font\\\":\\\"Arial\\\",\\\"code_font\\\":\\\"Courier\\\",\\\"text_size\\\":11,\\\"text_color_rgb\\\":[34,34,34],\\\"heading_scale\\\":1.35,\\\"table\\\":{\\\"column_width_weights\\\":[2,3,2],\\\"keep_header_with_first_row\\\":true,\\\"repeat_headers_on_overflow\\\":true,\\\"show_borders\\\":true,\\\"border_width\\\":0.75,\\\"border_color_rgb\\\":[180,188,200],\\\"header_fill_color_rgb\\\":[33,64,98],\\\"header_text_color_rgb\\\":[255,255,255],\\\"row_fill_color_rgb\\\":[250,250,252],\\\"alternate_row_fill_color_rgb\\\":[235,240,246],\\\"cell_padding\\\":{\\\"top\\\":6,\\\"right\\\":8,\\\"bottom\\\":6,\\\"left\\\":8}}},\\\"data_presentation\\\":\\\"hierarchy\\\"}\");\n    MultipartBody.Builder form =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\n                \"file\",\n                inputFile.getName(),\n                RequestBody.create(inputFile, MediaType.parse(\"application\u002Foctet-stream\")))\n            .addFormDataPart(\"structured_text_options\", options.toString());\n    Request request =\n        new Request.Builder()\n            .url(API_URL + \"\u002Fpdf\")\n            .header(\"Api-Key\", apiKey)\n            .post(form.build())\n            .build();\n    send(request);\n  }\n\n  private static void send(Request request) throws IOException {\n    OkHttpClient client = new OkHttpClient.Builder().readTimeout(60, TimeUnit.SECONDS).build();\n    try (Response response = client.newCall(request).execute()) {\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) System.out.println(response.body().string());\n      if (!response.isSuccessful()) System.exit(1);\n    }\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPdfFromJson.java\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This Java JSON example combines OkHttp for transport, \u003Ccode>org.json\u003C\u002Fcode> for conversion settings, and dotenv support for repository configuration. Those project dependencies must remain available when the class is moved into another application.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The Java endpoint excerpt exposes the regional service selection used for this JSON conversion:\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">public class PdfFromJson {\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) throws IOException {\n    File inputFile = new File(args.length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.json\");\n    Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n    String apiKey = dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY);\u003C\u002Fpre>\n\n\u003Cp>Java wraps the .json path in an OkHttp request body and retains the filename in the multipart upload. The shared \u003Ccode>\u002Fpdf\u003C\u002Fcode> endpoint uses that extension to select JSON conversion.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">  public static void main(String[] args) throws IOException {\n    File inputFile = new File(args.length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.json\");\n    Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>JSONObject\u003C\u002Fcode> is the pdfRest conversion profile. Its title and language describe the PDF, \u003Ccode>enable_tagging\u003C\u002Fcode> explicitly requests logical tags, and \u003Ccode>page_setup\u003C\u002Fcode> establishes Letter portrait pages with 36-point margins. The \u003Ccode>style\u003C\u002Fcode> member controls the fonts, text size, color, and any JSON-specific rendering choices.\u003C\u002Fp>\n\n\u003Cpre class=\"language-json\">{\n  \"data_presentation\": \"hierarchy\"\n}\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>source\u003C\u002Fcode> is the default. It validates and parses the input, then pretty-prints normalized JSON syntax in a code-style block; original indentation and insignificant whitespace are not preserved. \u003Ccode>hierarchy\u003C\u002Fcode> removes the syntax and creates a nested list in which property names are bold and primitive values appear as key-value items.\u003C\u002Fp>\n\n\u003Cp>Scalar arrays become ordinary nested values. Arrays containing objects or other arrays label their members \u003Ccode>Item 1\u003C\u002Fcode>, \u003Ccode>Item 2\u003C\u002Fcode>, and so on. The converter preserves JSON structure but intentionally does not infer application-specific report meaning. Malformed JSON is rejected in either presentation mode.\u003C\u002Fp>\n\n\u003Cp>The sample’s shared \u003Ccode>style.table\u003C\u002Fcode> object does not affect JSON source or hierarchy output. It can be omitted when the profile is used only for JSON conversion.\u003C\u002Fp>\n\n\u003Cp>For the JSON upload, \u003Ccode>MultipartBody.Builder\u003C\u002Fcode> combines the source file, serialized \u003Ccode>structured_text_options\u003C\u002Fcode>, and ordinary \u003Ccode>output\u003C\u002Fcode> text field in one request body.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">                \"file\",\n                inputFile.getName(),\n                RequestBody.create(inputFile, MediaType.parse(\"application\u002Foctet-stream\")))\n            .addFormDataPart(\"structured_text_options\", options.toString());\n    Request request =\n        new Request.Builder()\n            .url(API_URL + \"\u002Fpdf\")\n            .header(\"Api-Key\", apiKey)\n            .post(form.build())\n            .build();\n    send(request);\u003C\u002Fpre>\n\n\u003Cp>OkHttp submits the JSON conversion with the API key and checks the HTTP result. The printed body contains generated-resource JSON after success or API error details when processing fails.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">  }\n\n  private static void send(Request request) throws IOException {\n    OkHttpClient client = new OkHttpClient.Builder().readTimeout(60, TimeUnit.SECONDS).build();\n    try (Response response = client.newCall(request).execute()) {\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) System.out.println(response.body().string());\n      if (!response.isSuccessful()) System.exit(1);\n    }\n  }\n}\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>Java teams can adapt this workflow to transaction records, service responses, policy snapshots, and integration diagnostics. Complex arrays are labeled by item number, which helps reviewers navigate repeated objects without requiring domain-specific templates.\u003C\u002Fp>\n\n\u003Cp>The generated tags expose document structure but are not a PDF\u002FUA or WCAG certification. Explore payload and styling variations with \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, then consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API guide\u003C\u002Fa> for supported parameters and constraints.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-02T18:27:17.000+00:00","Convert JSON objects and arrays into styled, tagged PDFs with Java using hierarchy or normalized source views.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Convert JSON to PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T04:48:30.000Z\",\n      \"dateModified\": \"2026-09-01T05:07:13.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert JSON objects and arrays into styled, tagged PDFs with Java using hierarchy or normalized source views.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, Java\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert JSON to PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4619,4620,4621,4622,4623,4624,4625,4626],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1422,"name":1423,"slug":1424,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-json-to-pdf-with-java\u002F","Convert JSON to PDF with Java | pdfRest",{"id":4631,"uuid":4632,"title":4633,"slug":4634,"html":4635,"comment_id":4631,"feature_image":48,"featured":284,"visibility":1257,"created_at":4636,"updated_at":4615,"published_at":4572,"custom_excerpt":4637,"codeinjection_head":4638,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4639,"primary_tag":4648,"url":4649,"excerpt":4637,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4650,"meta_description":4637,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a96568f533c9f26b943ae41","ca13babe-721a-47c7-965d-36d6c48c1439","How to Convert JSON to PDF with JavaScript in NodeJS","how-to-convert-json-to-pdf-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This NodeJS walkthrough uses JavaScript to convert a JSON file through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. One multipart request supplies the source and structured options for a tagged PDF with a clear nested layout.\u003C\u002Fp>\n\n\u003Ch2>Why Convert JSON to PDF with JavaScript in NodeJS?\u003C\u002Fh2>\n\n\u003Cp>NodeJS applications routinely receive webhook payloads and API responses that are meaningful to the product but hard to share outside a developer console. Customer-facing and operational workflows often need a stable artifact that can be downloaded, forwarded, and reviewed with other documents.\u003C\u002Fp>\n\n\u003Cp>Imagine a SaaS support system investigating a failed provisioning webhook. Its backend can convert the captured JSON into a PDF that groups account fields, status details, and nested error objects hierarchically. The support engineer gains a readable case attachment, while the exact JSON remains available in the event store.\u003C\u002Fp>\n\n\u003Cp>The same JavaScript integration can request source mode when braces, arrays, and literal values must remain visible. Because both presentations use \u003Ccode>\u002Fpdf\u003C\u002Fcode>, the application can choose according to the audience rather than building separate browser and server rendering paths.\u003C\u002Fp>\n\n\u003Ch2>JavaScript Code Example for Converting JSON to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar fs = require(\"fs\");\nvar FormData = require(\"form-data\");\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n\u002F\u002F This sample converts JSON input to a tagged PDF through multipart \u002Fpdf.\n\u002F\u002F It demonstrates structured_text_options and the format-specific conversion options.\nvar inputPath = \"\u002Fpath\u002Fto\u002Fsample.json\";\nvar form = new FormData();\nform.append(\"file\", fs.createReadStream(inputPath));\nform.append(\"structured_text_options\", JSON.stringify({\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"data_presentation\":\"hierarchy\"}));\nform.append(\"output\", \"pdf_from_json\");\n\naxios.post(apiUrl + \"\u002Fpdf\", form, { headers: { \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", ...form.getHeaders() }, maxBodyLength: Infinity })\n.then((response) => { console.log(JSON.stringify(response.data, null, 2)); })\n.catch((error) => { console.error(error.response ? error.response.data : error.message); process.exitCode = 1; });\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-json.js\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The NodeJS JSON walkthrough uses \u003Ccode>axios\u003C\u002Fcode>, \u003Ccode>form-data\u003C\u002Fcode>, and Node’s file-system module. Outside the samples project, install its HTTP and multipart dependencies with \u003Ccode>npm install axios form-data\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar fs = require(\"fs\");\nvar FormData = require(\"form-data\");\u003C\u002Fpre>\n\n\u003Cp>This NodeJS excerpt keeps the regional endpoint visible for the JSON workflow:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\u003C\u002Fpre>\n\n\u003Cp>JavaScript streams the .json source into the form while preserving its filename. pdfRest infers JSON conversion from that extension, so \u003Ccode>structured_text_options\u003C\u002Fcode> does not need an \u003Ccode>input_format\u003C\u002Fcode> property.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F It demonstrates structured_text_options and the format-specific conversion options.\nvar inputPath = \"\u002Fpath\u002Fto\u002Fsample.json\";\nvar form = new FormData();\u003C\u002Fpre>\n\n\u003Cp>The object passed through \u003Ccode>JSON.stringify\u003C\u002Fcode> is interpreted by pdfRest as \u003Ccode>structured_text_options\u003C\u002Fcode>. It sets PDF metadata, explicitly enables tagging, defines Letter portrait geometry and margins, and supplies the font and color choices used when laying out the JSON content.\u003C\u002Fp>\n\n\u003Cpre class=\"language-json\">{\n  \"data_presentation\": \"hierarchy\"\n}\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>source\u003C\u002Fcode> is the default. It validates and parses the input, then pretty-prints normalized JSON syntax in a code-style block; original indentation and insignificant whitespace are not preserved. \u003Ccode>hierarchy\u003C\u002Fcode> removes the syntax and creates a nested list in which property names are bold and primitive values appear as key-value items.\u003C\u002Fp>\n\n\u003Cp>Scalar arrays become ordinary nested values. Arrays containing objects or other arrays label their members \u003Ccode>Item 1\u003C\u002Fcode>, \u003Ccode>Item 2\u003C\u002Fcode>, and so on. The converter preserves JSON structure but intentionally does not infer application-specific report meaning. Malformed JSON is rejected in either presentation mode.\u003C\u002Fp>\n\n\u003Cp>The sample’s shared \u003Ccode>style.table\u003C\u002Fcode> object does not affect JSON source or hierarchy output. It can be omitted when the profile is used only for JSON conversion.\u003C\u002Fp>\n\n\u003Cp>NodeJS uses \u003Ccode>FormData\u003C\u002Fcode> to append the JSON file, stringified \u003Ccode>structured_text_options\u003C\u002Fcode>, and output name. The generated form headers provide the multipart boundary for those fields.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var inputPath = \"\u002Fpath\u002Fto\u002Fsample.json\";\nvar form = new FormData();\nform.append(\"file\", fs.createReadStream(inputPath));\nform.append(\"structured_text_options\", JSON.stringify({\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"data_presentation\":\"hierarchy\"}));\nform.append(\"output\", \"pdf_from_json\");\n\naxios.post(apiUrl + \"\u002Fpdf\", form, { headers: { \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", ...form.getHeaders() }, maxBodyLength: Infinity })\n.then((response) => { console.log(JSON.stringify(response.data, null, 2)); })\n.catch((error) => { console.error(error.response ? error.response.data : error.message); process.exitCode = 1; });\u003C\u002Fpre>\n\n\u003Cp>Axios sends the JSON request to \u003Ccode>\u002Fpdf\u003C\u002Fcode> with the form headers and \u003Ccode>Api-Key\u003C\u002Fcode>. Its success path prints resource JSON, while the rejection path exposes either the API response or the client-side error.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">form.append(\"file\", fs.createReadStream(inputPath));\nform.append(\"structured_text_options\", JSON.stringify({\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"data_presentation\":\"hierarchy\"}));\nform.append(\"output\", \"pdf_from_json\");\n\naxios.post(apiUrl + \"\u002Fpdf\", form, { headers: { \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", ...form.getHeaders() }, maxBodyLength: Infinity })\n.then((response) => { console.log(JSON.stringify(response.data, null, 2)); })\n.catch((error) => { console.error(error.response ? error.response.data : error.message); process.exitCode = 1; });\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>Useful extensions include webhook archives, account snapshots, job-result exports, and downloadable API diagnostics. Hierarchy presentation favors quick comprehension; source presentation favors developers comparing the normalized payload with code or logs.\u003C\u002Fp>\n\n\u003Cp>Logical tags can improve navigation and automated interpretation without guaranteeing compliance with a named accessibility standard. Prototype the conversion in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and reference the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF documentation\u003C\u002Fa> before finalizing production behavior.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T04:37:35.000+00:00","Create styled and tagged PDFs from JSON in NodeJS with configurable hierarchy and normalized source presentation.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert JSON to PDF with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2026-09-01T04:48:30.000Z\",\n      \"dateModified\": \"2026-09-01T05:07:14.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Create styled and tagged PDFs from JSON in NodeJS with configurable hierarchy and normalized source presentation.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, JavaScript\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert JSON to PDF with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4640,4641,4642,4643,4644,4645,4646,4647],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1422,"name":1423,"slug":1424,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-json-to-pdf-with-javascript-in-nodejs\u002F","Convert JSON to PDF with NodeJS | pdfRest",{"id":4652,"uuid":4653,"title":4654,"slug":4655,"html":4656,"comment_id":4652,"feature_image":48,"featured":284,"visibility":1257,"created_at":4571,"updated_at":4657,"published_at":4658,"custom_excerpt":4659,"codeinjection_head":4660,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4661,"primary_tag":4670,"url":4671,"excerpt":4659,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4672,"meta_description":4659,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a965690533c9f26b943ae55","82aef272-3ab4-4761-b98c-25c03e95d8b5","How to Convert JSON to PDF with PHP","how-to-convert-json-to-pdf-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This PHP tutorial converts JSON into a styled, tagged PDF through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. The example uploads the payload with structured options and requests a nested hierarchy designed for human reading.\u003C\u002Fp>\n\n\u003Ch2>Why Convert JSON to PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>PHP commerce and portal applications generate JSON for orders, fulfillment events, account settings, and background jobs. A raw payload is useful to the application but can create unnecessary friction when customer service or a partner needs a readable record.\u003C\u002Fp>\n\n\u003Cp>An online store might receive a JSON fulfillment response containing packages, tracking events, item arrays, and exception details. PHP can convert the response into a hierarchy-formatted PDF and attach it to an escalated order. Agents can follow the nested information without searching through punctuation or copying values into a separate document.\u003C\u002Fp>\n\n\u003Cp>Source presentation remains available when technical support needs normalized JSON syntax for troubleshooting. One PHP integration can therefore produce either a reader-oriented case attachment or a developer-oriented payload record while keeping common styling and metadata.\u003C\u002Fp>\n\n\u003Ch2>PHP Code Example for Converting JSON to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n$inputPath = '\u002Fpath\u002Fto\u002Fsample.json';\n$options = json_decode('{\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"data_presentation\":\"hierarchy\"}', true);\n\n\u002F\u002F This sample converts JSON input to a tagged PDF through multipart \u002Fpdf.\n\u002F\u002F It demonstrates structured_text_options and the format-specific conversion options.\n$multipart = [\n  ['name' => 'file', 'contents' => Utils::tryFopen($inputPath, 'r'), 'filename' => basename($inputPath)],\n  ['name' => 'structured_text_options', 'contents' => json_encode($options)],\n  ['name' => 'output', 'contents' => 'pdf_from_json'],\n];\n$response = (new Client())->post($apiUrl . '\u002Fpdf', ['headers' => ['Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'Accept' => 'application\u002Fjson'], 'multipart' => $multipart]);\necho $response->getBody();\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-json.php\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This PHP JSON example relies on Guzzle for HTTP and PSR-7 stream utilities for the upload. When using the code outside this repository, add the client with \u003Ccode>composer require guzzlehttp\u002Fguzzle\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\u003C\u002Fpre>\n\n\u003Cp>The PHP endpoint excerpt keeps regional routing explicit for this JSON operation:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\u003C\u002Fpre>\n\n\u003Cp>PHP opens the .json source as a PSR-7 stream and includes its filename in the multipart part. The extension selects JSON processing without duplicating the format in the options JSON.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$inputPath = '\u002Fpath\u002Fto\u002Fsample.json';\n$options = json_decode('{\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"data_presentation\":\"hierarchy\"}', true);\u003C\u002Fpre>\n\n\u003Cp>The array decoded into \u003Ccode>$options\u003C\u002Fcode> is serialized as pdfRest’s \u003Ccode>structured_text_options\u003C\u002Fcode>. It describes the PDF title and language, explicitly turns on tagging, chooses Letter portrait pages with 36-point margins, and provides typography plus JSON-specific styling.\u003C\u002Fp>\n\n\u003Cpre class=\"language-json\">{\n  \"data_presentation\": \"hierarchy\"\n}\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>source\u003C\u002Fcode> is the default. It validates and parses the input, then pretty-prints normalized JSON syntax in a code-style block; original indentation and insignificant whitespace are not preserved. \u003Ccode>hierarchy\u003C\u002Fcode> removes the syntax and creates a nested list in which property names are bold and primitive values appear as key-value items.\u003C\u002Fp>\n\n\u003Cp>Scalar arrays become ordinary nested values. Arrays containing objects or other arrays label their members \u003Ccode>Item 1\u003C\u002Fcode>, \u003Ccode>Item 2\u003C\u002Fcode>, and so on. The converter preserves JSON structure but intentionally does not infer application-specific report meaning. Malformed JSON is rejected in either presentation mode.\u003C\u002Fp>\n\n\u003Cp>The sample’s shared \u003Ccode>style.table\u003C\u002Fcode> object does not affect JSON source or hierarchy output. It can be omitted when the profile is used only for JSON conversion.\u003C\u002Fp>\n\n\u003Cp>The PHP multipart array assigns \u003Ccode>name\u003C\u002Fcode> and \u003Ccode>contents\u003C\u002Fcode> values to the JSON stream, serialized \u003Ccode>structured_text_options\u003C\u002Fcode>, and requested output name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">\u002F\u002F It demonstrates structured_text_options and the format-specific conversion options.\n$multipart = [\n  ['name' => 'file', 'contents' => Utils::tryFopen($inputPath, 'r'), 'filename' => basename($inputPath)],\n  ['name' => 'structured_text_options', 'contents' => json_encode($options)],\n  ['name' => 'output', 'contents' => 'pdf_from_json'],\n];\n$response = (new Client())->post($apiUrl . '\u002Fpdf', ['headers' => ['Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'Accept' => 'application\u002Fjson'], 'multipart' => $multipart]);\necho $response->getBody();\u003C\u002Fpre>\n\n\u003Cp>Guzzle prepares and submits the JSON multipart body with the API key. The response body contains generated-resource information on success and service error details when the conversion cannot be completed.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">  ['name' => 'file', 'contents' => Utils::tryFopen($inputPath, 'r'), 'filename' => basename($inputPath)],\n  ['name' => 'structured_text_options', 'contents' => json_encode($options)],\n  ['name' => 'output', 'contents' => 'pdf_from_json'],\n];\n$response = (new Client())->post($apiUrl . '\u002Fpdf', ['headers' => ['Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'Accept' => 'application\u002Fjson'], 'multipart' => $multipart]);\necho $response->getBody();\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This method can generate downloadable account snapshots, order-event records, job summaries, and partner-integration evidence. It is especially useful when payload structures vary enough that maintaining a custom template for every response would be impractical.\u003C\u002Fp>\n\n\u003Cp>Tagged structure supports document navigation and later processing but is not an automatic accessibility guarantee. Exercise different JSON shapes in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API documentation\u003C\u002Fa> for the complete set of controls.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-02T18:27:18.000+00:00","2026-09-01T04:48:31.000+00:00","Turn JSON files into readable, tagged PDF documents with PHP using hierarchy or normalized source presentation.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-php\u002F#article\",\n      \"headline\": \"How to Convert JSON to PDF with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-php\u002F\",\n      \"datePublished\": \"2026-09-01T04:48:31.000Z\",\n      \"dateModified\": \"2026-09-01T05:07:15.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Turn JSON files into readable, tagged PDF documents with PHP using hierarchy or normalized source presentation.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert JSON to PDF with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4662,4663,4664,4665,4666,4667,4668,4669],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1422,"name":1423,"slug":1424,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-json-to-pdf-with-php\u002F","Convert JSON to PDF with PHP | pdfRest",{"id":4674,"uuid":4675,"title":4676,"slug":4677,"html":4678,"comment_id":4674,"feature_image":48,"featured":284,"visibility":1257,"created_at":4679,"updated_at":4657,"published_at":4658,"custom_excerpt":4680,"codeinjection_head":4681,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4682,"primary_tag":4691,"url":4692,"excerpt":4680,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4693,"meta_description":4680,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a965691533c9f26b943ae5f","bab2aa16-6a53-42bc-8028-f2fd5df338f6","How to Convert JSON to PDF with Python","how-to-convert-json-to-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This Python example converts a JSON file with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. It demonstrates multipart upload, hierarchy presentation, tagged output, page setup, typography, and explicit response handling.\u003C\u002Fp>\n\n\u003Ch2>Why Convert JSON to PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>Python pipelines frequently write run metadata, validation results, and experiment configurations as JSON. Those files are ideal for further processing, but project leads and reviewers may need a PDF that can be annotated, distributed, or retained with other deliverables.\u003C\u002Fp>\n\n\u003Cp>A data-science workflow offers a concrete case: after an evaluation run, Python can save model settings, dataset identifiers, metric values, and warning arrays as JSON. Converting that payload into a hierarchy-formatted PDF creates a readable experiment record without discarding the machine-readable source used for reproducibility.\u003C\u002Fp>\n\n\u003Cp>When a developer needs to inspect literal JSON instead, source mode validates and pretty-prints the payload. Python automation can choose either presentation for each audience while using the same request to enforce page size, fonts, language metadata, and tagging.\u003C\u002Fp>\n\n\u003Ch2>Python Code Example for Converting JSON to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">import json\nimport os\nimport requests\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# This sample converts JSON input to a tagged PDF through multipart \u002Fpdf.\n# It demonstrates structured_text_options and the format-specific conversion options.\ninput_path = \"\u002Fpath\u002Fto\u002Fsample.json\"\noptions = json.loads(r'''{\n  \"title\": \"Structured Content Sample\",\n  \"language\": \"en-US\",\n  \"enable_tagging\": true,\n  \"page_setup\": {\n    \"size\": \"Letter\",\n    \"orientation\": \"portrait\",\n    \"margin\": {\n      \"top\": 36,\n      \"right\": 42,\n      \"bottom\": 36,\n      \"left\": 42\n    }\n  },\n  \"style\": {\n    \"font\": \"Arial\",\n    \"heading_font\": \"Arial\",\n    \"code_font\": \"Courier\",\n    \"text_size\": 11,\n    \"text_color_rgb\": [\n      34,\n      34,\n      34\n    ],\n    \"heading_scale\": 1.35,\n    \"table\": {\n      \"column_width_weights\": [\n        2,\n        3,\n        2\n      ],\n      \"keep_header_with_first_row\": true,\n      \"repeat_headers_on_overflow\": true,\n      \"show_borders\": true,\n      \"border_width\": 0.75,\n      \"border_color_rgb\": [\n        180,\n        188,\n        200\n      ],\n      \"header_fill_color_rgb\": [\n        33,\n        64,\n        98\n      ],\n      \"header_text_color_rgb\": [\n        255,\n        255,\n        255\n      ],\n      \"row_fill_color_rgb\": [\n        250,\n        250,\n        252\n      ],\n      \"alternate_row_fill_color_rgb\": [\n        235,\n        240,\n        246\n      ],\n      \"cell_padding\": {\n        \"top\": 6,\n        \"right\": 8,\n        \"bottom\": 6,\n        \"left\": 8\n      }\n    }\n  },\n  \"data_presentation\": \"hierarchy\"\n}''')\n\nfrom requests_toolbelt import MultipartEncoder\nwith open(input_path, \"rb\") as input_file:\n    fields = {\n        \"file\": (os.path.basename(input_path), input_file, \"text\u002Fplain\"),\n        \"structured_text_options\": json.dumps(options),\n    }\n    form = MultipartEncoder(fields=fields)\n    response = requests.post(api_url + \"\u002Fpdf\", data=form, headers={\n        \"Accept\": \"application\u002Fjson\",\n        \"Content-Type\": form.content_type,\n        \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    })\n\nprint(\"Response status code: \" + str(response.status_code))\nif response.ok:\n    print(json.dumps(response.json(), indent=2))\nelse:\n    print(response.text)\n    raise SystemExit(1)\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-json.py\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The Python JSON sample uses \u003Ccode>requests\u003C\u002Fcode> and \u003Ccode>MultipartEncoder\u003C\u002Fcode> from \u003Ccode>requests-toolbelt\u003C\u002Fcode>. Install both with \u003Ccode>python -m pip install requests requests-toolbelt\u003C\u002Fcode> when they are not already present.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">import json\nimport os\nimport requests\u003C\u002Fpre>\n\n\u003Cp>This Python endpoint excerpt identifies the regional service used for JSON conversion:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\"># By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>Python opens the .json input in binary mode and sends its base filename with the stream. \u003Ccode>\u002Fpdf\u003C\u002Fcode> uses that filename extension to infer the JSON input type.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\"># It demonstrates structured_text_options and the format-specific conversion options.\ninput_path = \"\u002Fpath\u002Fto\u002Fsample.json\"\noptions = json.loads(r'''{\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>options\u003C\u002Fcode> dictionary becomes pdfRest’s \u003Ccode>structured_text_options\u003C\u002Fcode> field. It supplies document metadata, explicitly requests tags, establishes Letter portrait pages and 36-point margins, and selects the fonts, text size, color, and JSON-specific presentation values.\u003C\u002Fp>\n\n\u003Cpre class=\"language-json\">{\n  \"data_presentation\": \"hierarchy\"\n}\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>source\u003C\u002Fcode> is the default. It validates and parses the input, then pretty-prints normalized JSON syntax in a code-style block; original indentation and insignificant whitespace are not preserved. \u003Ccode>hierarchy\u003C\u002Fcode> removes the syntax and creates a nested list in which property names are bold and primitive values appear as key-value items.\u003C\u002Fp>\n\n\u003Cp>Scalar arrays become ordinary nested values. Arrays containing objects or other arrays label their members \u003Ccode>Item 1\u003C\u002Fcode>, \u003Ccode>Item 2\u003C\u002Fcode>, and so on. The converter preserves JSON structure but intentionally does not infer application-specific report meaning. Malformed JSON is rejected in either presentation mode.\u003C\u002Fp>\n\n\u003Cp>The sample’s shared \u003Ccode>style.table\u003C\u002Fcode> object does not affect JSON source or hierarchy output. It can be omitted when the profile is used only for JSON conversion.\u003C\u002Fp>\n\n\u003Cp>For the JSON call, \u003Ccode>MultipartEncoder\u003C\u002Fcode> combines the file tuple with serialized \u003Ccode>structured_text_options\u003C\u002Fcode>. Its \u003Ccode>content_type\u003C\u002Fcode>, including the boundary, becomes the request’s \u003Ccode>Content-Type\u003C\u002Fcode> header.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">with open(input_path, \"rb\") as input_file:\n    fields = {\n        \"file\": (os.path.basename(input_path), input_file, \"text\u002Fplain\"),\n        \"structured_text_options\": json.dumps(options),\n    }\n    form = MultipartEncoder(fields=fields)\n    response = requests.post(api_url + \"\u002Fpdf\", data=form, headers={\n        \"Accept\": \"application\u002Fjson\",\n        \"Content-Type\": form.content_type,\n        \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    })\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>requests.post\u003C\u002Fcode> sends the encoded JSON form with the API key. The script pretty-prints resource JSON after success and otherwise displays the API message before exiting with a nonzero status.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">        \"file\": (os.path.basename(input_path), input_file, \"text\u002Fplain\"),\n        \"structured_text_options\": json.dumps(options),\n    }\n    form = MultipartEncoder(fields=fields)\n    response = requests.post(api_url + \"\u002Fpdf\", data=form, headers={\n        \"Accept\": \"application\u002Fjson\",\n        \"Content-Type\": form.content_type,\n        \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    })\n\nprint(\"Response status code: \" + str(response.status_code))\nif response.ok:\n    print(json.dumps(response.json(), indent=2))\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>The pattern also suits pipeline manifests, data-quality output, API snapshots, and reproducibility records. Hierarchy mode clarifies nested values and arrays; source mode provides normalized syntax for comparison and debugging.\u003C\u002Fp>\n\n\u003Cp>Tags establish logical structure for assistive and downstream software without constituting a formal conformance claim. Test realistic files in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and use the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF documentation\u003C\u002Fa> for current requirements and limitations.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T04:37:37.000+00:00","Convert JSON data into styled, tagged PDFs with Python and choose hierarchy or normalized source presentation.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Convert JSON to PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-python\u002F\",\n      \"datePublished\": \"2026-09-01T04:48:31.000Z\",\n      \"dateModified\": \"2026-09-01T05:07:15.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert JSON data into styled, tagged PDFs with Python and choose hierarchy or normalized source presentation.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert JSON to PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-json-to-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4683,4684,4685,4686,4687,4688,4689,4690],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1422,"name":1423,"slug":1424,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-json-to-pdf-with-python\u002F","Convert JSON to PDF with Python | pdfRest",{"id":4695,"uuid":4696,"title":4697,"slug":4698,"html":4699,"comment_id":4695,"feature_image":48,"featured":284,"visibility":1257,"created_at":4700,"updated_at":4701,"published_at":4700,"custom_excerpt":4702,"codeinjection_head":4703,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4704,"primary_tag":4713,"url":4714,"excerpt":4702,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4715,"meta_description":4702,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a92036e533c9f26b943ac68","90b73e28-1206-4e90-ad2b-1caa7705d4f8","How to Convert Markdown to PDF in .NET with C#","how-to-convert-markdown-to-pdf-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This C# walkthrough converts a Markdown file into a tagged PDF using the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. It combines the source, an uploaded image, and layout settings in a multipart request suitable for a .NET document workflow.\u003C\u002Fp>\n\n\u003Ch2>Why Convert Markdown to PDF with C#?\u003C\u002Fh2>\n\n\u003Cp>.NET teams commonly author runbooks, change notes, and internal standards in Markdown because it fits naturally with Git-based review. Formal approval processes, external distribution, and records management often require a PDF version with predictable pages and presentation.\u003C\u002Fp>\n\n\u003Cp>For example, a release-management portal can collect approved Markdown change notes, a compatibility matrix, and a product diagram, then generate a PDF for the change-approval package. Reviewers get a stable artifact with styled tables and visible document structure, while developers avoid manually copying the content into Word or rebuilding it in a second template.\u003C\u002Fp>\n\n\u003Cp>The API makes the export repeatable from the same source of truth. C# code can specify margins, fonts, colors, tagging, and image alternate text without automating desktop software or calculating where each Markdown element belongs on the page.\u003C\u002Fp>\n\n\u003Ch2>C# Code Example for Converting Markdown to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">\u002F*\n * What this sample does:\n * - Converts structured Markdown input to PDF through the \u002Fpdf endpoint.\n *\n * Setup (environment):\n * - Set PDFREST_API_KEY=your_api_key_here\n * - Optional: set PDFREST_URL to override the API region.\n *\n * Usage:\n *   dotnet run -- pdf-from-markdown-multipart \u003CinputFile> \u003CimageFile>\n *\u002F\nusing Newtonsoft.Json.Linq;\nusing System.Net.Http.Headers;\nusing System.Text;\n\nnamespace Samples.EndpointExamples.MultipartPayload;\n\npublic static class PdfFromMarkdown\n{\n    public static async Task Execute(string[] args)\n    {\n        var inputPath = args.Length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.md\";\n        var imagePath = args.Length > 1 ? args[1] : \"\u002Fpath\u002Fto\u002Flogo.png\";\n        var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\n        if (string.IsNullOrWhiteSpace(apiKey)) throw new InvalidOperationException(\"Missing PDFREST_API_KEY\");\n        var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n        using var client = new HttpClient { BaseAddress = new Uri(baseUrl) };\n        client.DefaultRequestHeaders.TryAddWithoutValidation(\"Api-Key\", apiKey);\n        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(\"application\u002Fjson\"));\n        var options = JObject.Parse(@\"{\"\"title\"\":\"\"Structured Content Sample\"\",\"\"language\"\":\"\"en-US\"\",\"\"enable_tagging\"\":true,\"\"page_setup\"\":{\"\"size\"\":\"\"Letter\"\",\"\"orientation\"\":\"\"portrait\"\",\"\"margin\"\":{\"\"top\"\":36,\"\"right\"\":42,\"\"bottom\"\":36,\"\"left\"\":42}},\"\"style\"\":{\"\"font\"\":\"\"Arial\"\",\"\"heading_font\"\":\"\"Arial\"\",\"\"code_font\"\":\"\"Courier\"\",\"\"text_size\"\":11,\"\"text_color_rgb\"\":[34,34,34],\"\"heading_scale\"\":1.35,\"\"table\"\":{\"\"column_width_weights\"\":[2,3,2],\"\"keep_header_with_first_row\"\":true,\"\"repeat_headers_on_overflow\"\":true,\"\"show_borders\"\":true,\"\"border_width\"\":0.75,\"\"border_color_rgb\"\":[180,188,200],\"\"header_fill_color_rgb\"\":[33,64,98],\"\"header_text_color_rgb\"\":[255,255,255],\"\"row_fill_color_rgb\"\":[250,250,252],\"\"alternate_row_fill_color_rgb\"\":[235,240,246],\"\"cell_padding\"\":{\"\"top\"\":6,\"\"right\"\":8,\"\"bottom\"\":6,\"\"left\"\":8}}},\"\"markdown\"\":{\"\"image_alt_text\"\":{\"\"sample-logo\"\":\"\"Sample logo\"\"},\"\"missing_image_alt_text\"\":\"\"fail\"\",\"\"image_sources\"\":{\"\"sample-logo\"\":{\"\"upload_index\"\":0}}}}\");\n        using var form = new MultipartFormDataContent();\n        var inputContent = new ByteArrayContent(await File.ReadAllBytesAsync(inputPath));\n        inputContent.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Foctet-stream\");\n        form.Add(inputContent, \"file\", Path.GetFileName(inputPath));\n        var imageContent = new ByteArrayContent(await File.ReadAllBytesAsync(imagePath));\n        imageContent.Headers.ContentType = new MediaTypeHeaderValue(\"image\u002Fpng\");\n        form.Add(imageContent, \"image_files\", Path.GetFileName(imagePath));\n        form.Add(new StringContent(options.ToString()), \"structured_text_options\");\n        var response = await client.PostAsync(\"pdf\", form);\n        var result = await response.Content.ReadAsStringAsync();\n        Console.WriteLine(result);\n        if (!response.IsSuccessStatusCode) Environment.ExitCode = 1;\n    }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-markdown.cs\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The \u003Ccode>Execute\u003C\u002Fcode> method accepts command-line arguments for the Markdown source and image file. These values can be supplied when running the sample, or you can replace the placeholder paths directly.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var inputPath = args.Length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.md\";\nvar imagePath = args.Length > 1 ? args[1] : \"\u002Fpath\u002Fto\u002Flogo.png\";\n\u003C\u002Fpre>\n\n\u003Cp>The first path identifies the Markdown source, while the second identifies the local image uploaded with the request. The API determines that the source is Markdown from the uploaded file extension, so the options JSON does not need an \u003Ccode>input_format\u003C\u002Fcode> property.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\nif (string.IsNullOrWhiteSpace(apiKey)) throw new InvalidOperationException(\"Missing PDFREST_API_KEY\");\n\u003C\u002Fpre>\n\n\u003Cp>The sample reads the pdfRest API key from the \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode> environment variable and stops with a clear error if the key is missing.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\nusing var client = new HttpClient { BaseAddress = new Uri(baseUrl) };\n\u003C\u002Fpre>\n\n\u003Cp>The API base URL defaults to the US-based pdfRest service. Set \u003Ccode>PDFREST_URL\u003C\u002Fcode> when you need to use a different supported service region.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">client.DefaultRequestHeaders.TryAddWithoutValidation(\"Api-Key\", apiKey);\nclient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(\"application\u002Fjson\"));\n\u003C\u002Fpre>\n\n\u003Cp>These headers authenticate the request and indicate that the application expects a JSON response containing the generated PDF resource details and download URL.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var options = JObject.Parse(@\"{\"\"title\"\":\"\"Structured Content Sample\"\",\"\"language\"\":\"\"en-US\"\",\"\"enable_tagging\"\":true,\"\"page_setup\"\":{\"\"size\"\":\"\"Letter\"\",\"\"orientation\"\":\"\"portrait\"\",\"\"margin\"\":{\"\"top\"\":36,\"\"right\"\":42,\"\"bottom\"\":36,\"\"left\"\":42}},\"\"style\"\":{\"\"font\"\":\"\"Arial\"\",\"\"heading_font\"\":\"\"Arial\"\",\"\"code_font\"\":\"\"Courier\"\",\"\"text_size\"\":11,\"\"text_color_rgb\"\":[34,34,34],\"\"heading_scale\"\":1.35,\"\"table\"\":{\"\"column_width_weights\"\":[2,3,2],\"\"keep_header_with_first_row\"\":true,\"\"repeat_headers_on_overflow\"\":true,\"\"show_borders\"\":true,\"\"border_width\"\":0.75,\"\"border_color_rgb\"\":[180,188,200],\"\"header_fill_color_rgb\"\":[33,64,98],\"\"header_text_color_rgb\"\":[255,255,255],\"\"row_fill_color_rgb\"\":[250,250,252],\"\"alternate_row_fill_color_rgb\"\":[235,240,246],\"\"cell_padding\"\":{\"\"top\"\":6,\"\"right\"\":8,\"\"bottom\"\":6,\"\"left\"\":8}}},\"\"markdown\"\":{\"\"image_alt_text\"\":{\"\"sample-logo\"\":\"\"Sample logo\"\"},\"\"missing_image_alt_text\"\":\"\"fail\"\",\"\"image_sources\"\":{\"\"sample-logo\"\":{\"\"upload_index\"\":0}}}}\");\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>options\u003C\u002Fcode> object becomes the \u003Ccode>structured_text_options\u003C\u002Fcode> form field. It sets the PDF title and language, enables tagged output, configures the page, and applies typography and table styling. The table settings control relative column widths, repeated headers, borders, colors, padding, and alternating row fills for Markdown tables.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>markdown.image_sources\u003C\u002Fcode> configuration maps the Markdown image target \u003Ccode>sample-logo\u003C\u002Fcode> to the first uploaded image, represented by \u003Ccode>\"upload_index\": 0\u003C\u002Fcode>. The Markdown source should contain the same target, such as \u003Ccode>![Company logo](sample-logo)\u003C\u002Fcode>. The \u003Ccode>image_alt_text\u003C\u002Fcode> value supplies alternate text, while \u003Ccode>missing_image_alt_text\u003C\u002Fcode> is set to \u003Ccode>fail\u003C\u002Fcode> so that conversion stops if a meaningful image lacks alternate text.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using var form = new MultipartFormDataContent();\nvar inputContent = new ByteArrayContent(await File.ReadAllBytesAsync(inputPath));\ninputContent.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Foctet-stream\");\nform.Add(inputContent, \"file\", Path.GetFileName(inputPath));\nvar imageContent = new ByteArrayContent(await File.ReadAllBytesAsync(imagePath));\nimageContent.Headers.ContentType = new MediaTypeHeaderValue(\"image\u002Fpng\");\nform.Add(imageContent, \"image_files\", Path.GetFileName(imagePath));\nform.Add(new StringContent(options.ToString()), \"structured_text_options\");\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> object holds the Markdown source, uploaded image, and JSON conversion options. The uploaded image is available to the Markdown conversion through its zero-based upload index.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await client.PostAsync(\"pdf\", form);\nvar result = await response.Content.ReadAsStringAsync();\nConsole.WriteLine(result);\nif (!response.IsSuccessStatusCode) Environment.ExitCode = 1;\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>PostAsync\u003C\u002Fcode> call sends the multipart request to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. The response is printed to the console, and the sample returns a nonzero exit status when the API reports an error.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This example shows how a C# application can create a polished, tagged PDF from Markdown while controlling document presentation and resolving a local image in the same request. Tagged output adds logical document structure that can support accessibility and downstream processing, but it does not by itself guarantee conformance with a specific accessibility standard.\u003C\u002Fp>\n\n\u003Cp>.NET applications may remove image, table, or typography fields that are unnecessary for a particular Markdown conversion. Validate representative requests in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, and review the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF reference\u003C\u002Fa> before finalizing the integration.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-08-28T21:53:50.000+00:00","2026-09-02T18:27:19.000+00:00","Create a tagged, professionally styled PDF from Markdown in C#, with support for tables and mapped images.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert Markdown to PDF in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-in-net-with-c\u002F\",\n      \"datePublished\": \"2026-08-28T21:53:50.000Z\",\n      \"dateModified\": \"2026-09-01T05:11:16.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Create a tagged, professionally styled PDF from Markdown in C#, with support for tables and mapped images.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Conversion, Convert to PDF, Markdown\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Markdown to PDF in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4705,4706,4707,4708,4709,4710,4711,4712],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1414,"name":1415,"slug":1416,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-markdown-to-pdf-in-net-with-c\u002F","How to Convert Markdown to PDF in .NET with C#, Tutorial | pdfRest",{"id":4717,"uuid":4718,"title":4719,"slug":4720,"html":4721,"comment_id":4717,"feature_image":48,"featured":284,"visibility":1257,"created_at":4722,"updated_at":4701,"published_at":4722,"custom_excerpt":4723,"codeinjection_head":4724,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4725,"primary_tag":4734,"url":4735,"excerpt":4723,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4736,"meta_description":4723,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a920738533c9f26b943ac85","d5cddba3-657e-47b5-81e7-dac562cffe99","How to Convert Markdown to PDF with cURL","how-to-convert-markdown-to-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This tutorial shows how to convert Markdown to PDF with cURL and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. The request applies page and table styling, creates tagged output, and maps an uploaded image into the Markdown document in one multipart API call.\u003C\u002Fp>\n\n\u003Ch2>Why Convert Markdown to PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>Markdown is efficient for writing release notes, technical instructions, and project documentation, but a \u003Ccode>.md\u003C\u002Fcode> file is not always appropriate for customers, approvers, or document archives. PDF gives that same content a stable page layout while retaining headings, lists, links, code blocks, tables, and images.\u003C\u002Fp>\n\n\u003Cp>A CI release job offers a practical example. After a build creates Markdown release notes containing a compatibility table and product image, a shell step can submit those assets to pdfRest and save the generated PDF with the release artifacts. Product managers and customers receive a polished document, while engineers continue maintaining the source in version control.\u003C\u002Fp>\n\n\u003Cp>The image mapping and alternate-text settings make the workflow suitable for more than text-only conversion. Combined with configurable typography, table colors, margins, language metadata, and tags, cURL can turn an existing Markdown publishing step into repeatable PDF generation without adding a browser-based renderer to the build environment.\u003C\u002Fp>\n\n\u003Ch2>cURL Code Example for Converting Markdown to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">#!\u002Fbin\u002Fsh\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# This sample converts Markdown input to a tagged PDF through multipart \u002Fpdf.\n# It maps a Markdown image target to an uploaded image resource.\nINPUT_PATH=\"\u002Fpath\u002Fto\u002Fsample.md\"\nIMAGE_PATH=\"\u002Fpath\u002Fto\u002Flogo.png\"\nOPTIONS='{\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"markdown\":{\"image_alt_text\":{\"sample-logo\":\"Sample logo\"},\"missing_image_alt_text\":\"fail\",\"image_sources\":{\"sample-logo\":{\"upload_index\":0}}}}'\n\ncurl --location \"$API_URL\u002Fpdf\" \\\n  --header \"Accept: application\u002Fjson\" \\\n  --header \"Content-Type: multipart\u002Fform-data\" \\\n  --header \"Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  --form \"file=@$INPUT_PATH\" \\\n  --form \"image_files=@$IMAGE_PATH\" \\\n  --form \"structured_text_options=$OPTIONS\" \\\n  --form \"output=pdf_from_markdown\"\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-markdown.sh\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The Markdown shell example calls cURL directly, so no language package is required. \u003Ccode>API_URL\u003C\u002Fcode> keeps regional routing visible: the active value uses the US service, and the commented alternative selects the EU service.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">#!\u002Fbin\u002Fsh\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# This sample converts Markdown input to a tagged PDF through multipart \u002Fpdf.\n# It maps a Markdown image target to an uploaded image resource.\u003C\u002Fpre>\n\n\u003Cp>For this Markdown request, the endpoint excerpt makes the regional service choice explicit:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>INPUT_PATH\u003C\u002Fcode> identifies the local .md source. The \u003Ccode>@\u003C\u002Fcode> prefix in the later \u003Ccode>--form\u003C\u002Fcode> argument instructs cURL to upload that file’s contents instead of sending its path as text.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\"># It maps a Markdown image target to an uploaded image resource.\nINPUT_PATH=\"\u002Fpath\u002Fto\u002Fsample.md\"\nIMAGE_PATH=\"\u002Fpath\u002Fto\u002Flogo.png\"\u003C\u002Fpre>\n\n\u003Cp>The JSON assigned to \u003Ccode>OPTIONS\u003C\u002Fcode> is pdfRest-specific rather than shell syntax. \u003Ccode>title\u003C\u002Fcode> becomes document metadata, \u003Ccode>language\u003C\u002Fcode> identifies the document language, and \u003Ccode>enable_tagging\u003C\u002Fcode> explicitly requests logical structure. \u003Ccode>page_setup\u003C\u002Fcode> selects Letter portrait pages with 36-point margins, while \u003Ccode>style\u003C\u002Fcode> supplies fonts, text size, color, and format-specific presentation.\u003C\u002Fp>\n\n\u003Cpre class=\"language-json\">{\n  \"markdown\": {\n    \"image_alt_text\": {\n      \"sample-logo\": \"Company logo\"\n    },\n    \"missing_image_alt_text\": \"fail\",\n    \"image_sources\": {\n      \"sample-logo\": {\n        \"upload_index\": 0\n      }\n    }\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>The key \u003Ccode>sample-logo\u003C\u002Fcode> must match the Markdown image target, such as \u003Ccode>![Company logo](sample-logo)\u003C\u002Fcode>. \u003Ccode>upload_index: 0\u003C\u002Fcode> selects the first file supplied through \u003Ccode>image_files\u003C\u002Fcode>; indexes are zero-based. The alternate-text map supplies meaningful text for that target, and \u003Ccode>missing_image_alt_text: \"fail\"\u003C\u002Fcode> stops conversion when a meaningful mapped image lacks alternate text.\u003C\u002Fp>\n\n\u003Cp>The table subsection styles Markdown tables with relative column widths, repeated headers, borders, header and row colors, alternating fills, and cell padding. These values affect Markdown tables found in the source; they do not create a table when the Markdown contains none.\u003C\u002Fp>\n\n\u003Cp>For Markdown conversion, the \u003Ccode>--form\u003C\u002Fcode> arguments create the multipart fields: \u003Ccode>file\u003C\u002Fcode> carries the structured source, \u003Ccode>structured_text_options\u003C\u002Fcode> carries serialized settings, and \u003Ccode>output\u003C\u002Fcode> names the requested PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">  --header \"Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  --form \"file=@$INPUT_PATH\" \\\n  --form \"image_files=@$IMAGE_PATH\" \\\n  --form \"structured_text_options=$OPTIONS\" \\\n  --form \"output=pdf_from_markdown\"\u003C\u002Fpre>\n\n\u003Cp>The Markdown request asks for JSON with \u003Ccode>Accept\u003C\u002Fcode>, declares multipart form data with \u003Ccode>Content-Type\u003C\u002Fcode>, and authenticates through \u003Ccode>Api-Key\u003C\u002Fcode>. Success returns the generated PDF resource and download URL; failure returns API error information.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">INPUT_PATH=\"\u002Fpath\u002Fto\u002Fsample.md\"\nIMAGE_PATH=\"\u002Fpath\u002Fto\u002Flogo.png\"\nOPTIONS='{\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"markdown\":{\"image_alt_text\":{\"sample-logo\":\"Sample logo\"},\"missing_image_alt_text\":\"fail\",\"image_sources\":{\"sample-logo\":{\"upload_index\":0}}}}'\n\ncurl --location \"$API_URL\u002Fpdf\" \\\n  --header \"Accept: application\u002Fjson\" \\\n  --header \"Content-Type: multipart\u002Fform-data\" \\\n  --header \"Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  --form \"file=@$INPUT_PATH\" \\\n  --form \"image_files=@$IMAGE_PATH\" \\\n  --form \"structured_text_options=$OPTIONS\" \\\n  --form \"output=pdf_from_markdown\"\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This example shows how cURL can generate a polished, tagged PDF from Markdown while controlling presentation and resolving a local image in the same multipart request. Enabling tags adds logical document structure, but it does not establish compliance with a particular accessibility standard.\u003C\u002Fp>\n\n\u003Cp>Simpler Markdown workflows can omit image mapping or styling fields they do not use. Explore request variations in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, and see the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF documentation\u003C\u002Fa> for the complete parameter reference.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-08-28T22:10:00.000+00:00","Convert styled Markdown with tables, images, and tagged structure into PDF using cURL and the pdfRest API.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Convert Markdown to PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-curl\u002F\",\n      \"datePublished\": \"2026-08-28T22:10:00.000Z\",\n      \"dateModified\": \"2026-09-01T05:07:04.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert styled Markdown with tables, images, and tagged structure into PDF using cURL and the pdfRest API.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, Markdown, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Markdown to PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4726,4727,4728,4729,4730,4731,4732,4733],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1414,"name":1415,"slug":1416,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-markdown-to-pdf-with-curl\u002F","How to Convert Markdown to PDF with cURL, Tutorial | pdfRest",{"id":4738,"uuid":4739,"title":4740,"slug":4741,"html":4742,"comment_id":4738,"feature_image":48,"featured":284,"visibility":1257,"created_at":4743,"updated_at":4701,"published_at":4743,"custom_excerpt":4744,"codeinjection_head":4745,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4746,"primary_tag":4755,"url":4756,"excerpt":4744,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4757,"meta_description":4744,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a920725533c9f26b943ac7c","90d5f08c-d95e-43d6-a08c-4666e2969bc1","How to Convert Markdown to PDF with Java","how-to-convert-markdown-to-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This Java example converts Markdown into a styled, tagged PDF through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. It demonstrates multipart upload, document and table styling, and explicit image mapping for a complete server-side conversion workflow.\u003C\u002Fp>\n\n\u003Ch2>Why Convert Markdown to PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>Enterprise applications often store procedures and product content as Markdown because it is easy to review, diff, and generate. The people consuming that material may instead need a paginated PDF for onboarding, deployment, approval, or offline access.\u003C\u002Fp>\n\n\u003Cp>Consider a Java-based knowledge platform that maintains installation guides in Markdown. When a customer downloads a guide, the application can submit the article, its logo, and its configuration table to pdfRest. The resulting PDF preserves the document hierarchy, styles the table consistently, and embeds the supplied image without requiring the platform to maintain a separate PDF template.\u003C\u002Fp>\n\n\u003Cp>Using one structured conversion request also reduces drift between online and downloadable documentation. Java services can control page geometry and visual presentation while retaining Markdown’s authoring advantages, and tagged output provides logical structure for assistive technology and downstream document processing.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example for Converting Markdown to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class PdfFromMarkdown {\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) throws IOException {\n    File inputFile = new File(args.length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.md\");\n    File imageFile = new File(args.length > 1 ? args[1] : \"\u002Fpath\u002Fto\u002Flogo.png\");\n    Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n    String apiKey = dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY);\n    JSONObject options =\n        new JSONObject(\n            \"{\\\"title\\\":\\\"Structured Content Sample\\\",\\\"language\\\":\\\"en-US\\\",\\\"enable_tagging\\\":true,\\\"page_setup\\\":{\\\"size\\\":\\\"Letter\\\",\\\"orientation\\\":\\\"portrait\\\",\\\"margin\\\":{\\\"top\\\":36,\\\"right\\\":42,\\\"bottom\\\":36,\\\"left\\\":42}},\\\"style\\\":{\\\"font\\\":\\\"Arial\\\",\\\"heading_font\\\":\\\"Arial\\\",\\\"code_font\\\":\\\"Courier\\\",\\\"text_size\\\":11,\\\"text_color_rgb\\\":[34,34,34],\\\"heading_scale\\\":1.35,\\\"table\\\":{\\\"column_width_weights\\\":[2,3,2],\\\"keep_header_with_first_row\\\":true,\\\"repeat_headers_on_overflow\\\":true,\\\"show_borders\\\":true,\\\"border_width\\\":0.75,\\\"border_color_rgb\\\":[180,188,200],\\\"header_fill_color_rgb\\\":[33,64,98],\\\"header_text_color_rgb\\\":[255,255,255],\\\"row_fill_color_rgb\\\":[250,250,252],\\\"alternate_row_fill_color_rgb\\\":[235,240,246],\\\"cell_padding\\\":{\\\"top\\\":6,\\\"right\\\":8,\\\"bottom\\\":6,\\\"left\\\":8}}},\\\"markdown\\\":{\\\"image_alt_text\\\":{\\\"sample-logo\\\":\\\"Sample logo\\\"},\\\"missing_image_alt_text\\\":\\\"fail\\\",\\\"image_sources\\\":{\\\"sample-logo\\\":{\\\"upload_index\\\":0}}}}\");\n    MultipartBody.Builder form =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\n                \"file\",\n                inputFile.getName(),\n                RequestBody.create(inputFile, MediaType.parse(\"application\u002Foctet-stream\")))\n            .addFormDataPart(\n                \"image_files\",\n                imageFile.getName(),\n                RequestBody.create(imageFile, MediaType.parse(\"image\u002Fpng\")))\n            .addFormDataPart(\"structured_text_options\", options.toString());\n    Request request =\n        new Request.Builder()\n            .url(API_URL + \"\u002Fpdf\")\n            .header(\"Api-Key\", apiKey)\n            .post(form.build())\n            .build();\n    send(request);\n  }\n\n  private static void send(Request request) throws IOException {\n    OkHttpClient client = new OkHttpClient.Builder().readTimeout(60, TimeUnit.SECONDS).build();\n    try (Response response = client.newCall(request).execute()) {\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) System.out.println(response.body().string());\n      if (!response.isSuccessful()) System.exit(1);\n    }\n  }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPdfFromMarkdown.java\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code imports \u003Ccode>Dotenv\u003C\u002Fcode> to load the API key from environment configuration, \u003Ccode>OkHttp\u003C\u002Fcode> to make the HTTP request, and \u003Ccode>JSONObject\u003C\u002Fcode> to construct the structured-text conversion options.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">File inputFile = new File(args.length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.md\");\nFile imageFile = new File(args.length > 1 ? args[1] : \"\u002Fpath\u002Fto\u002Flogo.png\");\n\u003C\u002Fpre>\n\n\u003Cp>These lines identify the Markdown source file and local image file. You can supply their paths as command-line arguments or replace the placeholder paths directly. The API determines that the source is Markdown from the uploaded file extension, so the options object does not need an \u003Ccode>input_format\u003C\u002Fcode> property.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\nString apiKey = dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY);\n\u003C\u002Fpre>\n\n\u003Cp>This code loads \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode> from a local environment file when available. Replace the placeholder value with a valid pdfRest API key if you do not use a \u003Ccode>.env\u003C\u002Fcode> file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">JSONObject options = new JSONObject(\"{\\\"title\\\":\\\"Structured Content Sample\\\",\\\"language\\\":\\\"en-US\\\", ... }\");\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>options\u003C\u002Fcode> object is sent as \u003Ccode>structured_text_options\u003C\u002Fcode>. It sets the PDF title and language, enables tagged output, configures the page, and applies typography and table styling. The table options control relative column widths, repeated headers, borders, colors, padding, and alternating row fills for Markdown tables.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>markdown.image_sources\u003C\u002Fcode> configuration maps the Markdown image target \u003Ccode>sample-logo\u003C\u002Fcode> to the first uploaded image, represented by \u003Ccode>\"upload_index\": 0\u003C\u002Fcode>. The Markdown source should contain the same target, such as \u003Ccode>![Company logo](sample-logo)\u003C\u002Fcode>. The \u003Ccode>image_alt_text\u003C\u002Fcode> setting supplies alternate text, while \u003Ccode>missing_image_alt_text\u003C\u002Fcode> is set to \u003Ccode>fail\u003C\u002Fcode> so that conversion stops if a meaningful image lacks alternate text.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">MultipartBody.Builder form = new MultipartBody.Builder().setType(MultipartBody.FORM) ...\n\u003C\u002Fpre>\n\n\u003Cp>The multipart form includes the Markdown source as \u003Ccode>file\u003C\u002Fcode>, the local image as \u003Ccode>image_files\u003C\u002Fcode>, and the JSON configuration as \u003Ccode>structured_text_options\u003C\u002Fcode>. The uploaded image is available to the Markdown conversion through its zero-based upload index.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Request request = new Request.Builder().url(API_URL + \"\u002Fpdf\").header(\"Api-Key\", apiKey).post(form.build()).build();\n\u003C\u002Fpre>\n\n\u003Cp>This constructs a \u003Ccode>POST\u003C\u002Fcode> request to the Convert to PDF endpoint and includes the API key and multipart form data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">private static void send(Request request) throws IOException { ... }\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>send\u003C\u002Fcode> method executes the request with OkHttp, prints the response code and body, and returns a nonzero exit status when the API reports an error.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This example shows how a Java application can create a polished, tagged PDF from Markdown while controlling document presentation and resolving a local image in the same request. Tagged output adds logical document structure that can support accessibility and downstream processing, but it does not by itself guarantee conformance with a specific accessibility standard.\u003C\u002Fp>\n\n\u003Cp>A Java integration can omit image mapping, table styling, or other controls that its Markdown source does not use. Experiment with a smaller profile in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, and consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF documentation\u003C\u002Fa> for accepted values and defaults.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-08-28T22:09:41.000+00:00","Use Java to create a styled, tagged PDF from Markdown content, tables, and uploaded images with pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Convert Markdown to PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-java\u002F\",\n      \"datePublished\": \"2026-08-28T22:09:41.000Z\",\n      \"dateModified\": \"2026-09-01T05:11:15.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Use Java to create a styled, tagged PDF from Markdown content, tables, and uploaded images with pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, Java, Markdown\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Markdown to PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4747,4748,4749,4750,4751,4752,4753,4754],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1414,"name":1415,"slug":1416,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-markdown-to-pdf-with-java\u002F","How to Convert Markdown to PDF with Java, Tutorial | pdfRest",{"id":4759,"uuid":4760,"title":4761,"slug":4762,"html":4763,"comment_id":4759,"feature_image":48,"featured":284,"visibility":1257,"created_at":4764,"updated_at":4765,"published_at":4764,"custom_excerpt":4766,"codeinjection_head":4767,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4768,"primary_tag":4777,"url":4778,"excerpt":4766,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4779,"meta_description":4766,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a920399533c9f26b943ac72","617bfe16-cd2a-4ec2-83ac-dd32de720e8b","How to Convert Markdown to PDF with JavaScript in NodeJS","how-to-convert-markdown-to-pdf-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This JavaScript tutorial uses NodeJS to send Markdown, an image, and structured conversion options to the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. The response is a tagged PDF with customized typography, page setup, and table presentation.\u003C\u002Fp>\n\n\u003Ch2>Why Convert Markdown to PDF with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>Web applications frequently accept Markdown for project updates, user-authored documentation, and generated reports. Browser rendering works inside the product, but users still ask for a PDF they can download, circulate, or include with records outside the application.\u003C\u002Fp>\n\n\u003Cp>A project-management service might assemble a quarterly status report in Markdown with milestone lists, a risk table, and an uploaded progress chart. Its NodeJS backend can map that chart to the image reference in the source and create a PDF export on demand. Stakeholders receive a coherent document rather than a screenshot or an unstyled print view.\u003C\u002Fp>\n\n\u003Cp>This approach allows the same Markdown content model to serve both web and document channels. The conversion profile handles page boundaries, repeated table headers, colors, fonts, image alternate text, and tagging, leaving the JavaScript application responsible for the content rather than PDF layout calculations.\u003C\u002Fp>\n\n\u003Ch2>JavaScript Code Example for Converting Markdown to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar fs = require(\"fs\");\nvar FormData = require(\"form-data\");\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n\u002F\u002F This sample converts Markdown input to a tagged PDF through multipart \u002Fpdf.\n\u002F\u002F It demonstrates structured_text_options, table styling, tagging, and uploaded Markdown image mapping.\nvar inputPath = \"\u002Fpath\u002Fto\u002Fsample.md\";\nvar imagePath = \"\u002Fpath\u002Fto\u002Flogo.png\";\nvar form = new FormData();\nform.append(\"file\", fs.createReadStream(inputPath));\nform.append(\"image_files\", fs.createReadStream(imagePath));\nform.append(\"structured_text_options\", JSON.stringify({\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"markdown\":{\"image_alt_text\":{\"sample-logo\":\"Sample logo\"},\"missing_image_alt_text\":\"fail\",\"image_sources\":{\"sample-logo\":{\"upload_index\":0}}}}));\nform.append(\"output\", \"pdf_from_markdown\");\n\naxios.post(apiUrl + \"\u002Fpdf\", form, { headers: { \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", ...form.getHeaders() }, maxBodyLength: Infinity })\n.then((response) => { console.log(JSON.stringify(response.data, null, 2)); })\n.catch((error) => { console.error(error.response ? error.response.data : error.message); process.exitCode = 1; });\n\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-markdown.js\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The sample uses \u003Ccode>axios\u003C\u002Fcode> to send the HTTP request, Node.js \u003Ccode>fs\u003C\u002Fcode> streams to read the local files, and \u003Ccode>form-data\u003C\u002Fcode> to construct the multipart request. When using this sample outside the pdfRest API samples repository, install the required packages with \u003Ccode>npm install axios form-data\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>apiUrl\u003C\u002Fcode> value selects the US-based pdfRest service by default. An EU endpoint is included as a commented alternative when that service region is appropriate for your workflow.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var inputPath = \"\u002Fpath\u002Fto\u002Fsample.md\";\nvar imagePath = \"\u002Fpath\u002Fto\u002Flogo.png\";\nvar form = new FormData();\n\u003C\u002Fpre>\n\n\u003Cp>These values identify the Markdown source and local image file. The API determines that the source is Markdown from the uploaded file extension, so the options object does not need an \u003Ccode>input_format\u003C\u002Fcode> property.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">form.append(\"file\", fs.createReadStream(inputPath));\nform.append(\"image_files\", fs.createReadStream(imagePath));\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>file\u003C\u002Fcode> form field uploads the Markdown source, while \u003Ccode>image_files\u003C\u002Fcode> uploads the local image. Both files are read as streams, which is appropriate for larger files and avoids loading them entirely into memory.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">form.append(\"structured_text_options\", JSON.stringify({\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"markdown\":{\"image_alt_text\":{\"sample-logo\":\"Sample logo\"},\"missing_image_alt_text\":\"fail\",\"image_sources\":{\"sample-logo\":{\"upload_index\":0}}}}));\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>structured_text_options\u003C\u002Fcode> JSON configures the generated PDF. It sets the title and language, enables tagged output, defines page setup, and applies typography and table styling. The table options control relative column widths, repeated headers, borders, colors, padding, and alternating row fills for Markdown tables.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>markdown.image_sources\u003C\u002Fcode> object maps the Markdown image target \u003Ccode>sample-logo\u003C\u002Fcode> to the first uploaded image, represented by \u003Ccode>\"upload_index\": 0\u003C\u002Fcode>. The Markdown source should use the same target, such as \u003Ccode>![Company logo](sample-logo)\u003C\u002Fcode>. The \u003Ccode>image_alt_text\u003C\u002Fcode> setting supplies alternate text, while \u003Ccode>missing_image_alt_text\u003C\u002Fcode> is set to \u003Ccode>fail\u003C\u002Fcode> so that conversion stops if a meaningful image lacks alternate text.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">form.append(\"output\", \"pdf_from_markdown\");\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>output\u003C\u002Fcode> value sets the output filename for the generated PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios.post(apiUrl + \"\u002Fpdf\", form, { headers: { \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", ...form.getHeaders() }, maxBodyLength: Infinity })\n.then((response) => { console.log(JSON.stringify(response.data, null, 2)); })\n.catch((error) => { console.error(error.response ? error.response.data : error.message); process.exitCode = 1; });\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>axios.post\u003C\u002Fcode> call sends the multipart form to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. The request includes the pdfRest API key and the form headers generated by \u003Ccode>form-data\u003C\u002Fcode>. A successful response is printed as formatted JSON, while an API or network error is written to standard error.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This example shows how a Node.js application can create a polished, tagged PDF from Markdown while controlling document presentation and resolving a local image in the same request. Tagged output adds logical document structure that can support accessibility and downstream processing, but it does not by itself guarantee conformance with a specific accessibility standard.\u003C\u002Fp>\n\n\u003Cp>NodeJS workflows only need to send the Markdown options that apply to their content and image strategy. Try alternate profiles in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, then use the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF documentation\u003C\u002Fa> as the complete parameter reference.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-08-28T21:54:33.000+00:00","2026-09-02T18:27:20.000+00:00","Generate styled and tagged PDFs from Markdown with JavaScript, including tables and mapped image uploads.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert Markdown to PDF with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2026-08-28T21:54:33.000Z\",\n      \"dateModified\": \"2026-09-01T05:11:16.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Generate styled and tagged PDFs from Markdown with JavaScript, including tables and mapped image uploads.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, JavaScript, Markdown\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Markdown to PDF with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4769,4770,4771,4772,4773,4774,4775,4776],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1414,"name":1415,"slug":1416,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-markdown-to-pdf-with-javascript-in-nodejs\u002F","How to Convert Markdown to PDF with JavaScript in NodeJS, Tutorial | pdfRest",{"id":4781,"uuid":4782,"title":4783,"slug":4784,"html":4785,"comment_id":4781,"feature_image":48,"featured":284,"visibility":1257,"created_at":4786,"updated_at":4765,"published_at":4786,"custom_excerpt":4787,"codeinjection_head":4788,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4789,"primary_tag":4798,"url":4799,"excerpt":4787,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4800,"meta_description":4787,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a920356533c9f26b943ac5e","e692c757-8646-49ab-b60b-33de9a58b301","How to Convert Markdown to PDF with PHP","how-to-convert-markdown-to-pdf-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This PHP tutorial converts Markdown into a tagged PDF with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. The sample sends the article, a referenced image, and structured styling options together so the downloadable document matches the intended content.\u003C\u002Fp>\n\n\u003Ch2>Why Convert Markdown to PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>Content portals and support sites often store articles as Markdown because editors can maintain headings, links, procedures, and code examples without working in raw HTML. Customers may still need a PDF for offline troubleshooting, field work, or sharing with someone who cannot access the portal.\u003C\u002Fp>\n\n\u003Cp>Imagine a PHP knowledge base containing a repair procedure with ordered steps, a parts table, command examples, and an annotated image. When a technician requests a download, the application can convert the existing Markdown into a formatted PDF and map the uploaded illustration to its source reference. The team maintains one article instead of a web version and a separately edited manual.\u003C\u002Fp>\n\n\u003Cp>Configurable table fills, borders, padding, typography, and page margins help the export look intentional rather than like a browser printout. Tags and image alternate text add useful document semantics, while the PHP application continues using its established Markdown publishing workflow.\u003C\u002Fp>\n\n\u003Ch2>PHP Code Example for Converting Markdown to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n$inputPath = '\u002Fpath\u002Fto\u002Fsample.md';\n$imagePath = '\u002Fpath\u002Fto\u002Flogo.png';\n$options = json_decode('{\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"markdown\":{\"image_alt_text\":{\"sample-logo\":\"Sample logo\"},\"missing_image_alt_text\":\"fail\",\"image_sources\":{\"sample-logo\":{\"upload_index\":0}}}}', true);\n\n\u002F\u002F This sample converts Markdown input to a tagged PDF through multipart \u002Fpdf.\n\u002F\u002F It demonstrates structured_text_options, table styling, tagging, and uploaded Markdown image mapping.\n$multipart = [\n  ['name' => 'file', 'contents' => Utils::tryFopen($inputPath, 'r'), 'filename' => basename($inputPath)],\n  ['name' => 'image_files', 'contents' => Utils::tryFopen($imagePath, 'r'), 'filename' => basename($imagePath)],\n  ['name' => 'structured_text_options', 'contents' => json_encode($options)],\n  ['name' => 'output', 'contents' => 'pdf_from_markdown'],\n];\n$response = (new Client())->post($apiUrl . '\u002Fpdf', ['headers' => ['Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'Accept' => 'application\u002Fjson'], 'multipart' => $multipart]);\necho $response->getBody();\n\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-markdown.php\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The sample uses Composer to load the Guzzle HTTP client and related utilities. When using this example outside the pdfRest API samples repository, install Guzzle with \u003Ccode>composer require guzzlehttp\u002Fguzzle\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>Client\u003C\u002Fcode> class sends the HTTP request, while \u003Ccode>Utils::tryFopen\u003C\u002Fcode> opens the local Markdown and image files for the multipart form.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\u003C\u002Fpre>\n\n\u003Cp>The API URL selects the US-based pdfRest service by default. An EU endpoint is included as a commented alternative when that service region is appropriate for your workflow.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$inputPath = '\u002Fpath\u002Fto\u002Fsample.md';\n$imagePath = '\u002Fpath\u002Fto\u002Flogo.png';\n$options = json_decode('{\"title\":\"Structured Content Sample\", ... }', true);\u003C\u002Fpre>\n\n\u003Cp>These values identify the Markdown source, local image file, and structured-text conversion options. The API determines that the source is Markdown from the uploaded file extension, so the options JSON does not need an \u003Ccode>input_format\u003C\u002Fcode> property.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>options\u003C\u002Fcode> array becomes the \u003Ccode>structured_text_options\u003C\u002Fcode> form field. It sets the PDF title and language, enables tagged output, configures the page, and applies typography and table styling. The table settings control relative column widths, repeated headers, borders, colors, padding, and alternating row fills for Markdown tables.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>markdown.image_sources\u003C\u002Fcode> configuration maps the Markdown image target \u003Ccode>sample-logo\u003C\u002Fcode> to the first uploaded image, represented by \u003Ccode>\"upload_index\": 0\u003C\u002Fcode>. The Markdown source should contain the same target, such as \u003Ccode>![Company logo](sample-logo)\u003C\u002Fcode>. The \u003Ccode>image_alt_text\u003C\u002Fcode> value supplies alternate text, while \u003Ccode>missing_image_alt_text\u003C\u002Fcode> is set to \u003Ccode>fail\u003C\u002Fcode> so that conversion stops if a meaningful image lacks alternate text.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$multipart = [\n  ['name' => 'file', 'contents' => Utils::tryFopen($inputPath, 'r'), 'filename' => basename($inputPath)],\n  ['name' => 'image_files', 'contents' => Utils::tryFopen($imagePath, 'r'), 'filename' => basename($imagePath)],\n  ['name' => 'structured_text_options', 'contents' => json_encode($options)],\n  ['name' => 'output', 'contents' => 'pdf_from_markdown'],\n];\u003C\u002Fpre>\n\n\u003Cp>The multipart array includes the Markdown source as \u003Ccode>file\u003C\u002Fcode>, the local image as \u003Ccode>image_files\u003C\u002Fcode>, and the JSON configuration as \u003Ccode>structured_text_options\u003C\u002Fcode>. The uploaded image is available to the Markdown conversion through its zero-based upload index. The \u003Ccode>output\u003C\u002Fcode> field sets the output filename for the generated PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$response = (new Client())->post($apiUrl . '\u002Fpdf', ['headers' => ['Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'Accept' => 'application\u002Fjson'], 'multipart' => $multipart]);\necho $response->getBody();\u003C\u002Fpre>\n\n\u003Cp>The request sends the multipart data to \u003Ccode>\u002Fpdf\u003C\u002Fcode> with the pdfRest API key and requests a JSON response. Replace the placeholder key with your own pdfRest API key. The response body contains the generated PDF resource details and download URL.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This example shows how a PHP application can create a polished, tagged PDF from Markdown while controlling document presentation and resolving a local image in the same request. Tagged output adds logical document structure that can support accessibility and downstream processing, but it does not by itself guarantee conformance with a specific accessibility standard.\u003C\u002Fp>\n\n\u003Cp>PHP implementations can keep the request compact by retaining only the Markdown presentation and asset settings their documents require. Explore those combinations in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, and verify the full contract in the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API documentation\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-08-28T21:53:26.000+00:00","Convert Markdown articles into styled, tagged PDFs with PHP, including table formatting and uploaded images.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-php\u002F#article\",\n      \"headline\": \"How to Convert Markdown to PDF with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-php\u002F\",\n      \"datePublished\": \"2026-08-28T21:53:26.000Z\",\n      \"dateModified\": \"2026-09-01T05:11:17.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert Markdown articles into styled, tagged PDFs with PHP, including table formatting and uploaded images.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, Markdown, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Markdown to PDF with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4790,4791,4792,4793,4794,4795,4796,4797],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1414,"name":1415,"slug":1416,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-markdown-to-pdf-with-php\u002F","How to Convert Markdown to PDF with PHP, Tutorial | pdfRest",{"id":4802,"uuid":4803,"title":4804,"slug":4805,"html":4806,"comment_id":4802,"feature_image":48,"featured":284,"visibility":1257,"created_at":4807,"updated_at":4808,"published_at":4807,"custom_excerpt":4809,"codeinjection_head":4810,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4811,"primary_tag":4820,"url":4821,"excerpt":4809,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4822,"meta_description":4809,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a920134533c9f26b943ac4c","1b73a9ce-dab9-417c-ac53-75bbcde87821","How to Convert Markdown to PDF with Python","how-to-convert-markdown-to-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This Python example converts Markdown to PDF through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. It uploads the source and an image, applies structured page and table settings, and requests tagged output for a complete automated report workflow.\u003C\u002Fp>\n\n\u003Ch2>Why Convert Markdown to PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>Python programs regularly produce Markdown summaries from analytics, testing, and data-processing jobs. Markdown is convenient for assembling headings, findings, code, and tables, but decision-makers often want a PDF that can be reviewed, annotated, and distributed as a finished report.\u003C\u002Fp>\n\n\u003Cp>A model-evaluation pipeline, for instance, can write its metrics and observations to Markdown, include a comparison table, and save a generated chart. A Python step can submit the report and chart to pdfRest, map the image reference, and return a styled PDF for the project record. Analysts keep an easy-to-generate source format while stakeholders receive a familiar document.\u003C\u002Fp>\n\n\u003Cp>The request also demonstrates how automation can enforce consistent margins, fonts, colors, table behavior, language metadata, alternate text, and tagging across every run. That consistency is difficult to achieve with ad hoc Markdown print commands and requires no separate HTML conversion stage.\u003C\u002Fp>\n\n\u003Ch2>Python Code Example for Converting Markdown to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">import json\nimport os\nimport requests\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# This sample converts Markdown input to a tagged PDF through multipart \u002Fpdf.\n# It demonstrates structured_text_options, table styling, tagging, and uploaded Markdown image mapping.\ninput_path = \"\u002Fpath\u002Fto\u002Fsample.md\"\nimage_path = \"\u002Fpath\u002Fto\u002Flogo.png\"\noptions = json.loads(r'''{\n  \"title\": \"Structured Content Sample\",\n  \"language\": \"en-US\",\n  \"enable_tagging\": true,\n  \"page_setup\": {\n    \"size\": \"Letter\",\n    \"orientation\": \"portrait\",\n    \"margin\": {\n      \"top\": 36,\n      \"right\": 42,\n      \"bottom\": 36,\n      \"left\": 42\n    }\n  },\n  \"style\": {\n    \"font\": \"Arial\",\n    \"heading_font\": \"Arial\",\n    \"code_font\": \"Courier\",\n    \"text_size\": 11,\n    \"text_color_rgb\": [\n      34,\n      34,\n      34\n    ],\n    \"heading_scale\": 1.35,\n    \"table\": {\n      \"column_width_weights\": [\n        2,\n        3,\n        2\n      ],\n      \"keep_header_with_first_row\": true,\n      \"repeat_headers_on_overflow\": true,\n      \"show_borders\": true,\n      \"border_width\": 0.75,\n      \"border_color_rgb\": [\n        180,\n        188,\n        200\n      ],\n      \"header_fill_color_rgb\": [\n        33,\n        64,\n        98\n      ],\n      \"header_text_color_rgb\": [\n        255,\n        255,\n        255\n      ],\n      \"row_fill_color_rgb\": [\n        250,\n        250,\n        252\n      ],\n      \"alternate_row_fill_color_rgb\": [\n        235,\n        240,\n        246\n      ],\n      \"cell_padding\": {\n        \"top\": 6,\n        \"right\": 8,\n        \"bottom\": 6,\n        \"left\": 8\n      }\n    }\n  },\n  \"markdown\": {\n    \"image_alt_text\": {\n      \"sample-logo\": \"Sample logo\"\n    },\n    \"missing_image_alt_text\": \"fail\",\n    \"image_sources\": {\n      \"sample-logo\": {\n        \"upload_index\": 0\n      }\n    }\n  }\n}''')\n\nfrom requests_toolbelt import MultipartEncoder\nwith open(input_path, \"rb\") as input_file, open(image_path, \"rb\") as image_file:\n    fields = {\n        \"file\": (os.path.basename(input_path), input_file, \"text\u002Fplain\"),\n        \"structured_text_options\": json.dumps(options),\n        \"image_files\": (os.path.basename(image_path), image_file, \"image\u002Fpng\"),\n    }\n    form = MultipartEncoder(fields=fields)\n    response = requests.post(api_url + \"\u002Fpdf\", data=form, headers={\n        \"Accept\": \"application\u002Fjson\",\n        \"Content-Type\": form.content_type,\n        \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    })\n\nprint(\"Response status code: \" + str(response.status_code))\nif response.ok:\n    print(json.dumps(response.json(), indent=2))\nelse:\n    print(response.text)\n    raise SystemExit(1)\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-markdown.py\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The sample uses Python's built-in \u003Ccode>json\u003C\u002Fcode> and \u003Ccode>os\u003C\u002Fcode> modules, the \u003Ccode>requests\u003C\u002Fcode> HTTP library, and \u003Ccode>MultipartEncoder\u003C\u002Fcode> from \u003Ccode>requests-toolbelt\u003C\u002Fcode>. When using this example outside the pdfRest API samples repository, install its dependencies with \u003Ccode>python -m pip install requests requests-toolbelt\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">api_url = \"https:\u002F\u002Fapi.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>api_url\u003C\u002Fcode> value selects the US-based pdfRest service by default. An EU endpoint is included as a commented alternative when that service region is appropriate for your workflow.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">input_path = \"\u002Fpath\u002Fto\u002Fsample.md\"\nimage_path = \"\u002Fpath\u002Fto\u002Flogo.png\"\noptions = json.loads(r'''{\n  \"title\": \"Structured Content Sample\",\n  \"language\": \"en-US\",\n  ...\n}''')\u003C\u002Fpre>\n\n\u003Cp>These values identify the Markdown source, local image file, and structured-text conversion options. The API determines that the source is Markdown from the uploaded file extension, so the options object does not need an \u003Ccode>input_format\u003C\u002Fcode> property.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>options\u003C\u002Fcode> object becomes the \u003Ccode>structured_text_options\u003C\u002Fcode> form field. It sets the PDF title and language, enables tagged output, configures the page, and applies typography and table styling. The table settings control relative column widths, repeated headers, borders, colors, padding, and alternating row fills for Markdown tables.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>markdown.image_sources\u003C\u002Fcode> configuration maps the Markdown image target \u003Ccode>sample-logo\u003C\u002Fcode> to the first uploaded image, represented by \u003Ccode>\"upload_index\": 0\u003C\u002Fcode>. The Markdown source should contain the same target, such as \u003Ccode>![Company logo](sample-logo)\u003C\u002Fcode>. The \u003Ccode>image_alt_text\u003C\u002Fcode> value supplies alternate text, while \u003Ccode>missing_image_alt_text\u003C\u002Fcode> is set to \u003Ccode>fail\u003C\u002Fcode> so that conversion stops if a meaningful image lacks alternate text.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">fields = {\n    \"file\": (os.path.basename(input_path), input_file, \"text\u002Fplain\"),\n    \"structured_text_options\": json.dumps(options),\n    \"image_files\": (os.path.basename(image_path), image_file, \"image\u002Fpng\"),\n}\u003C\u002Fpre>\n\n\u003Cp>The multipart fields include the Markdown source as \u003Ccode>file\u003C\u002Fcode>, the JSON configuration as \u003Ccode>structured_text_options\u003C\u002Fcode>, and the local image as \u003Ccode>image_files\u003C\u002Fcode>. The uploaded image is available to the Markdown conversion through its zero-based upload index.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">form = MultipartEncoder(fields=fields)\nresponse = requests.post(api_url + \"\u002Fpdf\", data=form, headers={\n    \"Accept\": \"application\u002Fjson\",\n    \"Content-Type\": form.content_type,\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n})\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>MultipartEncoder\u003C\u002Fcode> prepares the multipart request and supplies the required \u003Ccode>Content-Type\u003C\u002Fcode> header, including its boundary. The \u003Ccode>requests.post\u003C\u002Fcode> call sends the request to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. Replace the placeholder \u003Ccode>Api-Key\u003C\u002Fcode> value with your own pdfRest API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    print(json.dumps(response.json(), indent=2))\nelse:\n    print(response.text)\n    raise SystemExit(1)\u003C\u002Fpre>\n\n\u003Cp>The response status code is printed first. On success, the script formats and prints the JSON response, which includes the generated PDF resource details and download URL. On failure, it prints the API error and exits with a nonzero status.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This example shows how a Python application can create a polished, tagged PDF from Markdown while controlling document presentation and resolving a local image in the same request. Tagged output adds logical document structure that can support accessibility and downstream processing, but it does not by itself guarantee conformance with a specific accessibility standard.\u003C\u002Fp>\n\n\u003Cp>Python automation can simplify this profile whenever its Markdown does not contain mapped images, styled tables, or other optional features. Compare request variations with \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, and find all supported settings in the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF documentation\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-08-28T21:44:20.000+00:00","2026-09-02T18:27:21.000+00:00","Turn Markdown reports into styled, tagged PDFs with Python, including tables and explicitly mapped images.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Convert Markdown to PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-python\u002F\",\n      \"datePublished\": \"2026-08-28T21:44:20.000Z\",\n      \"dateModified\": \"2026-09-01T05:11:17.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Turn Markdown reports into styled, tagged PDFs with Python, including tables and explicitly mapped images.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, Markdown, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Markdown to PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-markdown-to-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4812,4813,4814,4815,4816,4817,4818,4819],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1414,"name":1415,"slug":1416,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-markdown-to-pdf-with-python\u002F","How to Convert Markdown to PDF with Python, Tutorial | pdfRest",{"id":4824,"uuid":4825,"title":4826,"slug":4827,"html":4828,"comment_id":4824,"feature_image":48,"featured":284,"visibility":1257,"created_at":4829,"updated_at":4808,"published_at":4829,"custom_excerpt":4830,"codeinjection_head":4831,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4832,"primary_tag":4839,"url":4840,"excerpt":4830,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4841,"meta_description":4830,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65c50e2f533c9f26b94360f0","bb246ae5-547e-40bb-b96f-ec33bd437a7d","How to Convert Microsoft Excel to PDF in .NET with C#","how-to-convert-microsoft-excel-to-pdf-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert Excel to PDF with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> is a powerful resource for developers who need to programmatically convert Excel spreadsheets and other file types to PDF. This API provides a simple way to create PDFs from different source formats, which can be crucial for businesses that need to standardize documentation, such as converting invoices, reports, or user manuals to a more accessible and secure format. This tutorial will guide you through the process of sending an API call to Convert to PDF using C#.\u003C\u002Fp>\n\n\u003Cp>For instance, imagine you are developing an application that allows users to upload documents in various formats, and you need to ensure all documents are stored in a uniform PDF format for ease of distribution and printing. The pdfRest API makes this conversion process seamless and efficient.\u003C\u002Fp>\n\n\u003Ch2>Convert Excel to PDF with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.xlsx\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name.xlsx\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fvnd.ms-excel\");\n\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"output.pdf\"));\n        multipartContent.Add(byteArrayOption, \"output\");\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.cs\">GitHub - datalogics\u002Fpdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code above creates a new HTTP client with the base address set to the pdfRest API. It then constructs a POST request to the \"\u002Fpdf\" endpoint:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf\"))\n    {\n        \u002F\u002F...\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>The 'Api-Key' header is added without validation, and the 'Accept' header is set to expect a JSON response:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\nrequest.Headers.Accept.Add(new(\"application\u002Fjson\"));\n\u003C\u002Fpre>\n\n\u003Cp>A multipart form data content is created to hold the file and options for conversion:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n\u003C\u002Fpre>\n\n\u003Cp>The file to be converted is read as a byte array and added to the multipart content with the appropriate content type:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.xlsx\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name.xlsx\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fvnd.ms-excel\");\n\u003C\u002Fpre>\n\n\u003Cp>Additional options, such as 'output' (the output file name), are also added to the request:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">\n\nvar byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"output.pdf\"));\nmultipartContent.Add(byteArrayOption, \"output\");\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the request is sent, and the response is read as a string:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Content = multipartContent;\nvar response = await httpClient.SendAsync(request);\nvar apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've successfully made an API call to the pdfRest Convert to PDF tool using C#. The code sends an Excel file to the API, which then converts it to a PDF and returns the result. This can be a significant step in automating document workflows within your applications.\u003C\u002Fp>\n\n\u003Cp>To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information on the API, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.cs\">GitHub - datalogics\u002Fpdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-08T17:23:59.000+00:00","Learn how to Convert Microsoft Excel to PDF in .NET with C# by Calling Convert to PDF API Tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert Microsoft Excel to PDF in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-02-08T17:23:59.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:52.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to Convert Microsoft Excel to PDF in .NET with C# by Calling Convert to PDF API Tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Convert to PDF, Excel, Microsoft Office\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Microsoft Excel to PDF in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4833,4834,4835,4836,4837,4838],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1649,"name":1650,"slug":1651,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-microsoft-excel-to-pdf-in-net-with-c\u002F","How to Convert Microsoft Excel to PDF in .NET with C#, Tutorial | pdfRest",{"id":4843,"uuid":4844,"title":4845,"slug":4846,"html":4847,"comment_id":4843,"feature_image":48,"featured":284,"visibility":1257,"created_at":4848,"updated_at":4808,"published_at":4848,"custom_excerpt":4849,"codeinjection_head":4850,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4851,"primary_tag":4858,"url":4859,"excerpt":4849,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4860,"meta_description":4849,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65fdfcae533c9f26b9436c9c","7dda5cbd-649c-48d6-b75c-c362a4267569","How to Convert Microsoft Excel to PDF with cURL","how-to-convert-microsoft-excel-to-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert Excel to PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> offers a simple yet powerful way to programmatically convert various file formats into PDFs. This tutorial will guide you through the process of using cURL, a command-line tool for making HTTP requests, to send an API call to the Convert to PDF endpoint provided by pdfRest. Utilizing cURL for API interactions is common due to its availability on most Unix-based systems, including Linux and macOS, and its ability to handle complex HTTP requests with ease.\u003C\u002Fp>\n\n\u003Cp>A business might need to convert batches of Excel invoices or reports into PDFs for archival purposes. The Convert to PDF API makes this process seamless and can be integrated into automated workflows, saving time and ensuring consistency in document formats across an organization.\u003C\u002Fp>\n\n\u003Ch2>Convert Excel to PDF with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile.xlsx\" \\\n  -F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>Reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.sh\">pdfRest cURL code example\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided cURL command is structured to send a POST request to the pdfRest Convert to PDF API. Here's what each part of the command does:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf\"\n\u003C\u002Fpre>\n\n\u003Cp>This specifies that the HTTP request is a POST method, which is required to send data to the server for the conversion process.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\n\u003C\u002Fpre>\n\n\u003Cp>This header tells the server that the client expects a response in JSON format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\n\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the data being sent in the request is in multipart form-data format, which is necessary for uploading files.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>This header provides your unique API key for authentication with the pdfRest service. Replace the placeholder with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile.xlsx\"\n\u003C\u002Fpre>\n\n\u003Cp>The -F flag is used to specify each field that will be sent with the request. In this case, it's the file that you want to convert. The \"@\" symbol tells cURL to get the file data from the specified path on your filesystem.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>This field specifies the name of the output file (without the .pdf extension) that will be generated by the API.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the tutorial above, you've learned how to make a multipart API call to the pdfRest Convert to PDF endpoint using cURL. This enables you to integrate Excel to PDF conversion into your applications and scripts, automating the process and improving efficiency. To further explore the capabilities of pdfRest and demo all of the API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information on the API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.sh\">pdfRest JSON payload code examples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-22T21:48:30.000+00:00","Learn how to convert Excel spreadsheets to PDF files with pdfRest Convert to PDF API Tool using cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Convert Microsoft Excel to PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-curl\u002F\",\n      \"datePublished\": \"2024-03-22T21:48:30.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:37.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert Excel spreadsheets to PDF files with pdfRest Convert to PDF API Tool using cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF, Excel, Microsoft Office, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Microsoft Excel to PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4852,4853,4854,4855,4856,4857],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1649,"name":1650,"slug":1651,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-microsoft-excel-to-pdf-with-curl\u002F","How to Convert Microsoft Excel to PDF with cURL, Tutorial | pdfRest",{"id":4862,"uuid":4863,"title":4864,"slug":4865,"html":4866,"comment_id":4862,"feature_image":48,"featured":284,"visibility":1257,"created_at":4867,"updated_at":4868,"published_at":3788,"custom_excerpt":4869,"codeinjection_head":4870,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4871,"primary_tag":4878,"url":4879,"excerpt":4869,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4880,"meta_description":4869,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c57533c9f26b943b4a8","c40969ae-a81e-4f22-9142-edf30cc1ca0f","How to Convert Microsoft Excel to PDF with Java","how-to-convert-microsoft-excel-to-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This step-by-step tutorial explains how a Java application can convert Microsoft Excel to PDF through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool\u003C\u002Fa>. The sample sends an XLSX workbook through the common \u003Ccode>\u002Fpdf\u003C\u002Fcode> endpoint and captures the resulting fixed-layout document resource for downstream review. After reviewing the example, you'll be ready to convert Microsoft Excel to PDF with your own input.\u003C\u002Fp>\n\n\u003Ch2>Why Convert Microsoft Excel to PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>A finance service may distribute a monthly workbook to reviewers who should see a stable report rather than editable formulas and worksheets. PDF conversion preserves a consistent presentation for approval and sharing.\u003C\u002Fp>\n\n\u003Cp>The adapted Java request uploads an \u003Ccode>.xlsx\u003C\u002Fcode> file with the Office Open XML spreadsheet media type. Convert to PDF identifies the workbook from its multipart filename and processes it through the shared \u003Ccode>\u002Fpdf\u003C\u002Fcode> endpoint.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class ConvertExcelToPDF {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.xlsx\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fvnd.openxmlformats-officedocument.spreadsheetml.sheet\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_excel_to_pdf\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPDF.java\">Java sample on GitHub\u003C\u002Fa>. The code is adapted from the repository's general example to demonstrate Convert Microsoft Excel to PDF specifically.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The sample uses OkHttp for transport, dotenv for loading \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode>, and \u003Ccode>org.json\u003C\u002Fcode> for structured request or response data.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.xlsx\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>The configuration block separates file selection from authentication so either value can change without rewriting the request.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fvnd.openxmlformats-officedocument.spreadsheetml.sheet\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_excel_to_pdf\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The adapted Java request uploads an \u003Ccode>.xlsx\u003C\u002Fcode> file with the Office Open XML spreadsheet media type. Convert to PDF identifies the workbook from its multipart filename and processes it through the shared \u003Ccode>\u002Fpdf\u003C\u002Fcode> endpoint. The form-data setup uses the form multipart type required for combining uploaded content with operation parameters.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The client request ties the body to its endpoint and applies the required \u003Ccode>Api-Key\u003C\u002Fcode> header before OkHttp sends it.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>The response check uses both status and body to distinguish a successful resource from validation or processing failures.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>The completed example gives you a practical Java starting point for learning how to convert Microsoft Excel to PDF. With that foundation, this workflow suits financial reports, inventory exports, schedules, and operational spreadsheets that need a dependable review copy.\u003C\u002Fp>\n\n\u003Cp>As you apply the pattern to real documents, keep in mind that workbook print areas, page breaks, fonts, and wide worksheets all influence the fixed PDF presentation. Test realistic workbooks rather than a single simple sheet, and review pagination before distributing the result as an approved report or record.\u003C\u002Fp>\n\n\u003Cp>Before integrating this workflow, test representative documents with the Convert Microsoft Excel to PDF operation in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. Then use the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool documentation\u003C\u002Fa> to review every available parameter and response field.\u003C\u002Fp>\n\n\u003Cp>Note: The Convert Microsoft Excel to PDF example above uses multipart form data; to reuse a resource ID, compare the multipart call with the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPDF.java\">JSON payload example\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T17:33:11.000+00:00","2026-09-02T18:27:22.000+00:00","Convert Excel workbooks to fixed-layout PDF documents with Java.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Convert Microsoft Excel to PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:32.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:32.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert Excel workbooks to fixed-layout PDF documents with Java.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF, Excel, Java, Microsoft Office\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Microsoft Excel to PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4872,4873,4874,4875,4876,4877],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1649,"name":1650,"slug":1651,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-microsoft-excel-to-pdf-with-java\u002F","Convert Microsoft Excel to PDF with Java | pdfRest",{"id":4882,"uuid":4883,"title":4884,"slug":4885,"html":4886,"comment_id":4882,"feature_image":48,"featured":284,"visibility":1257,"created_at":4887,"updated_at":4868,"published_at":4887,"custom_excerpt":4888,"codeinjection_head":4889,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4890,"primary_tag":4897,"url":4898,"excerpt":4888,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4899,"meta_description":4888,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"661e9e97533c9f26b9437184","b157556f-c9da-4980-9a1e-a0e3f3cf8257","How to Convert Microsoft Excel to PDF with JavaScript in NodeJS","how-to-convert-microsoft-excel-to-pdf-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert Excel to PDF with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to automate the process of converting Excel spreadsheets into PDFs. This API tool is particularly useful when you need to ensure that documents are in a standardized format for distribution, storage, or printing. In this tutorial, we will demonstrate how to send an API call to Convert to PDF using JavaScript, which is a common language for web-based applications and server-side scripting.\u003C\u002Fp>\n\n\u003Cp>Imagine you are running an online service where users upload documents in different formats, such as Word, Excel, or images, and you need to convert these documents into PDFs before sending them to other users or storing them securely. Using JavaScript to call the Convert to PDF API, you can seamlessly integrate this functionality into your application, providing a smooth user experience and reliable document handling.\u003C\u002Fp>\n\n\u003Ch2>Convert Excel to PDF with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile.xlsx'));\ndata.append('compression', 'lossy'); \ndata.append('downsample', '300'); \ndata.append('tagged_pdf', 'off'); \ndata.append('output', 'pdfrest_pdf');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Reference to the code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.js\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided code snippet is a JavaScript example that uses the Axios library to make an HTTP POST request to the pdfRest Convert to PDF API endpoint. Here's a breakdown of the key components:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile.xlsx'));\ndata.append('compression', 'lossy');\ndata.append('downsample', '300');\ndata.append('tagged_pdf', 'off');\ndata.append('output', 'pdfrest_pdf');\n\u003C\u002Fpre>\n\n\u003Cp>This section creates a new FormData object and appends the file to be converted along with various conversion parameters:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Ccode>file\u003C\u002Fcode>: The file stream of the document you want to convert.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>compression\u003C\u002Fcode>: The type of compression to apply to the PDF ('lossy' or 'lossless').\u003C\u002Fli>\n  \u003Cli>\u003Ccode>downsample\u003C\u002Fcode>: The DPI to which images should be downsampled.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>tagged_pdf\u003C\u002Fcode>: Whether to create a tagged PDF ('on' or 'off').\u003C\u002Fli>\n  \u003Cli>\u003Ccode>output\u003C\u002Fcode>: The name of the output parameter, which is set to 'pdfrest_pdf'.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf',\n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\n\u003C\u002Fpre>\n\n\u003Cp>This config object contains the settings for the Axios request:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Ccode>method\u003C\u002Fcode>: The HTTP method, which is 'post' for this API call.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>maxBodyLength\u003C\u002Fcode>: Allows the request body to be of any size by setting it to Infinity.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>url\u003C\u002Fcode>: The API endpoint URL.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>headers\u003C\u002Fcode>: Contains the API key for authentication and the headers from FormData.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>data\u003C\u002Fcode>: The FormData object containing the file and parameters.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>The Axios request is sent, and the response or error is handled in the subsequent \u003Ccode>then\u003C\u002Fcode> and \u003Ccode>catch\u003C\u002Fcode> blocks.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you've learned how to use JavaScript to call the pdfRest Convert to PDF API, which allows for the conversion of various file formats to PDF. This is a practical tool for any developer looking to integrate document conversion features into their applications.\u003C\u002Fp>\n\n\u003Cp>Demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for more detailed information on how to use the API.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.js\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-04-16T15:51:51.000+00:00","Learn how to use pdfRest Convert to PDF API Tool to convert Excel spreadsheets to PDF documents with JavaScript","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert Microsoft Excel to PDF with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-04-16T15:51:51.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:32.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Convert to PDF API Tool to convert Excel spreadsheets to PDF documents with JavaScript\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF, Excel, JavaScript, Microsoft Office\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Microsoft Excel to PDF with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4891,4892,4893,4894,4895,4896],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1649,"name":1650,"slug":1651,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-microsoft-excel-to-pdf-with-javascript-in-nodejs\u002F","How to Convert Microsoft Excel to PDF with JavaScript in NodeJS, Tutorial | pdfRest",{"id":4901,"uuid":4902,"title":4903,"slug":4904,"html":4905,"comment_id":4901,"feature_image":48,"featured":284,"visibility":1257,"created_at":4906,"updated_at":4907,"published_at":4906,"custom_excerpt":4908,"codeinjection_head":4909,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4910,"primary_tag":4917,"url":4918,"excerpt":4908,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4919,"meta_description":4908,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"661e9ef0533c9f26b943718e","1c1d74a7-ef5c-470b-bc2e-93d6a93402f3","How to Convert Microsoft Excel to PDF with PHP","how-to-convert-microsoft-excel-to-pdf-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert Excel to PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> allows developers to easily convert Excel spreadsheets into PDF format using a simple API call. This tool is particularly useful when you need to standardize documents in a universally accessible format, ensuring compatibility across different systems and devices. This tutorial will demonstrate how to send an API call to Convert to PDF using PHP, which is a widely-used server-side scripting language that is especially suited for web development and can be embedded into HTML.\u003C\u002Fp>\n\n\u003Cp>You might need to convert Excel files to PDF for archival, sharing, or printing purposes. For instance, a business might need to convert invoices, reports, or contracts to PDF to ensure that they can be easily viewed and remain unaltered when sent to clients or partners. By using the Convert to PDF API, the conversion process can be automated and integrated into existing PHP applications, streamlining the workflow and saving time.\u003C\u002Fp>\n\n\u003Ch2>Convert Excel to PDF with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">\nrequire 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile.xlsx', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile.xlsx',\n      'headers' => [\n        'Content-Type' => '\u003CContent-type header>'\n      ]\n    ],\n    [\n      'name' => 'compression',\n      'contents' => 'lossless'\n    ],\n    [\n      'name' => 'downsample',\n      'contents' => '300'\n    ],\n    [\n      'name' => 'tagged_pdf',\n      'contents' => 'off'\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_pdf'\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\n\u003C\u002Fpre>\n\n\u003Cp>This code is sourced from the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.php\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by loading the required libraries and setting up the Guzzle HTTP client, which is a PHP HTTP client that makes it easy to send HTTP requests and integrate with web services.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n$client = new Client();\n\u003C\u002Fpre>\n\n\u003Cp>Next, the API key is set in the headers for authentication purposes:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The options array is constructed with the 'multipart' key, which contains the details of the file to be converted and the conversion options:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$options = [\n  \u002F\u002F ...multipart form data...\n];\n\u003C\u002Fpre>\n\n\u003Cp>Each element of the 'multipart' array represents a different part of the form data being sent. The 'file' part includes the file contents and the Content-Type header, while the other parts include options such as 'compression', 'downsample', 'tagged_pdf', and 'output', which correspond to the conversion settings.\u003C\u002Fp>\n\n\u003Cp>The request is then created and sent asynchronously:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', $headers);\n$res = $client->sendAsync($request, $options)->wait();\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the response body is echoed, which contains the processed PDF content.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've successfully made an API call to the pdfRest Convert to PDF API using PHP. The code provided sends a file along with conversion options to pdfRest, and the API returns the converted PDF. This process can be integrated into larger PHP applications to automate the conversion of documents to PDF format.\u003C\u002Fp>\n\n\u003Cp>To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information on the API and its capabilities, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.php\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-04-16T15:53:20.000+00:00","2026-09-02T18:27:23.000+00:00","Learn how to convert Excel spreadsheets to PDF documents with pdfRest Convert to PDF API Tool using PHP","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-php\u002F#article\",\n      \"headline\": \"How to Convert Microsoft Excel to PDF with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-php\u002F\",\n      \"datePublished\": \"2024-04-16T15:53:20.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:32.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert Excel spreadsheets to PDF documents with pdfRest Convert to PDF API Tool using PHP\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF, Excel, Microsoft Office, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Microsoft Excel to PDF with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4911,4912,4913,4914,4915,4916],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1649,"name":1650,"slug":1651,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-microsoft-excel-to-pdf-with-php\u002F","How to Convert Microsoft Excel to PDF with PHP, Tutorial | pdfRest",{"id":4921,"uuid":4922,"title":4923,"slug":4924,"html":4925,"comment_id":4921,"feature_image":48,"featured":284,"visibility":1257,"created_at":4926,"updated_at":4907,"published_at":4926,"custom_excerpt":4927,"codeinjection_head":4928,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4929,"primary_tag":4936,"url":4937,"excerpt":4927,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4938,"meta_description":4927,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"661e9fe0533c9f26b9437198","534293fc-648c-4369-9f82-2c4ed5d9d905","How to Convert Microsoft Excel to PDF with Python","how-to-convert-microsoft-excel-to-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert Excel to PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> is a powerful resource for developers who need to automate the conversion of documents to PDF format. This tool allows for easy integration with Python applications, enabling the conversion of Excel spreadsheets and other file types to PDF with a simple API call. In this tutorial, we will demonstrate how to send an API call to Convert to PDF with Python, showcasing the ease with which document conversion can be implemented in your projects.\u003C\u002Fp>\n\n\u003Cp>Imagine a scenario where a business needs to convert batches of invoices, originally in Excel format, into PDFs for archival purposes. Using the Convert to PDF API, the business can automate this process, ensuring that all documents are standardized and easily accessible for future reference. This is just one example of the practical applications of the Convert to PDF API in real-world situations.\u003C\u002Fp>\n\n\u003Ch2>Convert Excel to PDF with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\npdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf'\n\nmp_encoder_pdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.tif', open('\u002Fpath\u002Fto\u002Ffile.xlsx', 'rb'), 'application\u002Fms-excel'),\n        'output' : 'example_pdf_out',\n    }\n)\n\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\n\nprint(\"Sending POST request to pdf endpoint...\")\nresponse = requests.post(pdf_endpoint_url, data=mp_encoder_pdf, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>The source of the provided code is available on \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.py\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided Python code demonstrates how to make a multipart API call to the pdfRest Convert to PDF endpoint. Here's a breakdown of the key components:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_pdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.tif', open('\u002Fpath\u002Fto\u002Ffile.xlsx', 'rb'), 'application\u002Fms-excel'),\n        'output' : 'example_pdf_out',\n    }\n)\u003C\u002Fpre>\n\n\u003Cp>This snippet creates a \u003Ccode>MultipartEncoder\u003C\u002Fcode> object with two fields: the file to convert and the desired output filename. The 'file' field includes the file name, the file object opened in binary read mode, and the MIME type 'application\u002Fms-excel'.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\u003C\u002Fpre>\n\n\u003Cp>The headers dictionary sets the expected response format to JSON, the content type to 'multipart\u002Fform-data', and includes the user's API key for authentication.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(pdf_endpoint_url, data=mp_encoder_pdf, headers=headers)\u003C\u002Fpre>\n\n\u003Cp>This line sends the POST request to the pdfRest API endpoint with the encoded data and headers.\u003C\u002Fp>\n\n\u003Cp>Upon receiving a successful response, the code prints the JSON response. If the request fails, it prints the error text.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we have learned how to use Python to call the pdfRest Convert to PDF API to convert an Excel file to a PDF. The code demonstrates handling file uploads, setting appropriate headers, and processing the API response. This example can be adapted for various file types and use cases where automated PDF conversion is necessary.\u003C\u002Fp>\n\n\u003Cp>Explore and demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for more details on how to use the service.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.py\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-04-16T15:57:20.000+00:00","Learn how to convert Excel spreadsheets to PDF files with pdfRest Convert to PDF API Tool using Python","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Convert Microsoft Excel to PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-python\u002F\",\n      \"datePublished\": \"2024-04-16T15:57:20.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:32.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert Excel spreadsheets to PDF files with pdfRest Convert to PDF API Tool using Python\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF, Excel, Microsoft Office, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Microsoft Excel to PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-excel-to-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4930,4931,4932,4933,4934,4935],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1649,"name":1650,"slug":1651,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-microsoft-excel-to-pdf-with-python\u002F","How to Convert Microsoft Excel to PDF with Python, Tutorial | pdfRest",{"id":4940,"uuid":4941,"title":4942,"slug":4943,"html":4944,"comment_id":4940,"feature_image":48,"featured":284,"visibility":1257,"created_at":4945,"updated_at":4946,"published_at":4945,"custom_excerpt":4947,"codeinjection_head":4948,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4949,"primary_tag":4956,"url":4957,"excerpt":4947,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4958,"meta_description":4947,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65c50f4e533c9f26b94360fa","c1e845db-e800-4225-9950-ffba35e86f9e","How to Convert Microsoft PowerPoint to PDF in .NET with C#","how-to-convert-microsoft-powerpoint-to-pdf-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Convert to PDF with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> offers a straightforward way to convert various document formats to PDF. This tutorial will guide you through the process of sending an API call to Convert to PDF using C#. \u003C\u002Fp>\n  \n  \u003Cp>This functionality is particularly useful in scenarios where you need to standardize document formats for archiving, sharing, or printing. For instance, you might want to convert user-uploaded documents into PDFs before storing them on a server to ensure compatibility across different platforms and devices.\u003C\u002Fp>\n\n\u003Ch2>Convert to PDF with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile_name.pptx\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name.pptx\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fvnd.openxmlformats-officedocument.presentationml.presentation\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"output.pdf\"));\n        multipartContent.Add(byteArrayOption, \"output\");\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.cs\">pdfRest API Samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This code snippet demonstrates how to make a multipart\u002Fform-data POST request to the pdfRest Convert to PDF API endpoint using C#:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>This line initializes a new instance of the HttpClient class with the base address set to the pdfRest API endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>Here, we add the API key to the request headers. Replace the placeholder with your actual pdfRest API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n\u003C\u002Fpre>\n\n\u003Cp>This line creates a new instance of MultipartFormDataContent, which allows us to send files and data in the same request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile_name.pptx\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name.pptx\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fvnd.openxmlformats-officedocument.presentationml.presentation\");\n\u003C\u002Fpre>\n\n\u003Cp>This section reads the file you want to convert and adds it to the multipart content. The 'Content-Type' header is set based on the file format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"output.pdf\"));\nmultipartContent.Add(byteArrayOption, \"output\");\n\u003C\u002Fpre>\n\n\u003Cp>The 'output' parameter defines the name of the output PDF file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\n\u003C\u002Fpre>\n\n\u003Cp>This line sends the assembled request to the pdfRest API and waits for the response.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>Finally, this line reads the response content as a string, which you can then use as needed.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps outlined above, you've learned how to convert documents to PDF using the pdfRest API and C#. This is just one of the many features provided by pdfRest. You're encouraged to explore and demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information about the API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.cs\">pdfRest API Samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-08T17:28:46.000+00:00","2026-09-02T18:27:24.000+00:00","Learn how to Convert Microsoft PowerPoint to PDF in .NET with C# by Calling Convert to PDF API Tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert Microsoft PowerPoint to PDF in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-02-08T17:28:46.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:52.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to Convert Microsoft PowerPoint to PDF in .NET with C# by Calling Convert to PDF API Tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Convert to PDF, Microsoft Office, PowerPoint\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Microsoft PowerPoint to PDF in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4950,4951,4952,4953,4954,4955],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1657,"name":1658,"slug":1659,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-in-net-with-c\u002F","How to Convert Microsoft PowerPoint to PDF in .NET with C#, Tutorial | pdfRest",{"id":4960,"uuid":4961,"title":4962,"slug":4963,"html":4964,"comment_id":4960,"feature_image":48,"featured":284,"visibility":1257,"created_at":4965,"updated_at":4946,"published_at":4965,"custom_excerpt":4966,"codeinjection_head":4967,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4968,"primary_tag":4975,"url":4976,"excerpt":4966,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4977,"meta_description":4966,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65fdfc53533c9f26b9436c8d","539d5bab-170f-401f-8254-65a34dee36b8","How to Convert Microsoft PowerPoint to PDF with cURL","how-to-convert-microsoft-powerpoint-to-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PowerPoint to PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to automate the conversion of documents to PDF format. This tool can be accessed via an API endpoint, which allows for programmatic conversions of various file types to PDF. In this tutorial, we will demonstrate how to send an API call using cURL, a command-line tool used for making network requests, to convert a PowerPoint document to PDF using pdfRest's Convert to PDF API tool.\u003C\u002Fp>\n\n\u003Cp>A business might need to convert PowerPoint slides to PDF format for archival purposes. Using cURL to interact with the Convert to PDF API can streamline this process, enabling the business to integrate PDF conversion into their existing workflows and systems, thereby saving time and reducing the potential for human error.\u003C\u002Fp>\n\n\u003Ch2>Convert PowerPoint to PDF with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile.pptx\" \\\n  -F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>Reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.sh\">pdfRest cURL code sample\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided cURL command is used to make a POST request to the pdfRest Convert to PDF API endpoint. Let's break down what each part of the command does:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf\"\u003C\u002Fpre>\n\n\u003Cp>This specifies the HTTP method (POST) and the API endpoint URL.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\u003C\u002Fpre>\n\n\u003Cp>This header tells the server that the client expects a response in JSON format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the data being sent in the request is multipart form data, which is suitable for file uploads.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\u003C\u002Fpre>\n\n\u003Cp>This header includes the API key for authentication. Replace the placeholder with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile.pptx\"\u003C\u002Fpre>\n\n\u003Cp>This form field specifies the file to be converted. The '@' symbol is followed by the file path on your local system.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\u003C\u002Fpre>\n\n\u003Cp>This form field sets the name of the output file. The API will use this name for the converted PDF.\u003C\u002Fp>\n\n\u003Cp>For a more detailed explanation of each parameter and how to use the API, you can refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">pdfRest Cloud API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you have learned how to use cURL to make an API call to pdfRest's Convert to PDF API tool. This allows you to programmatically convert PowerPoint files to PDF format, which can be integrated into various applications and workflows. The possibilities are numerous, from automating document processing to creating a web service that converts user-uploaded documents to PDF.\u003C\u002Fp>\n\n\u003Cp>To explore more capabilities and experiment with the pdfRest API Tools, you can visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further guidance and documentation, the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> is an invaluable resource.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.sh\">pdfRest cURL JSON payload samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-22T21:46:59.000+00:00","Learn how to use pdfRest Convert to PDF API Tool to convert PowerPoint presentations to PDF files with cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Convert Microsoft PowerPoint to PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-curl\u002F\",\n      \"datePublished\": \"2024-03-22T21:46:59.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:37.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Convert to PDF API Tool to convert PowerPoint presentations to PDF files with cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF, Microsoft Office, PowerPoint, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Microsoft PowerPoint to PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4969,4970,4971,4972,4973,4974],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1657,"name":1658,"slug":1659,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-curl\u002F","How to Convert Microsoft PowerPoint to PDF with cURL, Tutorial | pdfRest",{"id":4979,"uuid":4980,"title":4981,"slug":4982,"html":4983,"comment_id":4979,"feature_image":48,"featured":284,"visibility":1257,"created_at":4867,"updated_at":4946,"published_at":4984,"custom_excerpt":4985,"codeinjection_head":4986,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":4987,"primary_tag":4994,"url":4995,"excerpt":4985,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":4996,"meta_description":4985,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c57533c9f26b943b4b3","ed91aa7d-c07d-41e9-8f88-60d1bedc42d3","How to Convert Microsoft PowerPoint to PDF with Java","how-to-convert-microsoft-powerpoint-to-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>By the end of this tutorial, you'll know how to convert Microsoft PowerPoint to PDF with Java and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool\u003C\u002Fa>. The walkthrough identifies the presentation through its filename and media type, requests PDF output, and reads the generated resource details without presentation software. We'll explain the important request pieces so you can use the sample as the foundation for an integration that can convert Microsoft PowerPoint to PDF.\u003C\u002Fp>\n\n\u003Ch2>Why Convert Microsoft PowerPoint to PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>A training portal may need to publish approved slides without requiring presentation software or exposing an editable deck. Converting the presentation creates a stable document for browser viewing and download.\u003C\u002Fp>\n\n\u003Cp>The adapted example sends a \u003Ccode>.pptx\u003C\u002Fcode> file with the PowerPoint Open XML media type. The output name is supplied separately, while the API response identifies the generated PDF resource.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class ConvertPowerPointToPDF {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pptx\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fvnd.openxmlformats-officedocument.presentationml.presentation\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_powerpoint_to_pdf\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPDF.java\">Java sample on GitHub\u003C\u002Fa>. For this tutorial, the general Java source has been tailored to the Convert Microsoft PowerPoint to PDF input or task.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The supporting code combines OkHttp networking with dotenv configuration and \u003Ccode>org.json\u003C\u002Fcode> processing.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pptx\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>This setup supports quick local testing while allowing normal callers to provide their own path and \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fvnd.openxmlformats-officedocument.presentationml.presentation\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_powerpoint_to_pdf\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The adapted example sends a \u003Ccode>.pptx\u003C\u002Fcode> file with the PowerPoint Open XML media type. The output name is supplied separately, while the API response identifies the generated PDF resource. The body construction collects the named parts before OkHttp calculates the final multipart header and body encoding.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>This builder chain adds the API key header, selects the operation URL, and attaches the prepared body; changing the base constant switches between US and EU service hosts.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>This completion path shows the raw outcome for learning purposes; production code can retain output IDs and branch on reported errors.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By working through this example, you now have a Java pattern you can use to convert Microsoft PowerPoint to PDF. With that foundation, you can apply the pattern to training decks, sales presentations, board materials, and presentation archives.\u003C\u002Fp>\n\n\u003Cp>When this becomes part of an application, keep in mind that pDF output represents a static document rather than an interactive presentation, so review slides that depend on animation, embedded media, uncommon fonts, or complex effects. Confirm slide order and visual fidelity before publishing the generated file to a portal or archive.\u003C\u002Fp>\n\n\u003Cp>\u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> lets you try the Convert Microsoft PowerPoint to PDF operation without first building an application. When you are ready to implement it, see the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool documentation\u003C\u002Fa> for the complete API contract.\u003C\u002Fp>\n\n\u003Cp>Note: The Convert Microsoft PowerPoint to PDF example above uses multipart form data; for callers that have already uploaded the source, review how the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPDF.java\">JSON payload example\u003C\u002Fa> constructs the request.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T21:57:33.000+00:00","Convert PowerPoint presentations into portable PDF files with Java.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Convert Microsoft PowerPoint to PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:33.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:33.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert PowerPoint presentations into portable PDF files with Java.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF, Java, Microsoft Office, PowerPoint\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Microsoft PowerPoint to PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[4988,4989,4990,4991,4992,4993],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1657,"name":1658,"slug":1659,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-java\u002F","Convert Microsoft PowerPoint to PDF with Java | pdfRest",{"id":4998,"uuid":4999,"title":5000,"slug":5001,"html":5002,"comment_id":4998,"feature_image":48,"featured":284,"visibility":1257,"created_at":5003,"updated_at":5004,"published_at":5003,"custom_excerpt":5005,"codeinjection_head":5006,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5007,"primary_tag":5014,"url":5015,"excerpt":5005,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5016,"meta_description":5005,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"66182c37533c9f26b9437091","ba55487a-23ce-4afa-9ed4-b2a931457d5e","How to Convert Microsoft PowerPoint to PDF with JavaScript in NodeJS","how-to-convert-microsoft-powerpoint-to-pdf-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PowerPoint to PDF with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> offers a seamless way to convert various file formats to PDF using simple API calls. This tutorial will demonstrate how to send an API call to Convert to PDF with JavaScript, which is particularly useful for web developers and anyone working in a JavaScript environment. By integrating this API, developers can automate the process of converting documents to PDF format, ensuring consistency and efficiency in document handling within their applications.\u003C\u002Fp>\n\n\u003Cp>Scenarios where Convert to PDF can be invaluable include generating presentations for wider distribution, archiving internal training materials, or creating client proposals with a polished look. For instance, a marketing team could use this API to convert their dynamic PowerPoint presentations into static PDFs before sending them to potential clients. This ensures the presentations maintain their formatting and visual elements across different devices, while also allowing for easy sharing and archiving.\u003C\u002Fp>\n\n\u003Ch2>Convert PowerPoint to PDF with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile.pptx'));\ndata.append('compression', 'lossy'); \ndata.append('downsample', '300'); \ndata.append('tagged_pdf', 'off'); \ndata.append('output', 'pdfrest_pdf');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source code reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.js\">GitHub - pdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code above uses the Axios library to perform an HTTP POST request to the pdfRest API. The FormData library is used to create a multipart\u002Fform-data payload, which is necessary for file uploads. Here's a breakdown of the key components:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile.pptx'));\ndata.append('compression', 'lossy'); \ndata.append('downsample', '300'); \ndata.append('tagged_pdf', 'off'); \ndata.append('output', 'pdfrest_pdf');\n\u003C\u002Fpre>\n\n\u003Cp>In this snippet, a new FormData object is created, and several fields are appended to it:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Ccode>'file'\u003C\u002Fcode>: This is the file input stream for the document you want to convert to PDF.\u003C\u002Fli>\n\u003Cli>\u003Ccode>'compression'\u003C\u002Fcode>: Specifies the type of compression to apply. 'lossy' allows for smaller file size at the potential cost of quality.\u003C\u002Fli>\n\u003Cli>\u003Ccode>'downsample'\u003C\u002Fcode>: Sets the resolution for images within the PDF. '300' is a common DPI value for high-quality prints.\u003C\u002Fli>\n\u003Cli>\u003Ccode>'tagged_pdf'\u003C\u002Fcode>: Determines whether to create a tagged PDF ('on') or not ('off'). Tagged PDFs support accessibility features.\u003C\u002Fli>\n\u003Cli>\u003Ccode>'output'\u003C\u002Fcode>: The name of the output parameter, 'pdfrest_pdf' in this case.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>These parameters are further explained in the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">pdfRest Cloud API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>config\u003C\u002Fcode> object sets up the request details, including the API endpoint URL, the headers (which include the API key for authentication), and the data payload. The spread operator (\u003Ccode>...\u003C\u002Fcode>) is used to include the headers from the FormData object.\u003C\u002Fp>\n\n\u003Cp>Finally, the Axios instance sends the request and handles the response with a promise, logging the result or any errors encountered.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following this tutorial, you've learned how to make a multipart API call to Convert to PDF using JavaScript. This allows you to integrate PDF conversion capabilities directly into your JavaScript applications, enhancing their functionality and user experience.\u003C\u002Fp>\n\n\u003Cp>To explore the full capabilities of pdfRest, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for more detailed information on the available endpoints and parameters.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.js\">GitHub - JSON payload examples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-04-11T18:30:15.000+00:00","2026-09-02T18:27:25.000+00:00","Learn how to convert PowerPoint presentation files to PDFs with pdfRest Convert to PDF API Tool using JavaScript","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert Microsoft PowerPoint to PDF with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-04-11T18:30:15.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:33.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert PowerPoint presentation files to PDFs with pdfRest Convert to PDF API Tool using JavaScript\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF, JavaScript, Microsoft Office, PowerPoint\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Microsoft PowerPoint to PDF with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5008,5009,5010,5011,5012,5013],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1657,"name":1658,"slug":1659,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-javascript-in-nodejs\u002F","How to Convert Microsoft PowerPoint to PDF with JavaScript in NodeJS, Tutorial | pdfRest",{"id":5018,"uuid":5019,"title":5020,"slug":5021,"html":5022,"comment_id":5018,"feature_image":48,"featured":284,"visibility":1257,"created_at":5023,"updated_at":5004,"published_at":5023,"custom_excerpt":5024,"codeinjection_head":5025,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5026,"primary_tag":5033,"url":5034,"excerpt":5024,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5035,"meta_description":5024,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"66182c88533c9f26b943709b","1f8fed8e-8e97-4d1c-b1b7-01da2094960a","How to Convert Microsoft PowerPoint to PDF with PHP","how-to-convert-microsoft-powerpoint-to-pdf-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PowerPoint to PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to automate the conversion of various file formats into PDFs. This tool is particularly useful when integrating PDF generation capabilities into web applications or services. By using this API, developers can programmatically convert files to PDF format without the need for manual intervention or desktop PDF software. This tutorial will demonstrate how to send an API call to Convert to PDF with PHP, leveraging the capabilities of the pdfRest API.\u003C\u002Fp>\n\n\u003Cp>Imagine you are running a document management system where users upload PowerPoint presentations. You want to ensure consistency and easy sharing across your platform. Using the Convert to PDF API, you can automatically convert these presentation files into PDFs as soon as they are uploaded. This creates a standardized format for all presentations, making them easy to share, archive, and print for users.\u003C\u002Fp>\n\n\u003Ch2>Convert PowerPoint to PDF with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">\nrequire 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile.pptx', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile.pptx',\n      'headers' => [\n        'Content-Type' => '\u003CContent-type header>'\n      ]\n    ],\n    [\n      'name' => 'compression',\n      'contents' => 'lossless'\n    ],\n    [\n      'name' => 'downsample',\n      'contents' => '300'\n    ],\n    [\n      'name' => 'tagged_pdf',\n      'contents' => 'off'\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_pdf'\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\n\u003C\u002Fpre>\n\n\u003Cp>Reference to the code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.php\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code above demonstrates how to make a multipart\u002Fform-data POST request to the pdfRest API to convert a file to PDF. Let's break down the key components:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\u003C\u002Fpre>\n\n\u003Cp>This section includes the necessary classes from the Guzzle HTTP client library, which is used to handle HTTP requests and responses.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The headers array contains the API key required for authentication with the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$options = [\n  'multipart' => [\n    \u002F\u002F File and other options here...\n  ]\n];\n\u003C\u002Fpre>\n\n\u003Cp>The options array is where you define the multipart payload for the request. It includes the file to be converted and additional parameters such as compression, downsample, and output options.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', $headers);\n\u003C\u002Fpre>\n\n\u003Cp>This line creates a new HTTP POST request with the specified API endpoint and headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$res = $client->sendAsync($request, $options)->wait();\necho $res->getBody();\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the request is sent asynchronously, and the script waits for the response. The response body, which should contain the processed PDF content, is then printed out.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you have learned how to use PHP to call the pdfRest Convert to PDF API, sending a file and additional options for conversion. This capability can be integrated into your applications to automate the process of converting files to PDF format, streamlining workflows and improving productivity.\u003C\u002Fp>\n\n\u003Cp>To further explore the capabilities of the pdfRest API, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For comprehensive documentation and more details on the API's functionality, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.php\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-04-11T18:31:36.000+00:00","Learn how to use PHP to convert PowerPoint files to PDFs with Convert to PDF API Tool by pdfRest","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-php\u002F#article\",\n      \"headline\": \"How to Convert Microsoft PowerPoint to PDF with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-php\u002F\",\n      \"datePublished\": \"2024-04-11T18:31:36.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:33.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use PHP to convert PowerPoint files to PDFs with Convert to PDF API Tool by pdfRest\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF, Microsoft Office, PHP, PowerPoint\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Microsoft PowerPoint to PDF with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5027,5028,5029,5030,5031,5032],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1657,"name":1658,"slug":1659,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-php\u002F","How to Convert Microsoft PowerPoint to PDF with PHP, Tutorial | pdfRest",{"id":5037,"uuid":5038,"title":5039,"slug":5040,"html":5041,"comment_id":5037,"feature_image":48,"featured":284,"visibility":1257,"created_at":5042,"updated_at":5043,"published_at":5042,"custom_excerpt":5044,"codeinjection_head":5045,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5046,"primary_tag":5053,"url":5054,"excerpt":5044,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5055,"meta_description":5044,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"66182d00533c9f26b94370a5","3ee83770-644c-40e1-8577-87eafba6f246","How to Convert Microsoft PowerPoint to PDF with Python","how-to-convert-microsoft-powerpoint-to-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PowerPoint to PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> is a powerful resource for developers who need to automate the conversion of various file types to PDF. By leveraging this tool through Python, one can seamlessly integrate PDF conversion capabilities into their applications or workflows. This tutorial will guide you through the process of sending an API call to Convert to PDF with Python, showcasing how to transform files such as images, documents, and more into PDF format programmatically.\u003C\u002Fp>\n\n\u003Cp>Imagine you are working on an application that handles document archival. Users upload documents in various formats, but for consistency and ease of access, you want to store all documents as PDFs. Using the Convert to PDF API, you can automatically convert incoming files, including PowerPoint presentations, to PDF, ensuring that all documents in your archive are in a uniform, widely accepted, and secure format. This not only improves the user experience but also streamlines the document management process.\u003C\u002Fp>\n\n\u003Ch2>Convert PowerPoint to PDF with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\npdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf'\n\nmp_encoder_pdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.tif', open('\u002Fpath\u002Fto\u002Ffile.ppt', 'rb'), 'application\u002Fvnd.ms-powerpoint'),\n        'output' : 'example_pdf_out',\n    }\n)\n\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\n\nprint(\"Sending POST request to pdf endpoint...\")\nresponse = requests.post(pdf_endpoint_url, data=mp_encoder_pdf, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Reference to the code source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.py\">pdfRest API Samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code provided is a Python script that uses the requests library to make an API call to the pdfRest Convert to PDF endpoint. Let's break down the key parts of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\u003C\u002Fpre>\n\n\u003Cp>This imports the necessary libraries: \u003Ccode>MultipartEncoder\u003C\u002Fcode> for creating multipart\u002Fform-data payloads, \u003Ccode>requests\u003C\u002Fcode> for making HTTP requests, and \u003Ccode>json\u003C\u002Fcode> for handling JSON data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_pdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.tif', open('\u002Fpath\u002Fto\u002Ffile.ppt', 'rb'), 'application\u002Fvnd.ms-powerpoint'),\n        'output' : 'example_pdf_out',\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>This creates a \u003Ccode>MultipartEncoder\u003C\u002Fcode> object with the fields for the API request. The 'file' field contains a tuple with the name of the file, the file object itself, and its MIME type. The 'output' field specifies the desired name for the output PDF file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\n\u003C\u002Fpre>\n\n\u003Cp>The headers include the \u003Ccode>Accept\u003C\u002Fcode> header, specifying that the response should be JSON, the \u003Ccode>Content-Type\u003C\u002Fcode> header, which is set automatically by the \u003Ccode>MultipartEncoder\u003C\u002Fcode>, and the \u003Ccode>Api-Key\u003C\u002Fcode> header, where you should place your own API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(pdf_endpoint_url, data=mp_encoder_pdf, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This sends a POST request to the pdfRest API endpoint with the encoded data and headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>If the request is successful, the script prints the JSON response, nicely formatted. Otherwise, it prints the error text.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've accomplished sending a multipart\u002Fform-data POST request to the pdfRest Convert to PDF endpoint using Python. This allows you to convert files to PDF format programmatically. To further explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information on the API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.py\">pdfRest API Samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-04-11T18:33:36.000+00:00","2026-09-02T18:27:26.000+00:00","Learn how to convert PowerPoint files to PDFs using pdfRest Convert to PDF API Tool with Python","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Convert Microsoft PowerPoint to PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-python\u002F\",\n      \"datePublished\": \"2024-04-11T18:33:36.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:33.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert PowerPoint files to PDFs using pdfRest Convert to PDF API Tool with Python\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF, Microsoft Office, PowerPoint, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Microsoft PowerPoint to PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5047,5048,5049,5050,5051,5052],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1657,"name":1658,"slug":1659,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-microsoft-powerpoint-to-pdf-with-python\u002F","How to Convert Microsoft PowerPoint to PDF with Python, Tutorial | pdfRest",{"id":5057,"uuid":5058,"title":5059,"slug":5060,"html":5061,"comment_id":5057,"feature_image":48,"featured":284,"visibility":1257,"created_at":5062,"updated_at":5043,"published_at":5062,"custom_excerpt":5063,"codeinjection_head":5064,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5065,"primary_tag":5070,"url":5071,"excerpt":5063,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5072,"meta_description":5063,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65c5106a533c9f26b9436108","cc951fff-d20b-4975-bb2f-16a581842c4f","How to Convert Microsoft Word to PDF in .NET with C#","how-to-convert-microsoft-word-to-pdf-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert Word to PDF with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> is a powerful resource that allows developers to convert various file formats to PDF with ease. By integrating this API into a C# application, you can automate the process of converting documents such as Word, Excel, HTML, or images to PDF format. \u003C\u002Fp>\n  \u003Cp>This can be particularly useful in scenarios such as generating reports, archiving documents, or preparing files for printing or sharing, where you need to ensure consistency and compatibility across different platforms and devices.\u003C\u002Fp>\n\n\u003Ch2>Convert Word to PDF with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name.docx\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"text\u002Fhtml\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"lossless\"));\n        multipartContent.Add(byteArrayOption, \"compression\");\n\n        var byteArrayOption2 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"output.pdf\"));\n        multipartContent.Add(byteArrayOption2, \"output\");\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.cs\">pdfRest API Samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided code snippet is a C# example of how to make a multipart\u002Fform-data POST request to the pdfRest API to convert a file to PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    \u002F\u002F ...\n}\n\u003C\u002Fpre>\n\n\u003Cp>This initializes an instance of \u003Ccode>HttpClient\u003C\u002Fcode> with the base address set to the pdfRest API endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf\"))\n{\n    \u002F\u002F ...\n}\n\u003C\u002Fpre>\n\n\u003Cp>A new \u003Ccode>HttpRequestMessage\u003C\u002Fcode> is created with the HTTP POST method targeting the \"pdf\" endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>The API key is added to the request headers. Replace \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n\u003C\u002Fpre>\n\n\u003Cp>A \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> object is created to hold the form data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"text\u002Fhtml\");\n\u003C\u002Fpre>\n\n\u003Cp>The file to be converted is read into a byte array, wrapped in a \u003Ccode>ByteArrayContent\u003C\u002Fcode>, and added to the multipart form data with the appropriate content type header.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"lossless\"));\nmultipartContent.Add(byteArrayOption, \"compression\");\n\u003C\u002Fpre>\n\n\u003Cp>An additional form field is added for the \"compression\" option, specifying the desired image compression option for the output PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption2 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"output.pdf\"));\nmultipartContent.Add(byteArrayOption2, \"output\");\n\u003C\u002Fpre>\n\n\u003Cp>Another form field is added for the \"output\" option, specifying the desired output file name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\n\u003C\u002Fpre>\n\n\u003Cp>The request is sent asynchronously, and the response is awaited.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>The response content is read as a string, which contains the result of the API call.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've walked through how to use C# to make an API call to the pdfRest Convert to PDF API endpoint using multipart form data. This example demonstrates how to convert a file to PDF format and retrieve the result programmatically.\u003C\u002Fp>\n\n\u003Cp>I encourage you to demo all of the pdfRest API Tools in the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\u003C\u002Fa> and refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa> for further exploration.\u003C\u002Fp>\n\n\u003Cp>Note that this is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.cs\">pdfRest API Samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-08T17:33:30.000+00:00","Learn how to Convert Microsoft Word to PDF in .NET with C# by Calling Convert to PDF API Tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert Microsoft Word to PDF in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-02-08T17:33:30.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:52.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to Convert Microsoft Word to PDF in .NET with C# by Calling Convert to PDF API Tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Convert to PDF\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Microsoft Word to PDF in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5066,5067,5068,5069],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-microsoft-word-to-pdf-in-net-with-c\u002F","How to Convert Microsoft Word to PDF in .NET with C#, Tutorial | pdfRest",{"id":5074,"uuid":5075,"title":5076,"slug":5077,"html":5078,"comment_id":5074,"feature_image":48,"featured":284,"visibility":1257,"created_at":5079,"updated_at":5080,"published_at":5079,"custom_excerpt":5081,"codeinjection_head":5082,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5083,"primary_tag":5090,"url":5091,"excerpt":5081,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5092,"meta_description":5081,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65f09e39533c9f26b9436a3a","58f1b028-4d71-4535-8e98-5be4175fd78c","How to Convert Microsoft Word to PDF with cURL","how-to-convert-microsoft-word-to-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert Word to PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> is a powerful resource that allows developers to easily convert various file formats into PDFs. This tutorial will guide you through the process of sending an API call to Convert to PDF using cURL, a versatile command-line tool used for transferring data with URLs. cURL is widely supported and can be used to interact with APIs in various programming environments, making it an excellent choice for automating the process of PDF conversion.\u003C\u002Fp>\n\n\u003Cp>You might need to convert documents to PDF for a variety of reasons. For instance, a business might need to convert a batch of invoices or reports generated in different formats into a unified PDF format for archival, compliance, or easy distribution. Using the Convert to PDF API, this can be done programmatically, saving time and reducing the potential for human error associated with manual conversion.\u003C\u002Fp>\n\n\u003Ch2>Convert Word to PDF with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>Reference to the code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.sh\">pdfRest API Samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This section will explain the components of the cURL command used to call the pdfRest Convert to PDF API:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-X POST\n\u003C\u002Fpre>\n\n\u003Cp>This specifies the HTTP method for the request, which is POST, indicating that data will be sent to the server.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">\"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf\"\n\u003C\u002Fpre>\n\n\u003Cp>This is the endpoint URL where the API call is being made to convert files to PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\n\u003C\u002Fpre>\n\n\u003Cp>This header tells the server that the client expects a response in JSON format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\n\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the data being sent in the request is in multipart\u002Fform-data format, which is necessary for uploading files.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>The Api-Key is a placeholder for your actual API key provided by pdfRest, which is required for authentication.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\n\u003C\u002Fpre>\n\n\u003Cp>This form field is used to attach the file to be converted. Replace \u003Ccode>\u002Fpath\u002Fto\u002Ffile\u003C\u002Fcode> with the actual file path on your system.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>This form field specifies the name of the output PDF. The API will return the converted PDF with this name.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've walked through how to make a multipart API call to the pdfRest Convert to PDF API using cURL. By following the steps outlined, you can automate the process of converting files to PDF format. This can be incredibly useful for integrating PDF conversion into your workflow or application.\u003C\u002Fp>\n\n\u003Cp>To explore more capabilities and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For a comprehensive understanding of the API's features and how to use them, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. For code samples using JSON payloads, you can find them at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.sh\">pdfRest API Samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-12T18:26:01.000+00:00","2026-09-02T18:27:27.000+00:00","Learn how to use pdfRest Convert to PDF API Tool with cURL to transform Word documents into PDF files","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Convert Microsoft Word to PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-curl\u002F\",\n      \"datePublished\": \"2024-03-12T18:26:01.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:39.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Convert to PDF API Tool with cURL to transform Word documents into PDF files\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF, Microsoft Office, Word, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Microsoft Word to PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5084,5085,5086,5087,5088,5089],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1661,"name":1662,"slug":1663,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-microsoft-word-to-pdf-with-curl\u002F","How to Convert Microsoft Word to PDF with cURL, Tutorial | pdfRest",{"id":5094,"uuid":5095,"title":5096,"slug":5097,"html":5098,"comment_id":5094,"feature_image":48,"featured":284,"visibility":1257,"created_at":5099,"updated_at":5100,"published_at":4984,"custom_excerpt":5101,"codeinjection_head":5102,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5103,"primary_tag":5110,"url":5111,"excerpt":5101,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5112,"meta_description":5101,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c58533c9f26b943b4be","4240d81b-aebc-44dc-9031-2449e6d75b33","How to Convert Microsoft Word to PDF with Java","how-to-convert-microsoft-word-to-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>In this tutorial, we'll walk through how to convert Microsoft Word to PDF with Java using the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool\u003C\u002Fa>. The code posts a DOCX document to \u003Ccode>\u002Fpdf\u003C\u002Fcode>, demonstrating the file metadata and response handling needed for server-side Office conversion. You'll see how the request is assembled and how to work with the response returned when you convert Microsoft Word to PDF.\u003C\u002Fp>\n\n\u003Ch2>Why Convert Microsoft Word to PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>Contract and correspondence systems often generate DOCX files but distribute final versions as PDFs. Automated conversion creates a fixed document that is easier to review consistently and feed into later PDF processing.\u003C\u002Fp>\n\n\u003Cp>The adapted request uploads a \u003Ccode>.docx\u003C\u002Fcode> file with the Word Open XML media type. The file extension and multipart filename allow the shared \u003Ccode>\u002Fpdf\u003C\u002Fcode> endpoint to select Word conversion.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class ConvertWordToPDF {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.docx\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fvnd.openxmlformats-officedocument.wordprocessingml.document\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_word_to_pdf\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPDF.java\">Java sample on GitHub\u003C\u002Fa>. The walkthrough specializes the reusable repository sample for Convert Microsoft Word to PDF.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The import block brings together the HTTP client, environment-based API key loading, and JSON utilities used later in the example.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.docx\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>The constants section shows where the input comes from and keeps the credential outside the request-building logic.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fvnd.openxmlformats-officedocument.wordprocessingml.document\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_word_to_pdf\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The adapted request uploads a \u003Ccode>.docx\u003C\u002Fcode> file with the Word Open XML media type. The file extension and multipart filename allow the shared \u003Ccode>\u002Fpdf\u003C\u002Fcode> endpoint to select Word conversion. This payload builder sets \u003Ccode>MultipartBody.FORM\u003C\u002Fcode>, allowing OkHttp to generate the matching boundary automatically.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The outbound call joins authentication, routing, and payload in one place while leaving regional service selection in the API URL constant.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>The returned-data block makes success and failure information available to the caller, including any temporary resources that must be saved or reused before expiration.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we walked through how to convert Microsoft Word to PDF with Java. With that foundation, you can use this integration for contracts, letters, reports, templates, and other generated Office documents.\u003C\u002Fp>\n\n\u003Cp>As you adapt this example for production, keep in mind that templates, fields, embedded fonts, tracked layout changes, and complex section settings can affect conversion. Include representative contracts or reports in validation and compare pagination, headers, footers, and page breaks before treating the PDF as a final version.\u003C\u002Fp>\n\n\u003Cp>To continue exploring the Convert Microsoft Word to PDF operation, visit \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For complete request fields, defaults, and limitations, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: The Convert Microsoft Word to PDF example above uses multipart form data; when a prior API call returned the input ID, see the request shape in the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPDF.java\">JSON payload example\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T17:33:12.000+00:00","2026-09-02T18:27:28.000+00:00","Convert Microsoft Word documents to PDF through a Java service.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Convert Microsoft Word to PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:33.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:33.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert Microsoft Word documents to PDF through a Java service.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF, Java, Microsoft Office, Word\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Microsoft Word to PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5104,5105,5106,5107,5108,5109],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1661,"name":1662,"slug":1663,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-microsoft-word-to-pdf-with-java\u002F","Convert Microsoft Word to PDF with Java | pdfRest",{"id":5114,"uuid":5115,"title":5116,"slug":5117,"html":5118,"comment_id":5114,"feature_image":48,"featured":284,"visibility":1257,"created_at":5119,"updated_at":5120,"published_at":5119,"custom_excerpt":5121,"codeinjection_head":5122,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5123,"primary_tag":5130,"url":5131,"excerpt":5121,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5132,"meta_description":5121,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"660c55e6533c9f26b9436f72","6c2d7aee-6ce3-4486-bd13-98e38031d410","How to Convert Microsoft Word to PDF with JavaScript in NodeJS","how-to-convert-microsoft-word-to-pdf-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert Word to PDF with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> provides a powerful and flexible way to convert various document formats into PDFs programmatically. This tutorial will guide you through the process of sending an API call to Convert to PDF using JavaScript. By leveraging this tool, developers can integrate PDF conversion features directly into their web applications or services, enhancing the functionality and user experience.\u003C\u002Fp>\n\n\u003Cp>Imagine a scenario where a business needs to convert batches of invoices, reports, or contracts from their native formats into a standardized PDF format for archival, sharing, or printing purposes. By using JavaScript to call the Convert to PDF API, developers can build systems that handle these conversions on-the-fly, without the need for manual intervention, thus streamlining business processes and increasing productivity.\u003C\u002Fp>\n\n\u003Ch2>Convert Word to PDF with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile.docx'));\ndata.append('compression', 'lossy'); \ndata.append('downsample', '300'); \ndata.append('tagged_pdf', 'off'); \ndata.append('output', 'pdfrest_pdf');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source of the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.js\">pdfRest API Samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided code snippet is a JavaScript example for making an API call to the pdfRest Convert to PDF endpoint using the Axios library and FormData to handle multipart form data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\u003C\u002Fpre>\n\n\u003Cp>This section imports the required modules: Axios for HTTP requests, FormData for constructing multipart\u002Fform-data payloads, and fs for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile.docx'));\u003C\u002Fpre>\n\n\u003Cp>Here, a new FormData instance is created, and the file to be converted is appended to the form data. The file path should be replaced with the actual path to the file you wish to convert.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">data.append('compression', 'lossy');\ndata.append('downsample', '300');\ndata.append('tagged_pdf', 'off');\ndata.append('output', 'pdfrest_pdf');\u003C\u002Fpre>\n\n\u003Cp>Additional parameters for the conversion process are appended to the form data. These include compression settings, downsampling resolution, whether to create a tagged PDF, and the output format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf',\n  headers: {\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\u003C\u002Fpre>\n\n\u003Cp>The Axios request configuration is defined, including the request method, URL, headers (including the API key which must be replaced with your own), and the data payload.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\u003C\u002Fpre>\n\n\u003Cp>The Axios library is used to send the request. The response is logged to the console if successful, or an error is logged if the request fails.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial walked you through the process of making a multipart API call to the pdfRest Convert to PDF endpoint using JavaScript. By understanding how to construct and send such requests, you can now integrate PDF conversion functionality into your applications.\u003C\u002Fp>\n\n\u003Cp>To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information on the API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.js\">pdfRest API Samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-04-02T19:00:54.000+00:00","2026-09-02T18:27:29.000+00:00","Learn how to use pdfRest Convert to PDF with JavaScript to convert Word docs to PDF files","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert Microsoft Word to PDF with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-04-02T19:00:54.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:34.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Convert to PDF with JavaScript to convert Word docs to PDF files\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF, JavaScript, Microsoft Office, Word\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Microsoft Word to PDF with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5124,5125,5126,5127,5128,5129],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1661,"name":1662,"slug":1663,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-microsoft-word-to-pdf-with-javascript-in-nodejs\u002F","How to Convert Microsoft Word to PDF with JavaScript in NodeJS, Tutorial | pdfRest",{"id":5134,"uuid":5135,"title":5136,"slug":5137,"html":5138,"comment_id":5134,"feature_image":48,"featured":284,"visibility":1257,"created_at":5139,"updated_at":5120,"published_at":5140,"custom_excerpt":5141,"codeinjection_head":5142,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5143,"primary_tag":5150,"url":5151,"excerpt":5141,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5152,"meta_description":5141,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"660c55f2533c9f26b9436f7c","77df3657-72db-4611-90d1-f2ff5a5c566c","How to Convert Microsoft Word to PDF with PHP","how-to-convert-microsoft-word-to-pdf-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert Word to PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> provides a straightforward way to convert various file formats into PDFs using a simple API call. This tutorial will demonstrate how to send an API call to the pdfRest Convert to PDF endpoint using PHP, a popular server-side scripting language. By integrating this functionality into PHP applications, developers can automate the conversion process, making it efficient and scalable.\u003C\u002Fp>\n\n\u003Cp>You might need to convert documents to PDF to ensure compatibility across different platforms and devices. For instance, businesses often need to convert invoices, reports, or contracts to PDF format before sharing them with clients or storing them for record-keeping. The Convert to PDF API allows for these conversions to be done programmatically, saving time and reducing the risk of human error.\u003C\u002Fp>\n\n\u003Ch2>Convert Word to PDF with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">\nrequire 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' =--> 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile.docx', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile.docx',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'compression',\n      'contents' => 'lossless'\n    ],\n    [\n      'name' => 'downsample',\n      'contents' => '300'\n    ],\n    [\n      'name' => 'tagged_pdf',\n      'contents' => 'off'\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_pdf'\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source code reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.php\">GitHub - datalogics\u002Fpdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This PHP script uses the Guzzle HTTP client library to make an HTTP POST request to the pdfRest Convert to PDF API endpoint. Here's a breakdown of the key components:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>This array contains the headers for the HTTP request, including the 'Api-Key' which is used for authentication with the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$options = [\n  'multipart' => [\n    \u002F\u002F ... multipart form data ...\n  ]\n];\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>$options\u003C\u002Fcode> array is used to define the multipart form data that will be sent with the request. Each element of the 'multipart' array represents a different part of the form data:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Ccode>'file'\u003C\u002Fcode>: The file to be converted to PDF. The 'contents' key should point to the file stream, and the 'filename' key should specify the file path.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>'compression'\u003C\u002Fcode>: The compression setting for the PDF.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>'downsample'\u003C\u002Fcode>: The downsample resolution for images within the PDF.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>'tagged_pdf'\u003C\u002Fcode>: Whether to create a tagged PDF, which is important for accessibility.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>'output'\u003C\u002Fcode>: The output file name prefix for the converted PDF.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-php\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', $headers);\n\u003C\u002Fpre>\n\n\u003Cp>A new HTTP POST request is created with the API endpoint URL and the headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$res = $client->sendAsync($request, $options)->wait();\n\u003C\u002Fpre>\n\n\u003Cp>The request is sent asynchronously, and the script waits for the response. The response body, which should contain the processed PDF content, is then printed out.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial has shown how to use PHP to call the pdfRest Convert to PDF API. By sending a multipart request with the necessary parameters, you can convert files to PDF programmatically. To explore and test all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.php\">GitHub - datalogics\u002Fpdf-rest-api-samples (JSON Payload)\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-04-02T19:01:06.000+00:00","2024-04-02T19:01:07.000+00:00","Learn how to convert Word docs to PDF files with pdfRest Convert to PDF API Tool using PHP","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-php\u002F#article\",\n      \"headline\": \"How to Convert Microsoft Word to PDF with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-php\u002F\",\n      \"datePublished\": \"2024-04-02T19:01:07.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:34.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert Word docs to PDF files with pdfRest Convert to PDF API Tool using PHP\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF, Microsoft Office, PHP, Word\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Microsoft Word to PDF with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-microsoft-word-to-pdf-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5144,5145,5146,5147,5148,5149],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1661,"name":1662,"slug":1663,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-microsoft-word-to-pdf-with-php\u002F","How to Convert Microsoft Word to PDF with PHP, Tutorial | pdfRest",{"id":5154,"uuid":5155,"title":5156,"slug":5157,"html":5158,"comment_id":5159,"feature_image":48,"featured":284,"visibility":1257,"created_at":5160,"updated_at":5161,"published_at":5160,"custom_excerpt":5162,"codeinjection_head":5163,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5164,"primary_tag":5169,"url":5170,"excerpt":5162,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5171,"meta_description":5162,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1352","1af7ad57-6002-4e19-b561-526c20d73fc7","How to Convert Microsoft Word to PDF with Python","how-to-convert-word-to-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to Microsoft Word?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> is a versatile service that allows users to convert various file types into PDF format. This tutorial will demonstrate how to make an API call to the Convert to PDF endpoint using Python. This functionality is particularly useful in scenarios where documents need to be standardized for distribution, archiving, or printing, such as converting invoices, reports, or other business documents into a universally accessible PDF format.\u003C\u002Fp>\n\n\u003Ch2>Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\npdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf'\n\nmp_encoder_pdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.tif', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'image\u002Ftiff'),\n        'output' : 'example_pdf_out',\n    }\n)\n\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\n\nprint(\"Sending POST request to pdf endpoint...\")\nresponse = requests.post(pdf_endpoint_url, data=mp_encoder_pdf, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.py\">pdfRest API Python Sample Code\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Python\u003C\u002Fh2>\n\n\u003Cp>The code starts by importing the necessary modules: \u003Ccode class=\"language-python\">MultipartEncoder\u003C\u002Fcode> from \u003Ccode class=\"language-python\">requests_toolbelt\u003C\u002Fcode>, \u003Ccode class=\"language-python\">requests\u003C\u002Fcode>, and \u003Ccode class=\"language-python\">json\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode class=\"language-python\">pdf_endpoint_url\u003C\u002Fcode> variable holds the endpoint URL to which the API call will be made.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode class=\"language-python\">MultipartEncoder\u003C\u002Fcode> is used to encode the files and fields into a multipart\u002Fform-data format. The fields include:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Ccode class=\"language-python\">'file'\u003C\u002Fcode>: A tuple containing the file name, the file object opened in binary read mode, and the MIME type of the file.\u003C\u002Fli>\n  \u003Cli>\u003Ccode class=\"language-python\">'output'\u003C\u002Fcode>: The desired name for the output PDF file.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>The \u003Ccode class=\"language-python\">headers\u003C\u002Fcode> dictionary sets the necessary HTTP headers for the request. The 'Accept' header indicates that the response should be JSON, and the 'Content-Type' is set to the content type of the multipart data. The 'Api-Key' is where you would place your own API key provided by pdfRest.\u003C\u002Fp>\n\n\u003Cp>A POST request is then sent using the \u003Ccode class=\"language-python\">requests.post\u003C\u002Fcode> method with the endpoint URL, the encoded data, and the headers. The response status code is printed out, and if the request was successful, the JSON response is printed in a formatted manner. Otherwise, the response text, which usually contains error information, is printed.\u003C\u002Fp>\n\n\u003Ch2>Next Steps with pdfRest\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we have successfully made an API call to the pdfRest Convert to PDF endpoint using Python. The code sends a file to be converted into PDF and handles the response. This example demonstrates how to work with the pdfRest API to automate document conversion processes.\u003C\u002Fp>\n\n\u003Cp>To explore all of the pdfRest API Tools, you can demo them in the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\u003C\u002Fa>. For further details and documentation, visit \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.py\">https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.py\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","658212b22d4014c9499b39e3","2023-12-19T22:01:22.000+00:00","2026-09-02T18:27:30.000+00:00","Learn how to turn Microsoft Office documents like Word into PDFs using the Convert to PDF API Tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-word-to-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Convert Microsoft Word to PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-word-to-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-word-to-pdf-with-python\u002F\",\n      \"datePublished\": \"2023-12-19T22:01:22.000Z\",\n      \"dateModified\": \"2026-09-01T14:52:12.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to turn Microsoft Office documents like Word into PDFs using the Convert to PDF API Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Microsoft Word to PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-word-to-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5165,5166,5167,5168],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-word-to-pdf-with-python\u002F","How to Convert Microsoft Word to PDF with Python, Tutorial | pdfRest",{"id":5173,"uuid":5174,"title":5175,"slug":5176,"html":5177,"comment_id":5173,"feature_image":48,"featured":284,"visibility":1257,"created_at":5178,"updated_at":5161,"published_at":5178,"custom_excerpt":5179,"codeinjection_head":5180,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5181,"primary_tag":5187,"url":5188,"excerpt":5179,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5189,"meta_description":5179,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6675c3f1533c9f26b9437c26","2bacdc4c-9010-40c7-8f16-943ac182eb83","How to Convert PDF Colors in .NET with C#","how-to-convert-pdf-colors-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF Colors with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F'>Convert PDF Colors API Tool\u003C\u002Fa> is a powerful utility that allows developers to programmatically change the color profile of a PDF document using an API call. This tutorial will show you how to send an API call to Convert PDF Colors with C#, enabling you to automate the process of color conversion in your PDF workflows.\u003C\u002Fp>\n\n\u003Cp>Consider a scenario where a printing company needs all PDF files to adhere to a specific color profile, such as sRGB, for consistent print quality. By using the Convert PDF Colors API, the company can automate the conversion process, ensuring that all incoming PDF files are converted to the required color profile before printing, thus saving time and reducing the risk of errors.\u003C\u002Fp>\n\n\u003Ch2>Convert PDF Colors with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf-with-converted-colors\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"srgb\"));\n        multipartContent.Add(byteArrayOption, \"color_profile\");\n\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-converted-colors.cs\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>Let's break down the provided code to understand how it works:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>This line initializes a new instance of the \u003Ccode>HttpClient\u003C\u002Fcode> class with the base address set to the pdfRest API endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf-with-converted-colors\"))\n\u003C\u002Fpre>\n\n\u003Cp>Here, we create a new \u003Ccode>HttpRequestMessage\u003C\u002Fcode> object for a POST request to the \"pdf-with-converted-colors\" endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\nrequest.Headers.Accept.Add(new(\"application\u002Fjson\"));\n\u003C\u002Fpre>\n\n\u003Cp>These lines add the necessary headers to the request. The \"Api-Key\" header contains your API key for authentication, and the \"Accept\" header specifies that the response should be in JSON format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n\u003C\u002Fpre>\n\n\u003Cp>This line creates a new instance of the \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> class to hold the multipart form data for the request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\u003C\u002Fpre>\n\n\u003Cp>In these lines, we read the PDF file into a byte array, create a \u003Ccode>ByteArrayContent\u003C\u002Fcode> object from the byte array, and add it to the multipart content with the name \"file\" and the file name \"file_name\". The content type is set to \"application\u002Fpdf\".\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"srgb\"));\nmultipartContent.Add(byteArrayOption, \"color_profile\");\n\u003C\u002Fpre>\n\n\u003Cp>Here, we create another \u003Ccode>ByteArrayContent\u003C\u002Fcode> object for the color profile option, set to \"srgb\", and add it to the multipart content with the name \"color_profile\".\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Content = multipartContent;\nvar response = await httpClient.SendAsync(request);\nvar apiResult = await response.Content.ReadAsStringAsync();\nConsole.WriteLine(\"API response received.\");\nConsole.WriteLine(apiResult);\n\u003C\u002Fpre>\n\n\u003Cp>Finally, we set the request content to the multipart content, send the request asynchronously, read the response content as a string, and print the API response to the console.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we demonstrated how to use the pdfRest Convert PDF Colors API Tool with C# to convert the color profile of a PDF document. This example showed how to create and send a multipart API call, handle the response, and print the result.\u003C\u002Fp>\n\n\u003Cp>To explore more functionalities, we encourage you to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on each API endpoint, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example uses a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-converted-colors.cs\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-06-21T18:18:25.000+00:00","Learn how to change PDF color profiles with Convert PDF Colors API tool by pdfRest using C#","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert PDF Colors in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-06-21T18:18:25.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:30.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to change PDF color profiles with Convert PDF Colors API tool by pdfRest using C#\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert PDF Colors API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-converted-colors API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-colors\"\n        }\n      ],\n      \"keywords\": \".NET, Color Management, Convert PDF Colors\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF Colors in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5182,5183,5184,5185,5186],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2161,"name":2162,"slug":2163,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2149,"name":2150,"slug":2151,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-colors-in-net-with-c\u002F","How to Convert PDF Colors in .NET with C# , Tutorial | pdfRest",{"id":5191,"uuid":5192,"title":5193,"slug":5194,"html":5195,"comment_id":5191,"feature_image":48,"featured":284,"visibility":1257,"created_at":5196,"updated_at":5197,"published_at":5196,"custom_excerpt":5198,"codeinjection_head":5199,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5200,"primary_tag":5206,"url":5207,"excerpt":5198,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5208,"meta_description":5198,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6675c704533c9f26b9437c50","d920cd01-a637-441c-b5f3-574353e419ed","How to Convert PDF Colors with cURL","how-to-convert-pdf-colors-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF Colors with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F'>Convert PDF Colors API Tool\u003C\u002Fa> allows users to change the color profile of a PDF document. This tutorial will show you how to send an API call to Convert PDF Colors using cURL, a command-line tool for transferring data with URLs.\u003C\u002Fp>\n\n\u003Cp>In a real-world scenario, you might need to convert the color profile of a PDF for printing purposes. For instance, converting a PDF from RGB to CMYK ensures that the colors will print correctly on a commercial printer. Similarly, converting to sRGB can make sure the colors are consistent across different screens and devices.\u003C\u002Fp>\n\n\u003Ch2>Convert PDF Colors with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\" \\\n  -F \"color_profile=srgb\"\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-converted-colors.sh\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>Let's break down the code to understand each part:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors\"\u003C\u002Fpre>\n\n\u003Cp>This line initiates a POST request to the endpoint \u002Fpdf-with-converted-colors, which is the API endpoint for converting PDF colors.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\u003C\u002Fpre>\n\n\u003Cp>This header specifies that the client expects the server to return data in JSON format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the request body will be sent as a multipart\u002Fform-data, which is necessary when uploading files.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\u003C\u002Fpre>\n\n\u003Cp>This header includes your API key, which authenticates your request. Replace \u003Ccode>xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\u003C\u002Fcode> with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\u003C\u002Fpre>\n\n\u003Cp>This form field specifies the file to be uploaded. Replace \u003Ccode>\u002Fpath\u002Fto\u002Ffile\u003C\u002Fcode> with the actual path to your PDF file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\u003C\u002Fpre>\n\n\u003Cp>This form field specifies the name of the output file. In this case, the output file will be named \u003Ccode>example_out\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"color_profile=srgb\"\u003C\u002Fpre>\n\n\u003Cp>This form field specifies the color profile to which the PDF will be converted. Here, \u003Ccode>srgb\u003C\u002Fcode> is used, but other color profiles like CMYK can also be specified.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use cURL to send an API request to convert the color profile of a PDF using the pdfRest Convert PDF Colors API Tool. This can be particularly useful for ensuring color consistency across different devices and printing processes.\u003C\u002Fp>\n\n\u003Cp>To explore more functionalities, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on all available API endpoints and parameters, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-converted-colors.sh\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-06-21T18:31:32.000+00:00","2026-09-02T18:27:31.000+00:00","Learn how to use cURL to change PDF color profiles with pdfRest Convert PDF Colors API tool ","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-curl\u002F#article\",\n      \"headline\": \"How to Convert PDF Colors with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-curl\u002F\",\n      \"datePublished\": \"2024-06-21T18:31:32.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:29.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use cURL to change PDF color profiles with pdfRest Convert PDF Colors API tool \",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert PDF Colors API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-converted-colors API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-colors\"\n        }\n      ],\n      \"keywords\": \"Color Management, Convert PDF Colors, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF Colors with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5201,5202,5203,5204,5205],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2161,"name":2162,"slug":2163,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2149,"name":2150,"slug":2151,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-colors-with-curl\u002F","How to Convert PDF Colors with cURL, Tutorial | pdfRest",{"id":5210,"uuid":5211,"title":5212,"slug":5213,"html":5214,"comment_id":5210,"feature_image":48,"featured":284,"visibility":1257,"created_at":5215,"updated_at":5197,"published_at":5215,"custom_excerpt":5216,"codeinjection_head":5217,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5218,"primary_tag":5224,"url":5225,"excerpt":5216,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5226,"meta_description":5216,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"672bcdd2533c9f26b9438c35","95fabbfa-4cf7-40e8-9f3a-074469071a77","How to Convert PDF Colors with Java","how-to-convert-pdf-colors-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF Colors with Java?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F'>Convert PDF Colors API Tool\u003C\u002Fa> provides a seamless way to transform the color profiles of PDF documents. This tutorial will guide you through the process of sending an API call to convert PDF colors using Java. By leveraging this tool, developers can automate the conversion of PDF color profiles, ensuring that their documents meet specific color standards or requirements.\u003C\u002Fp>\n\n\u003Cp>A user might need to convert PDF colors to maintain consistency across various devices or printing processes. For instance, a graphic designer might need to convert a PDF from CMYK to sRGB to ensure the colors appear correctly on digital screens. This can be crucial for maintaining brand consistency and ensuring that digital assets look as intended across different platforms.\u003C\u002Fp>\n\n\u003Ch2>Convert PDF Colors with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONObject;\n\npublic class PDFWithConvertedColors {\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  private static final String color_profile = \"srgb\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"color_profile\", color_profile)\n            .addFormDataPart(\"output\", \"pdfrest_pdf_with_converted_colors\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPDFWithConvertedColors.java\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary libraries, such as OkHttp for HTTP requests and Dotenv for environment variable management. The \u003Ccode>DEFAULT_FILE_PATH\u003C\u002Fcode> and \u003Ccode>DEFAULT_API_KEY\u003C\u002Fcode> are placeholders for the file path and API key, respectively. The \u003Ccode>color_profile\u003C\u002Fcode> is set to \"srgb\", which specifies the desired color profile for conversion.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">File inputFile;\nif (args.length > 0) {\n  inputFile = new File(args[0]);\n} else {\n  inputFile = new File(DEFAULT_FILE_PATH);\n}\n\u003C\u002Fpre>\n\n\u003Cp>This snippet determines the file to be converted. If a file path is provided as a command-line argument, it uses that; otherwise, it defaults to \u003Ccode>DEFAULT_FILE_PATH\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\u003C\u002Fpre>\n\n\u003Cp>The above line loads environment variables using the Dotenv library, allowing the API key to be stored securely outside the code.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">RequestBody requestBody =\n    new MultipartBody.Builder()\n        .setType(MultipartBody.FORM)\n        .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n        .addFormDataPart(\"color_profile\", color_profile)\n        .addFormDataPart(\"output\", \"pdfrest_pdf_with_converted_colors\")\n        .build();\n\u003C\u002Fpre>\n\n\u003Cp>This part of the code constructs the multipart form request body. It includes the PDF file, the target color profile, and the output format. According to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-colors\u002F\">pdfRest Cloud API Reference Guide\u003C\u002Fa>, the \"file\" parameter is required, and \"color_profile\" specifies the desired color conversion.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Request request =\n    new Request.Builder()\n        .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n        .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors\")\n        .post(requestBody)\n        .build();\n\u003C\u002Fpre>\n\n\u003Cp>This snippet creates the HTTP POST request, including the API key in the header and specifying the endpoint URL.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use Java to send an API call to pdfRest's Convert PDF Colors endpoint. This process allows you to automate the conversion of PDF color profiles, ensuring consistency and meeting specific requirements.\u003C\u002Fp>\n\n\u003Cp>To explore more, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> to demo all pdfRest API Tools. For detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPDFWithConvertedColors.java\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-06T20:13:06.000+00:00","Learn how to convert PDF color profiles with pdfRest Convert PDF Colors API Tool using Java","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-java\u002F#article\",\n      \"headline\": \"How to Convert PDF Colors with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-java\u002F\",\n      \"datePublished\": \"2024-11-06T20:13:06.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:22.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert PDF color profiles with pdfRest Convert PDF Colors API Tool using Java\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert PDF Colors API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-converted-colors API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-colors\"\n        }\n      ],\n      \"keywords\": \"Color Management, Convert PDF Colors, Java\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF Colors with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5219,5220,5221,5222,5223],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2161,"name":2162,"slug":2163,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2149,"name":2150,"slug":2151,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-colors-with-java\u002F","How to Convert PDF Colors with Java, Tutorial | pdfRest",{"id":5228,"uuid":5229,"title":5230,"slug":5231,"html":5232,"comment_id":5228,"feature_image":48,"featured":284,"visibility":1257,"created_at":5233,"updated_at":5234,"published_at":5233,"custom_excerpt":5235,"codeinjection_head":5236,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5237,"primary_tag":5243,"url":5244,"excerpt":5235,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5245,"meta_description":5235,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6675c51c533c9f26b9437c30","2f64a3e0-1bed-43c0-a721-15eba52fe4a7","How to Convert PDF Colors with JavaScript in NodeJS","how-to-convert-pdf-colors-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF Colors with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F'>Convert PDF Colors API Tool\u003C\u002Fa> is a powerful resource for developers looking to manipulate the color profiles of PDF documents programmatically. This tutorial will show you how to send an API call to convert PDF colors using JavaScript, making it easier to integrate this functionality into your web applications or automated workflows.\u003C\u002Fp>\n\n\u003Cp>Imagine you are a graphic designer who needs to ensure that all PDF documents adhere to a specific color profile before sending them to print. Using the Convert PDF Colors API, you can automate this process, ensuring consistency and saving time. This tool can also be useful for developers who need to standardize color profiles in PDFs for web display or archival purposes.\u003C\u002Fp>\n\n\u003Ch2>Convert PDF Colors with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to convert PDF colors.\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('color_profile', 'srgb');\ndata.append('output', 'pdfrest_pdf_with_converted_colors');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-converted-colors.js\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>Let's break down the code to understand how it works:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\u003C\u002Fpre>\n\n\u003Cp>Here, we import the necessary modules: \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests, \u003Ccode>FormData\u003C\u002Fcode> for handling form data, and \u003Ccode>fs\u003C\u002Fcode> for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('color_profile', 'srgb');\ndata.append('output', 'pdfrest_pdf_with_converted_colors');\u003C\u002Fpre>\n\n\u003Cp>We create a new instance of \u003Ccode>FormData\u003C\u002Fcode> and append the PDF file and parameters to it. The \u003Ccode>file\u003C\u002Fcode> parameter is the path to the PDF file, \u003Ccode>color_profile\u003C\u002Fcode> specifies the desired color profile (e.g., 'srgb'), and \u003Ccode>output\u003C\u002Fcode> defines the output file name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\u003C\u002Fpre>\n\n\u003Cp>We define the configuration options for the \u003Ccode>axios\u003C\u002Fcode> request. The \u003Ccode>method\u003C\u002Fcode> is set to 'post', \u003Ccode>maxBodyLength\u003C\u002Fcode> is set to Infinity to allow large file uploads, and the \u003Ccode>url\u003C\u002Fcode> is the endpoint for the Convert PDF Colors API. The \u003Ccode>headers\u003C\u002Fcode> include the API key and the headers from the \u003Ccode>FormData\u003C\u002Fcode> instance. Finally, the \u003Ccode>data\u003C\u002Fcode> is set to the form data we created earlier.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\u003C\u002Fpre>\n\n\u003Cp>We send the request using \u003Ccode>axios\u003C\u002Fcode> and handle the response or any errors. If the request is successful, the response data is logged to the console. If there is an error, it is also logged to the console.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we demonstrated how to use JavaScript to call the pdfRest Convert PDF Colors API. This is just one of many tools available through the pdfRest API. To explore more, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. Note that this example uses a multipart API call. Code samples using JSON payloads can be found \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-converted-colors.js\">here\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-06-21T18:23:24.000+00:00","2026-09-02T18:27:32.000+00:00","Learn how to use pdfRest Convert PDF Colors API tool with JavaScript to change PDF color profiles","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert PDF Colors with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-06-21T18:23:24.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:29.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Convert PDF Colors API tool with JavaScript to change PDF color profiles\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert PDF Colors API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-converted-colors API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-colors\"\n        }\n      ],\n      \"keywords\": \"Color Management, Convert PDF Colors, JavaScript\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF Colors with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5238,5239,5240,5241,5242],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2161,"name":2162,"slug":2163,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2149,"name":2150,"slug":2151,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-colors-with-javascript-in-nodejs\u002F","How to Convert PDF Colors with JavaScript in NodeJS, Tutorial | pdfRest",{"id":5247,"uuid":5248,"title":5249,"slug":5250,"html":5251,"comment_id":5247,"feature_image":48,"featured":284,"visibility":1257,"created_at":5252,"updated_at":5234,"published_at":5252,"custom_excerpt":5253,"codeinjection_head":5254,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5255,"primary_tag":5261,"url":5262,"excerpt":5253,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5263,"meta_description":5253,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6675c385533c9f26b9437c1c","1f4dadce-1a00-404d-813d-39ed01a799ab","How to Convert PDF Colors with PHP","how-to-convert-pdf-colors-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF Colors with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F'>Convert PDF Colors API Tool\u003C\u002Fa> allows users to change the color profile of a PDF document programmatically. This tutorial will demonstrate how to send an API call to Convert PDF Colors using PHP, making it easier to automate the process of color conversion in PDF files.\u003C\u002Fp>\n\n\u003Cp>Imagine you are a graphic designer working with multiple clients who require their PDF documents to adhere to specific color profiles for printing. Using the Convert PDF Colors API, you can automate the conversion process, ensuring that all PDFs meet the required color standards without manually adjusting each file.\u003C\u002Fp>\n\n\u003Ch2>Convert PDF Colors with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">\nrequire 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\n$headers = [\n  'Api-Key' =--> 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile', \u002F\u002F Set the filename for the file to be converted, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'color_profile', \u002F\u002F Specify the field name for the color profile.\n      'contents' => 'srgb' \u002F\u002F Set the value for the color profile (in this case, 'srgb').\n    ],\n    [\n      'name' => 'output', \u002F\u002F Specify the field name for the output option.\n      'contents' => 'pdfrest_pdf_with_converted_colors' \u002F\u002F Set the value for the output option (in this case, 'pdfrest_pdf_with_converted_colors').\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the converted PDF content.\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-converted-colors.php\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by including the necessary libraries and classes:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">require 'vendor\u002Fautoload.php';\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\u003C\u002Fpre>\n\n\u003Cp>Here, we load the Guzzle HTTP client, which is used to make HTTP requests, and the PSR-7 Request and Utils classes for handling HTTP requests and streams.\u003C\u002Fp>\n\n\u003Cp>Next, we create a new instance of the Guzzle HTTP client:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$client = new Client();\n\u003C\u002Fpre>\n\n\u003Cp>This instance will be used to send the API request.\u003C\u002Fp>\n\n\u003Cp>We then set up the headers for the request, including the API key for authentication:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>Replace the placeholder API key with your actual API key.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>options\u003C\u002Fcode> array specifies the multipart form data for the request:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'color_profile',\n      'contents' => 'srgb'\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_pdf_with_converted_colors'\n    ]\n  ]\n];\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Here, we specify the file to be converted, the color profile to use (in this case, 'srgb'), and the desired output format.\u003C\u002Fp>\n\n\u003Cp>We create a new HTTP POST request with the API endpoint and headers:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors', $headers);\n\u003C\u002Fpre>\n\n\u003Cp>This sets up the request to be sent to the \u002Fpdf-with-converted-colors endpoint.\u003C\u002Fp>\n\n\u003Cp>We then send the asynchronous request and wait for the response:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$res = $client->sendAsync($request, $options)->wait();\n\u003C\u002Fpre>\n\n\u003Cp>This sends the request and waits for the response, which contains the converted PDF content.\u003C\u002Fp>\n\n\u003Cp>Finally, we output the response body:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">echo $res->getBody();\n\u003C\u002Fpre>\n\n\u003Cp>This prints the converted PDF content to the screen.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we demonstrated how to use the pdfRest Convert PDF Colors API Tool with PHP to convert the color profile of a PDF document. This can be particularly useful for automating the conversion process in workflows that require specific color profiles.\u003C\u002Fp>\n\n\u003Cp>We encourage you to explore all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for more detailed information. Note that this is an example of a multipart API call, and code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-converted-colors.php\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-06-21T18:16:37.000+00:00","Learn how to change PDF color profiles with pdfRest Convert PDF Colors API tool using PHP","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-php\u002F#article\",\n      \"headline\": \"How to Convert PDF Colors with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-php\u002F\",\n      \"datePublished\": \"2024-06-21T18:16:37.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:30.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to change PDF color profiles with pdfRest Convert PDF Colors API tool using PHP\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert PDF Colors API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-converted-colors API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-colors\"\n        }\n      ],\n      \"keywords\": \"Color Management, Convert PDF Colors, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF Colors with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5256,5257,5258,5259,5260],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2161,"name":2162,"slug":2163,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2149,"name":2150,"slug":2151,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-colors-with-php\u002F","How to Convert PDF Colors with PHP, Tutorial | pdfRest",{"id":5265,"uuid":5266,"title":5267,"slug":5268,"html":5269,"comment_id":5265,"feature_image":48,"featured":284,"visibility":1257,"created_at":5270,"updated_at":5234,"published_at":5270,"custom_excerpt":5271,"codeinjection_head":5272,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5273,"primary_tag":5279,"url":5280,"excerpt":5271,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5281,"meta_description":5271,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6675c366533c9f26b9437c12","8f68e24a-32b6-47bd-8dd5-f2672c7e90c1","How to Convert PDF Colors with Python","how-to-convert-pdf-colors-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF Colors with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F'>Convert PDF Colors API Tool\u003C\u002Fa> is a powerful utility that allows users to convert the color profile of a PDF document. This tutorial will guide you through the process of sending an API call to convert PDF colors using Python. By following this guide, you will learn how to utilize the pdfRest API to change the color profile of your PDF files programmatically.\u003C\u002Fp>\n\n\u003Cp>Imagine you are a graphic designer who needs to ensure that all PDF documents adhere to a specific color profile, such as sRGB, for consistent printing results. Using the Convert PDF Colors API, you can automate this process, saving time and reducing the risk of human error. This tool is especially useful for large batches of documents, ensuring uniformity across all your files.\u003C\u002Fp>\n\n\u003Ch2>Convert PDF Colors with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\npdf_with_converted_colors_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors'\n\n# The \u002Fpdf-with-converted-colors endpoint can take a single PDF file or id as input.\n# This sample demonstrates setting color_profile to 'srgb'.\nmp_encoder_pdfWithConvertedColors = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_pdfWithConvertedColors_out',\n        'color_profile': 'srgb',\n    }\n)\n\n# Let's set the headers that the pdf-with-converted-colors endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdfWithConvertedColors.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to pdf-with-converted-colors endpoint...\")\nresponse = requests.post(pdf_with_converted_colors_endpoint_url, data=mp_encoder_pdfWithConvertedColors, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-converted-colors.py\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>Let's break down the provided code to understand how it works:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">pdf_with_converted_colors_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors'\n\u003C\u002Fpre>\n\n\u003Cp>This line sets the endpoint URL for the Convert PDF Colors API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_pdfWithConvertedColors = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_pdfWithConvertedColors_out',\n        'color_profile': 'srgb',\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>Here, we create a \u003Ccode>MultipartEncoder\u003C\u002Fcode> object to handle the multipart form data. The \u003Ccode>fields\u003C\u002Fcode> dictionary includes:\u003C\u002Fp>\n\n\u003Cul>\n    \u003Cli>\u003Ccode>file\u003C\u002Fcode>: The PDF file to be converted. This is specified with the file name, file object, and MIME type.\u003C\u002Fli>\n    \u003Cli>\u003Ccode>output\u003C\u002Fcode>: The desired output file name.\u003C\u002Fli>\n    \u003Cli>\u003Ccode>color_profile\u003C\u002Fcode>: The color profile to convert to, in this case, 'srgb'.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdfWithConvertedColors.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\u003C\u002Fpre>\n\n\u003Cp>We set the headers for the request. The \u003Ccode>Content-Type\u003C\u002Fcode> is automatically set to 'multipart\u002Fform-data' by the \u003Ccode>MultipartEncoder\u003C\u002Fcode>. The \u003Ccode>Api-Key\u003C\u002Fcode> should be replaced with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(pdf_with_converted_colors_endpoint_url, data=mp_encoder_pdfWithConvertedColors, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This line sends a POST request to the API endpoint with the multipart data and headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>We check if the response is successful. If so, we print the JSON response. Otherwise, we print the error message.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use the pdfRest Convert PDF Colors API tool with Python to change the color profile of a PDF document. This example demonstrates a multipart API call, but you can also explore JSON payload options in our \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-converted-colors.py\">GitHub repo\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>To explore more API tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed documentation, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-06-21T18:16:06.000+00:00","Learn how to use pdfRest Convert PDF Colors API tool with Python to change PDF color profiles","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-python\u002F#article\",\n      \"headline\": \"How to Convert PDF Colors with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-python\u002F\",\n      \"datePublished\": \"2024-06-21T18:16:06.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:30.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Convert PDF Colors API tool with Python to change PDF color profiles\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert PDF Colors API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-converted-colors API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-colors\"\n        }\n      ],\n      \"keywords\": \"Color Management, Convert PDF Colors, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF Colors with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-colors-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5274,5275,5276,5277,5278],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2161,"name":2162,"slug":2163,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2149,"name":2150,"slug":2151,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-colors-with-python\u002F","How to Convert PDF Colors with Python, Tutorial | pdfRest",{"id":5283,"uuid":5284,"title":5285,"slug":5286,"html":5287,"comment_id":5283,"feature_image":48,"featured":284,"visibility":1257,"created_at":5288,"updated_at":5289,"published_at":5288,"custom_excerpt":5290,"codeinjection_head":5291,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5292,"primary_tag":5299,"url":5300,"excerpt":5290,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5301,"meta_description":5290,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"672a5a7f533c9f26b9438b16","300e339d-af57-4c22-b48e-9ed419ff8264","How to Convert PDF Files from Color to Black and White (Grayscale) in .NET with C#","how-to-convert-pdf-files-from-color-to-black-and-white-grayscale-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDFs from Color to Black and White with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F'>Convert PDF Colors API Tool\u003C\u002Fa> is designed to help developers programmatically convert the color profile of PDF documents using a simple API call. By using C#, a powerful and widely-used programming language, you can integrate this functionality into your applications, enabling automated processing of PDFs to match specific color requirements. This tutorial will guide you through the process of sending an API call to convert a color PDF to black and white using C#, providing a practical example and detailed explanation of the code.\u003C\u002Fp>\n\n\u003Cp>You might need to convert PDF colors to grayscale for various reasons, such as ensuring better readability on certain devices or reducing file size. For instance, a document preparation specialist might need to convert a colorful PDF report into a black and white version for archival purposes or to reduce printing costs. By leveraging the Convert PDF Colors API, such tasks can be automated, saving time and reducing the potential for human error.\u003C\u002Fp>\n\n\u003Ch2>Convert PDFs from Color to Black and White with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf-with-converted-colors\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"gamma-22\"));\n        multipartContent.Add(byteArrayOption, \"color_profile\");\n\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-converted-colors.cs\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by creating an instance of \u003Ccode>HttpClient\u003C\u002Fcode> with a base address set to the pdfRest API URL:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>Next, an \u003Ccode>HttpRequestMessage\u003C\u002Fcode> is configured for a POST request to the \"pdf-with-converted-colors\" endpoint:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf-with-converted-colors\"))\n\u003C\u002Fpre>\n\n\u003Cp>The API key is added to the request headers for authentication, and the request is set to accept JSON responses:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\nrequest.Headers.Accept.Add(new(\"application\u002Fjson\"));\n\u003C\u002Fpre>\n\n\u003Cp>A \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> object is created to hold the file and additional parameters. The PDF file is read into a byte array and added to the content with the appropriate content type:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\u003C\u002Fpre>\n\n\u003Cp>The color profile option is specified as \"srgb\" and added to the multipart content:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"gamma-22\"));\nmultipartContent.Add(byteArrayOption, \"color_profile\");\n\u003C\u002Fpre>\n\n\u003Cp>The request is sent asynchronously, and the response is read and printed to the console:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\nvar apiResult = await response.Content.ReadAsStringAsync();\nConsole.WriteLine(\"API response received.\");\nConsole.WriteLine(apiResult);\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use C# to call the pdfRest Convert PDF Colors API, enabling you to automate the conversion of color PDFs to black and white. This example demonstrates how to set up and send a multipart API request, process the response, and handle PDF files programmatically.\u003C\u002Fp>\n\n\u003Cp>To explore more functionalities, demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. Note that this is an example of a multipart API call, and code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-converted-colors.cs\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-05T17:48:47.000+00:00","2026-09-02T18:27:33.000+00:00","Learn how to convert color PDFs to black and white using pdfRest Convert PDF Colors API Tool with C#","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert PDF Files from Color to Black and White (Grayscale) in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-11-05T17:48:47.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:24.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert color PDFs to black and white using pdfRest Convert PDF Colors API Tool with C#\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert PDF Colors API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-converted-colors API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-colors\"\n        }\n      ],\n      \"keywords\": \".NET, Black & White, Convert PDF Colors, Print\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF Files from Color to Black and White (Grayscale) in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5293,5294,5295,5296,5297,5298],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2161,"name":2162,"slug":2163,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2177,"name":2178,"slug":2179,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2137,"name":2138,"slug":2139,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-in-net-with-c\u002F","How to Convert PDF Files from Color to Black and White (Grayscale) in .NET with C#, Tutorial | pdfRest",{"id":5303,"uuid":5304,"title":5305,"slug":5306,"html":5307,"comment_id":5303,"feature_image":48,"featured":284,"visibility":1257,"created_at":5308,"updated_at":5289,"published_at":5308,"custom_excerpt":5309,"codeinjection_head":5310,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5311,"primary_tag":5318,"url":5319,"excerpt":5309,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5320,"meta_description":5309,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"672a5b15533c9f26b9438b2a","fadbcb96-923a-4630-b768-e6ebce88500b","How to Convert PDF Files from Color to Black and White (Grayscale) with cURL","how-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDFs from Color to Black and White with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F'>Convert PDF Colors API Tool\u003C\u002Fa> is a powerful feature that allows users to change the color profile of a PDF document. This tutorial will guide you through the process of sending an API call to convert a color PDF to grayscale using cURL, a command-line tool for transferring data with URLs. By following this tutorial, you'll learn how to interact with the pdfRest API to modify PDF color settings efficiently.\u003C\u002Fp>\n\n\u003Cp>In a real-world scenario, a user might need to convert a PDF to black and white for various reasons, such as reducing file size, improving readability on certain devices, or preparing documents for printing. For instance, a document preparation specialist might need to convert a colorful PDF report into a grayscale version for archival purposes or to reduce printing costs. This tool provides a seamless way to make these adjustments programmatically.\u003C\u002Fp>\n\n\u003Ch2>Convert PDFs from Color to Black and White with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\" \\\n  -F \"color_profile=gamma-22\"\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-converted-colors.sh\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>Let's take a closer look at each part of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors\"\n\u003C\u002Fpre>\n\n\u003Cp>This line initiates a POST request to the pdfRest API endpoint for converting PDF colors. The \u003Ccode>-X POST\u003C\u002Fcode> flag specifies the request method.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\n\u003C\u002Fpre>\n\n\u003Cp>This header tells the server that the client expects the response in JSON format, which is a common format for API responses.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\n\u003C\u002Fpre>\n\n\u003Cp>This header specifies that the request body will be sent as \u003Ccode>multipart\u002Fform-data\u003C\u002Fcode>, which is necessary when uploading files.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>Api-Key\u003C\u002Fcode> header is used for authentication. Replace \u003Ccode>xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\u003C\u002Fcode> with your actual API key, which you can obtain from your pdfRest account.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\n\u003C\u002Fpre>\n\n\u003Cp>This form field uploads the PDF file you want to convert. Replace \u003Ccode>\u002Fpath\u002Fto\u002Ffile\u003C\u002Fcode> with the actual path to your PDF document.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>This field specifies the name of the output file. You can change \u003Ccode>example_out\u003C\u002Fcode> to your desired output filename.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"color_profile=gamma-22\"\n\u003C\u002Fpre>\n\n\u003Cp>This field sets the target color profile for the conversion. In this example, the colors are being converted to the gamma-22 profile.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use cURL to send an API request to the pdfRest Convert PDF Colors endpoint. This process allows you to programmatically adjust the color profile of PDF documents to meet specific requirements, like converting color to black and white. To explore more features, consider trying out all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. This example demonstrates a multipart API call, and you can find code samples using JSON payloads at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-converted-colors.sh\">this GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-05T17:51:17.000+00:00","Learn how to convert PDFs from color to black and white with cURL using pdfRest Convert PDF Colors API Tool","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-curl\u002F#article\",\n      \"headline\": \"How to Convert PDF Files from Color to Black and White (Grayscale) with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-curl\u002F\",\n      \"datePublished\": \"2024-11-05T17:51:17.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:23.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert PDFs from color to black and white with cURL using pdfRest Convert PDF Colors API Tool\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert PDF Colors API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-converted-colors API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-colors\"\n        }\n      ],\n      \"keywords\": \"Black & White, Convert PDF Colors, Print, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF Files from Color to Black and White (Grayscale) with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5312,5313,5314,5315,5316,5317],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2161,"name":2162,"slug":2163,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2177,"name":2178,"slug":2179,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2137,"name":2138,"slug":2139,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-curl\u002F","How to Convert PDF Files from Color to Black and White (Grayscale) with cURL, Tutorial | pdfRest",{"id":5322,"uuid":5323,"title":5324,"slug":5325,"html":5326,"comment_id":5322,"feature_image":48,"featured":284,"visibility":1257,"created_at":5327,"updated_at":5328,"published_at":5327,"custom_excerpt":5329,"codeinjection_head":5330,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5331,"primary_tag":5338,"url":5339,"excerpt":5329,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5340,"meta_description":5329,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"672bce2a533c9f26b9438c3f","8e327ae1-697f-4c04-8f13-c2fb0161ec0f","How to Convert PDF Files from Color to Black and White (Grayscale) with Java","how-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDFs from Color to Black and White with Java?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F'>Convert PDF Colors API Tool\u003C\u002Fa> is designed to help developers convert the color profiles of PDF documents efficiently. This tutorial will guide you through the process of sending an API call to convert a color PDF to grayscale using Java. By leveraging this tool, you can ensure that your PDF documents are compatible with different color standards, which is particularly useful in professional printing and digital publishing.\u003C\u002Fp>\n\n\u003Cp>Imagine a scenario where a document preparation specialist needs to convert a colorful PDF report into a black and white version for archival purposes or to reduce file size. By using the Convert PDF Colors API, the specialist can easily convert the document to grayscale, ensuring readability and compatibility with different devices and software.\u003C\u002Fp>\n\n\u003Ch2>Convert PDFs from Color to Black and White with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONObject;\n\npublic class PDFWithConvertedColors {\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  private static final String color_profile = \"gamma-22\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"color_profile\", color_profile)\n            .addFormDataPart(\"output\", \"pdfrest_pdf_with_converted_colors\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPDFWithConvertedColors.java\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary libraries, including OkHttp for HTTP requests and Dotenv for environment variable management. The \u003Ccode>DEFAULT_FILE_PATH\u003C\u002Fcode> and \u003Ccode>DEFAULT_API_KEY\u003C\u002Fcode> are placeholders for the PDF file path and API key, respectively.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">File inputFile;\nif (args.length > 0) {\n  inputFile = new File(args[0]);\n} else {\n  inputFile = new File(DEFAULT_FILE_PATH);\n}\n\u003C\u002Fpre>\n\n\u003Cp>This snippet determines the PDF file to be processed, either from command-line arguments or a default path.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n    RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n\u003C\u002Fpre>\n\n\u003Cp>Here, the PDF file is wrapped in a \u003Ccode>RequestBody\u003C\u002Fcode> object, specifying its media type as \"application\u002Fpdf\".\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">RequestBody requestBody =\n    new MultipartBody.Builder()\n        .setType(MultipartBody.FORM)\n        .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n        .addFormDataPart(\"color_profile\", color_profile)\n        .addFormDataPart(\"output\", \"pdfrest_pdf_with_converted_colors\")\n        .build();\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>requestBody\u003C\u002Fcode> is constructed using a multipart form, including the file, the desired color profile (\"srgb\"), and the output format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Request request =\n    new Request.Builder()\n        .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n        .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors\")\n        .post(requestBody)\n        .build();\n\u003C\u002Fpre>\n\n\u003Cp>This part builds the HTTP request, setting the API key and endpoint URL, and attaching the multipart \u003Ccode>requestBody\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we demonstrated how to convert PDF colors using the pdfRest API with Java. This process involved constructing a multipart HTTP request to the pdfRest endpoint. To explore more capabilities, try out all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example uses a multipart API call. For code samples using JSON payloads, visit the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPDFWithConvertedColors.java\">GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-06T20:14:34.000+00:00","2026-09-02T18:27:34.000+00:00","Learn how to use pdfRest Convert PDF Colors to convert color PDFs to black & white with Java","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-java\u002F#article\",\n      \"headline\": \"How to Convert PDF Files from Color to Black and White (Grayscale) with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-java\u002F\",\n      \"datePublished\": \"2024-11-06T20:14:34.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:22.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Convert PDF Colors to convert color PDFs to black & white with Java\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert PDF Colors API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-converted-colors API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-colors\"\n        }\n      ],\n      \"keywords\": \"Black & White, Color Management, Convert PDF Colors, Java\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF Files from Color to Black and White (Grayscale) with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5332,5333,5334,5335,5336,5337],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2161,"name":2162,"slug":2163,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2149,"name":2150,"slug":2151,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2177,"name":2178,"slug":2179,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-java\u002F","How to Convert PDF Files from Color to Black and White (Grayscale) with Java, Tutorial | pdfRest",{"id":5342,"uuid":5343,"title":5344,"slug":5345,"html":5346,"comment_id":5342,"feature_image":48,"featured":284,"visibility":1257,"created_at":5347,"updated_at":5328,"published_at":5347,"custom_excerpt":5348,"codeinjection_head":5349,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5350,"primary_tag":5357,"url":5358,"excerpt":5348,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5359,"meta_description":5348,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"672a5adb533c9f26b9438b20","4afe9951-557c-407c-b2f3-238d3821040c","How to Convert PDF Files from Color to Black and White (Grayscale) with JavaScript in NodeJS","how-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDFs from Color to Black and White with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F'>Convert PDF Colors API Tool\u003C\u002Fa> is a powerful utility that allows users to change the color profile of a PDF document. This tutorial will demonstrate how to send an API call to convert a color PDF to grayscale using JavaScript, providing a practical example of integrating this functionality into your applications. By understanding this process, developers can automate color conversion tasks, ensuring PDFs meet specific color standards or requirements.\u003C\u002Fp>\n\n\u003Cp>A user might need to convert a PDF to black and white for various reasons, such as reducing file size, improving readability on certain devices, or preparing documents for printing. For example, a document preparation specialist might need to convert a colorful PDF report into a grayscale version for archival purposes or to reduce printing costs. This tool provides a streamlined way to handle such conversions programmatically.\u003C\u002Fp>\n\n\u003Ch2>Convert PDFs from Color to Black and White with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to reduce the file size of a PDF.\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('color_profile', 'gamma-22');\ndata.append('output', 'pdfrest_pdf_with_converted_colors');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-converted-colors.js\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary modules: \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests, \u003Ccode>form-data\u003C\u002Fcode> for handling form submissions, and \u003Ccode>fs\u003C\u002Fcode> for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('color_profile', 'gamma-22');\ndata.append('output', 'pdfrest_pdf_with_converted_colors');\n\u003C\u002Fpre>\n\n\u003Cp>Here, a new \u003Ccode>FormData\u003C\u002Fcode> instance is created, and the PDF file is appended using \u003Ccode>fs.createReadStream()\u003C\u002Fcode>. The \u003Ccode>color_profile\u003C\u002Fcode> parameter is set to 'gamma-22', indicating the desired color profile for conversion. The \u003Ccode>output\u003C\u002Fcode> parameter specifies the filename for the converted PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors',\n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>config\u003C\u002Fcode> object defines the request configuration for \u003Ccode>axios\u003C\u002Fcode>. It specifies the HTTP method as 'POST', sets the request URL, and includes headers with the API key and form data headers. The \u003Ccode>maxBodyLength\u003C\u002Fcode> is set to \u003Ccode>Infinity\u003C\u002Fcode> to accommodate large files.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\u003C\u002Fpre>\n\n\u003Cp>This section sends the request using \u003Ccode>axios\u003C\u002Fcode> and handles the response or any errors. The response data is logged to the console in JSON format.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial demonstrated how to use JavaScript to call the pdfRest Convert PDF Colors API, allowing you to automate PDF color profile conversions. To explore more possibilities, you can demo all pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further details, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example is a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-converted-colors.js\">this GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-05T17:50:19.000+00:00","Learn how to convert PDFs from color to black and white using pdfRest Convert PDF Colors API Tool with JavaScript","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert PDF Files from Color to Black and White (Grayscale) with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-11-05T17:50:19.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:24.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert PDFs from color to black and white using pdfRest Convert PDF Colors API Tool with JavaScript\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert PDF Colors API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-converted-colors API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-colors\"\n        }\n      ],\n      \"keywords\": \"Black & White, Convert PDF Colors, JavaScript, Print\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF Files from Color to Black and White (Grayscale) with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5351,5352,5353,5354,5355,5356],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2161,"name":2162,"slug":2163,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2177,"name":2178,"slug":2179,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2137,"name":2138,"slug":2139,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-javascript-in-nodejs\u002F","How to Convert PDF Files from Color to Black and White (Grayscale) with JavaScript in NodeJS, Tutorial | pdfRest",{"id":5361,"uuid":5362,"title":5363,"slug":5364,"html":5365,"comment_id":5361,"feature_image":48,"featured":284,"visibility":1257,"created_at":5366,"updated_at":5328,"published_at":5366,"custom_excerpt":5367,"codeinjection_head":5368,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5369,"primary_tag":5376,"url":5377,"excerpt":5367,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5378,"meta_description":5367,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"672a5a32533c9f26b9438b0c","832c56d9-edd6-41f2-9e08-76f92fabebf8","How to Convert PDF Files from Color to Black and White (Grayscale) with PHP","how-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDFs from Color to Black and White with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F'>Convert PDF Colors API Tool\u003C\u002Fa> is a powerful resource for developers looking to programmatically alter the color profiles of PDF documents. This tutorial will guide you through the process of sending an API call to convert a color PDF to black and white using PHP, leveraging the capabilities of the pdfRest API. By following this tutorial, you'll learn how to integrate this functionality into your PHP applications, enabling automated color conversion for your PDF files.\u003C\u002Fp>\n\n\u003Cp>In real-world scenarios, converting PDF colors to grayscale can be crucial for various purposes. For instance, a document preparation specialist might need to convert a colorful PDF report into a black and white version for archival purposes, to reduce file size, or to improve readability on certain devices. By using the Convert PDF Colors API, these conversions can be done quickly and efficiently, saving time and reducing the potential for human error.\u003C\u002Fp>\n\n\n\u003Ch2>Convert PDFs from Color to Black and White with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">\nrequire 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\n$headers = [\n  'Api-Key' =--> 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile', \u002F\u002F Set the filename for the file to be converted, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'color_profile', \u002F\u002F Specify the field name for the color profile.\n      'contents' => 'gamma-22' \u002F\u002F Set the value for the color profile (in this case, 'gamma-22').\n    ],\n    [\n      'name' => 'output', \u002F\u002F Specify the field name for the output option.\n      'contents' => 'pdfrest_pdf_with_converted_colors' \u002F\u002F Set the value for the output option (in this case, 'pdfrest_pdf_with_converted_colors').\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the converted PDF content.\n\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-converted-colors.php\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by requiring the autoload file to load the Guzzle HTTP client, which is essential for making HTTP requests in PHP:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">require 'vendor\u002Fautoload.php';\n\u003C\u002Fpre>\n\n\u003Cp>Next, the Guzzle HTTP client and related classes are imported:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">use GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\u003C\u002Fpre>\n\n\u003Cp>An instance of the Guzzle HTTP client is created to facilitate sending requests:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$client = new Client();\n\u003C\u002Fpre>\n\n\u003Cp>The headers array includes the API key for authentication. Replace 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' with your actual API key:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The options array is configured for a multipart request. It includes the file to be converted, specifying the field name and opening the file for reading:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'color_profile',\n      'contents' => 'gamma-22'\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_pdf_with_converted_colors'\n    ]\n  ]\n];\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>The request is created with a POST method to the specified API endpoint, including the headers:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors', $headers);\n\u003C\u002Fpre>\n\n\u003Cp>The request is sent asynchronously, and the response is awaited:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$res = $client->sendAsync($request, $options)->wait();\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the response body, which contains the converted PDF content, is output:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">echo $res->getBody();\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use PHP to call the pdfRest Convert PDF Colors API, which allows you to automate the process of converting color PDF documents to grayscale. This can be particularly useful for optimizing files for black and white printing. To further explore the capabilities of the pdfRest API, consider experimenting with other tools available in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>For more detailed information about the API endpoints and parameters, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. Additionally, note that this example demonstrates a multipart API call, and code samples using JSON payloads can be found at the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-converted-colors.php\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-05T17:47:30.000+00:00","Learn how to convert color PDFs to black and white with PHP using pdfRest Convert PDF Colors API Tool","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-php\u002F#article\",\n      \"headline\": \"How to Convert PDF Files from Color to Black and White (Grayscale) with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-php\u002F\",\n      \"datePublished\": \"2024-11-05T17:47:30.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:24.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert color PDFs to black and white with PHP using pdfRest Convert PDF Colors API Tool\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert PDF Colors API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-converted-colors API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-colors\"\n        }\n      ],\n      \"keywords\": \"Black & White, Convert PDF Colors, PHP, Print\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF Files from Color to Black and White (Grayscale) with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5370,5371,5372,5373,5374,5375],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2161,"name":2162,"slug":2163,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2177,"name":2178,"slug":2179,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2137,"name":2138,"slug":2139,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-php\u002F","How to Convert PDF Files from Color to Black and White (Grayscale) with PHP, Tutorial | pdfRest",{"id":5380,"uuid":5381,"title":5382,"slug":5383,"html":5384,"comment_id":5380,"feature_image":48,"featured":284,"visibility":1257,"created_at":5385,"updated_at":5386,"published_at":5385,"custom_excerpt":5387,"codeinjection_head":5388,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5389,"primary_tag":5396,"url":5397,"excerpt":5387,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5398,"meta_description":5387,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"672a59ce533c9f26b9438b02","485b3486-d4be-473f-a1fe-b8abb002e978","How to Convert PDF Files from Color to Black and White (Grayscale) with Python","how-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDFs from Color to Black and White with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F'>Convert PDF Colors API Tool\u003C\u002Fa> is a powerful resource for developers who need to manipulate the color profiles of PDF documents programmatically. This tutorial will guide you through the process of sending an API call to convert a color PDF to black and white using Python. By leveraging this API, you can automate the process of converting color PDFs to black and white, which is especially useful for creating print-ready documents or reducing file size.\u003C\u002Fp>\n\n\u003Cp>In a real-world scenario, a document preparation specialist might need to convert a colorful PDF report into a grayscale version for archival purposes or to reduce printing costs. By using the Convert PDF Colors API, this conversion can be done quickly and efficiently, saving time and reducing the potential for human error.\u003C\u002Fp>\n\n\n\u003Ch2>Convert PDFs from Color to Black and White with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\npdf_with_converted_colors_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors'\n\n# The \u002Fpdf-with-converted-colors endpoint can take a single PDF file or id as input.\n# This sample demonstrates setting color_profile to 'gamma-22'.\nmp_encoder_pdfWithConvertedColors = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_pdfWithConvertedColors_out',\n        'color_profile': 'gamma-22',\n    }\n)\n\n# Let's set the headers that the pdf-with-converted-colors endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdfWithConvertedColors.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to pdf-with-converted-colors endpoint...\")\nresponse = requests.post(pdf_with_converted_colors_endpoint_url, data=mp_encoder_pdfWithConvertedColors, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-converted-colors.py\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary libraries: \u003Ccode>requests_toolbelt\u003C\u002Fcode> for handling multipart form data, \u003Ccode>requests\u003C\u002Fcode> for making HTTP requests, and \u003Ccode>json\u003C\u002Fcode> for parsing JSON data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">pdf_with_converted_colors_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors'\n\u003C\u002Fpre>\n\n\u003Cp>This line sets the URL for the Convert PDF Colors API endpoint. This is where the POST request will be sent.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_pdfWithConvertedColors = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_pdfWithConvertedColors_out',\n        'color_profile': 'gamma-22',\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>MultipartEncoder\u003C\u002Fcode> is used to encode the fields for the multipart form data. The \u003Ccode>'file'\u003C\u002Fcode> field contains the PDF file to be converted. The \u003Ccode>'output'\u003C\u002Fcode> field specifies the name of the output file. The \u003Ccode>'color_profile'\u003C\u002Fcode> field is set to \u003Ccode>'gamma-22'\u003C\u002Fcode>, which is the desired color profile for the conversion.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdfWithConvertedColors.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\u003C\u002Fpre>\n\n\u003Cp>The headers are set to specify that the response should be in JSON format. The \u003Ccode>'Content-Type'\u003C\u002Fcode> is automatically set to \u003Ccode>'multipart\u002Fform-data'\u003C\u002Fcode> by the \u003Ccode>MultipartEncoder\u003C\u002Fcode>. The \u003Ccode>'Api-Key'\u003C\u002Fcode> is a placeholder for your actual API key, which authenticates your request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(pdf_with_converted_colors_endpoint_url, data=mp_encoder_pdfWithConvertedColors, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This line sends the POST request to the API endpoint with the encoded data and headers. The response is stored in the \u003Ccode>response\u003C\u002Fcode> variable.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>If the request is successful, the response is parsed as JSON and printed in a formatted manner. If not, the error message is printed.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use the pdfRest Convert PDF Colors API with Python to change the color profile of a PDF document from color to grayscale. This can be particularly useful for black and white print optimization. We encourage you to explore all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-converted-colors.py\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-05T17:45:50.000+00:00","2026-09-02T18:27:35.000+00:00","Learn how to use Convert PDF Colors API Tool from pdfRest to convert color PDFs to black and white with Python","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-python\u002F#article\",\n      \"headline\": \"How to Convert PDF Files from Color to Black and White (Grayscale) with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-python\u002F\",\n      \"datePublished\": \"2024-11-05T17:45:50.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:24.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use Convert PDF Colors API Tool from pdfRest to convert color PDFs to black and white with Python\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert PDF Colors API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-converted-colors API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-colors\"\n        }\n      ],\n      \"keywords\": \"Black & White, Convert PDF Colors, Print, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF Files from Color to Black and White (Grayscale) with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5390,5391,5392,5393,5394,5395],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2161,"name":2162,"slug":2163,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2177,"name":2178,"slug":2179,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2137,"name":2138,"slug":2139,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-files-from-color-to-black-and-white-grayscale-with-python\u002F","How to Convert PDF Files from Color to Black and White (Grayscale) with Python, Tutorial | pdfRest",{"id":5400,"uuid":5401,"title":5402,"slug":5403,"html":5404,"comment_id":5400,"feature_image":48,"featured":284,"visibility":1257,"created_at":5405,"updated_at":5386,"published_at":5405,"custom_excerpt":5406,"codeinjection_head":5407,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5408,"primary_tag":5416,"url":5417,"excerpt":5406,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5418,"meta_description":5406,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6717b5bb533c9f26b943895f","2b0b5081-1382-43c9-8a31-98dbb9830de2","How to Convert PDF Files from RGB to CMYK in .NET with C#","how-to-convert-pdf-files-from-rgb-to-cmyk-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF from RGB to CMYK with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F'>Convert PDF Colors API Tool\u003C\u002Fa> is a valuable resource for developers working with PDF documents that require precise color control, especially when converting from RGB to CMYK. This tutorial will guide you through the process of using C# to send an API call to the Convert PDF Colors endpoint, allowing you to effortlessly achieve this color profile conversion.\u003C\u002Fp>\n\n\u003Cp>Converting RGB (Red, Green, Blue) colors to CMYK (Cyan, Magenta, Yellow, Black) is essential for preparing PDF documents for printing. CMYK is the color model used by most printers, and accurately converting RGB colors to CMYK ensures that the printed colors match the intended appearance. This is particularly important for projects like brochures, magazines, and marketing materials where color accuracy is crucial.\u003C\u002Fp>\n\n\u003Ch2>Convert PDF from RGB to CMYK with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf-with-converted-colors\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"acrobat9-cmyk\"));\n        multipartContent.Add(byteArrayOption, \"color_profile\");\n\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-converted-colors.cs\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by creating an instance of \u003Ccode>HttpClient\u003C\u002Fcode> with the base address set to the pdfRest API URL:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") }\n\u003C\u002Fpre>\n\n\u003Cp>Next, a \u003Ccode>HttpRequestMessage\u003C\u002Fcode> is instantiated for a POST request to the \u003Ccode>pdf-with-converted-colors\u003C\u002Fcode> endpoint. The API key is added to the request headers to authenticate the call:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>The request expects a JSON response, indicated by adding \"application\u002Fjson\" to the Accept headers:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n\u003C\u002Fpre>\n\n\u003Cp>A \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> object is created to hold the file data and additional parameters. The PDF file is read into a byte array and added to the multipart content:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name\");\n\u003C\u002Fpre>\n\n\u003Cp>The content type for the file is set to \"application\u002Fpdf\". The color profile option is specified as \"acrobat9-cmyk\" and added to the multipart content:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"acrobat9-cmyk\"));\nmultipartContent.Add(byteArrayOption, \"color_profile\");\n\u003C\u002Fpre>\n\n\u003Cp>The request is sent asynchronously, and the response content is read and printed to the console:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\nvar apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you have learned how to use C# to call the pdfRest Convert PDF Colors API, allowing you to convert the color profiles of PDF documents from RGB to CMYK programmatically. This can be an invaluable tool for ensuring consistency across different media and platforms.\u003C\u002Fp>\n\n\u003Cp>To explore more features, demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on each API endpoint, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. Note that this is an example of a multipart API call, and code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-converted-colors.cs\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-10-22T14:24:59.000+00:00","Learn how to convert PDF color profile from RGB to CMYK using pdfRest API Toolkit with C#","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert PDF Files from RGB to CMYK in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-10-22T14:24:59.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:25.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert PDF color profile from RGB to CMYK using pdfRest API Toolkit with C#\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert PDF Colors API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-converted-colors API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-colors\"\n        }\n      ],\n      \"keywords\": \".NET, CMYK, Color Management, Convert PDF Colors, RGB\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF Files from RGB to CMYK in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5409,5410,5411,5412,5413,5414,5415],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2161,"name":2162,"slug":2163,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2149,"name":2150,"slug":2151,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2169,"name":2170,"slug":2171,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2165,"name":2166,"slug":2167,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-in-net-with-c\u002F","How to Convert PDF Files from RGB to CMYK in .NET with C#, Tutorial | pdfRest",{"id":5420,"uuid":5421,"title":5422,"slug":5423,"html":5424,"comment_id":5420,"feature_image":48,"featured":284,"visibility":1257,"created_at":5425,"updated_at":5426,"published_at":5425,"custom_excerpt":5427,"codeinjection_head":5428,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5429,"primary_tag":5437,"url":5438,"excerpt":5427,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5439,"meta_description":5427,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6717b644533c9f26b9438973","f499f2f8-a275-4b4a-9573-9248387b3765","How to Convert PDF Files from RGB to CMYK with cURL","how-to-convert-pdf-files-from-rgb-to-cmyk-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF from RGB to CMYK with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F'>Convert PDF Colors API Tool\u003C\u002Fa> is a valuable resource for developers working with PDF documents that require precise color control, especially when converting from RGB to CMYK. This tutorial will guide you through the process of using cURL, a command-line tool, to send an API call to the Convert PDF Colors endpoint, allowing you to effortlessly achieve this color profile conversion.\u003C\u002Fp>\n\n\u003Cp>Converting RGB (Red, Green, Blue) colors to CMYK (Cyan, Magenta, Yellow, Black) is essential for preparing PDF documents for printing. CMYK is the color model used by most printers, and accurately converting RGB colors to CMYK ensures that the printed colors match the intended appearance. This is particularly important for projects like technical manuals, product catalogs, or educational materials where color accuracy is crucial.\u003C\u002Fp>\n\n\u003Ch2>Convert PDF from RGB to CMYK with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\" \\\n  -F \"color_profile=acrobat9-cmyk\"\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-converted-colors.sh\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This cURL command sends a POST request to the pdfRest API endpoint for converting PDF colors. Let's break down each part:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors\"\u003C\u002Fpre>\n\n\u003Cp>This line specifies that we are making a POST request to the given URL, which is the endpoint for converting PDF colors.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the client expects a JSON response from the server. JSON is a lightweight data-interchange format that is easy to read and write.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\u003C\u002Fpre>\n\n\u003Cp>This header specifies that the request body will be sent as a multipart form data. This is necessary when uploading files and sending form data in the same request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\u003C\u002Fpre>\n\n\u003Cp>The API key is used for authenticating the request. Replace the placeholder with your actual API key to authorize the request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\u003C\u002Fpre>\n\n\u003Cp>This form field uploads the PDF file that you want to convert. Replace \u003Ccode>\u002Fpath\u002Fto\u002Ffile\u003C\u002Fcode> with the actual path to your PDF file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\u003C\u002Fpre>\n\n\u003Cp>This form field specifies the desired name of the output file. The converted PDF will be saved with this name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"color_profile=acrobat9-cmyk\"\u003C\u002Fpre>\n\n\u003Cp>This form field sets the target color profile for the conversion. In this example, the color profile is set to acrobat9-cmyk, which is commonly used for print optimization.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use cURL to send a request to the pdfRest API to convert the color profile of a PDF document from RGB to CMYK. This is just one of the many capabilities offered by pdfRest API Tools. We encourage you to explore the full range of tools available in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>For more detailed information on each API endpoint, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. This example demonstrates a multipart API call, but you can also find code samples using JSON payloads at the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-converted-colors.sh\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-10-22T14:27:16.000+00:00","2026-09-02T18:27:36.000+00:00","Learn how to use pdfRest API Toolkit to convert PDF colors from RGB to CMYK with cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-curl\u002F#article\",\n      \"headline\": \"How to Convert PDF Files from RGB to CMYK with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-curl\u002F\",\n      \"datePublished\": \"2024-10-22T14:27:16.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:24.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest API Toolkit to convert PDF colors from RGB to CMYK with cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert PDF Colors API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-converted-colors API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-colors\"\n        }\n      ],\n      \"keywords\": \"CMYK, Color Management, Convert PDF Colors, RGB, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF Files from RGB to CMYK with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5430,5431,5432,5433,5434,5435,5436],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2161,"name":2162,"slug":2163,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2149,"name":2150,"slug":2151,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2169,"name":2170,"slug":2171,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2165,"name":2166,"slug":2167,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-curl\u002F","How to Convert PDF Files from RGB to CMYK with cURL, Tutorial | pdfRest",{"id":5441,"uuid":5442,"title":5443,"slug":5444,"html":5445,"comment_id":5441,"feature_image":48,"featured":284,"visibility":1257,"created_at":5446,"updated_at":5426,"published_at":5447,"custom_excerpt":5448,"codeinjection_head":5449,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5450,"primary_tag":5458,"url":5459,"excerpt":5448,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5460,"meta_description":5448,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"672bcebf533c9f26b9438c49","1bdc2b15-c59f-46ab-b790-e57b0fca9553","How to Convert PDF Files from RGB to CMYK with Java","how-to-convert-pdf-files-from-rgb-to-cmyk-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDFs from RGB to CMYK with Java?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F'>Convert PDF Colors API Tool\u003C\u002Fa> is a powerful utility that allows developers to programmatically change the color profile of a PDF document. This tutorial will guide you through the process of sending an API call to convert a PDF from RGB to CMYK using Java. By following along, you'll learn how to integrate the pdfRest API into your Java applications, enabling you to automate the conversion of PDF color profiles with ease.\u003C\u002Fp>\n\n\u003Cp>Imagine you're a graphic designer working on a project that requires printing high-quality images. You've created your design in RGB color mode, which is ideal for digital screens. However, to ensure accurate color reproduction on print, you need to convert the document to CMYK color mode. By using the Convert PDF Colors API, you can automate this conversion process, saving time and ensuring that your design is printed with the desired colors.\u003C\u002Fp>\n\n\u003Ch2>Convert PDFs from RGB to CMYK with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONObject;\n\npublic class PDFWithConvertedColors {\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  private static final String color_profile = \"acrobat9-cmyk\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"color_profile\", color_profile)\n            .addFormDataPart(\"output\", \"pdfrest_pdf_with_converted_colors\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPDFWithConvertedColors.java\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary libraries, including OkHttp for HTTP requests and Dotenv for environment variable management. The \u003Ccode>DEFAULT_FILE_PATH\u003C\u002Fcode> and \u003Ccode>DEFAULT_API_KEY\u003C\u002Fcode> are placeholders for your PDF file path and API key, respectively.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">File inputFile;\nif (args.length > 0) {\n  inputFile = new File(args[0]);\n} else {\n  inputFile = new File(DEFAULT_FILE_PATH);\n}\n\u003C\u002Fpre>\n\n\u003Cp>This snippet determines the PDF file to be processed. If a file path is provided as a command-line argument, it uses that; otherwise, it defaults to the specified \u003Ccode>DEFAULT_FILE_PATH\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>Dotenv\u003C\u002Fcode> library is used to load environment variables from a \u003Ccode>.env\u003C\u002Fcode> file, allowing for secure storage of sensitive data like API keys.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">RequestBody requestBody =\n    new MultipartBody.Builder()\n        .setType(MultipartBody.FORM)\n        .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n        .addFormDataPart(\"color_profile\", color_profile)\n        .addFormDataPart(\"output\", \"pdfrest_pdf_with_converted_colors\")\n        .build();\n\u003C\u002Fpre>\n\n\u003Cp>Here, a \u003Ccode>MultipartBody\u003C\u002Fcode> is constructed to include the PDF file and additional form data. The \u003Ccode>color_profile\u003C\u002Fcode> is set to \"srgb\", and the output is specified as \"pdfrest_pdf_with_converted_colors\".\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Request request =\n    new Request.Builder()\n        .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n        .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors\")\n        .post(requestBody)\n        .build();\n\u003C\u002Fpre>\n\n\u003Cp>This snippet constructs the HTTP request, setting the API key in the header and specifying the endpoint URL. The request method is POST, and the previously built \u003Ccode>requestBody\u003C\u002Fcode> is attached.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use Java to call the pdfRest Convert PDF Colors API, enabling you to automate the conversion of PDF color profiles. This can be particularly useful for ensuring consistent document quality across various platforms.\u003C\u002Fp>\n\n\u003Cp>To explore more functionalities, try out all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example demonstrates a multipart API call. For code samples using JSON payloads, please visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPDFWithConvertedColors.java\">this GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-06T20:17:03.000+00:00","2024-11-06T20:17:04.000+00:00","Learn how to convert color PDFs to black & white using pdfRest Convert PDF Colors API Tool with Java","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-java\u002F#article\",\n      \"headline\": \"How to Convert PDF Files from RGB to CMYK with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-java\u002F\",\n      \"datePublished\": \"2024-11-06T20:17:04.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:22.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert color PDFs to black & white using pdfRest Convert PDF Colors API Tool with Java\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert PDF Colors API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-converted-colors API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-colors\"\n        }\n      ],\n      \"keywords\": \"CMYK, Color Management, Convert PDF Colors, Java, RGB\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF Files from RGB to CMYK with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5451,5452,5453,5454,5455,5456,5457],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2161,"name":2162,"slug":2163,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2149,"name":2150,"slug":2151,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2165,"name":2166,"slug":2167,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2169,"name":2170,"slug":2171,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-java\u002F","How to Convert PDF Files from RGB to CMYK with Java, Tutorial | pdfRest",{"id":5462,"uuid":5463,"title":5464,"slug":5465,"html":5466,"comment_id":5462,"feature_image":48,"featured":284,"visibility":1257,"created_at":5467,"updated_at":5468,"published_at":5467,"custom_excerpt":5469,"codeinjection_head":5470,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5471,"primary_tag":5479,"url":5480,"excerpt":5469,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5481,"meta_description":5469,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6717b61f533c9f26b9438969","e8fda3a9-2d0d-43d1-9cd5-58973fe866b7","How to Convert PDF Files from RGB to CMYK with JavaScript in NodeJS","how-to-convert-pdf-files-from-rgb-to-cmyk-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Convert RGB PDF Content to CMYK with Node.js\u003C\u002Fh2>\n\n\u003Cp>PDFs created for screens often use RGB color, while many commercial printing workflows expect CMYK output prepared for a defined printing condition. A simple label change is not enough: the color values must be transformed so the printed result represents the source colors as accurately as the selected profile allows. The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F\">Convert PDF Colors API Tool\u003C\u002Fa> performs that conversion across PDF text, images, and other color-managed content through the \u003Ccode>\u002Fpdf-with-converted-colors\u003C\u002Fcode> endpoint.\u003C\u002Fp>\n\n\u003Cp>pdfRest provides preset color profiles for common RGB, CMYK, grayscale, and black-and-white workflows and also accepts custom ICC profiles when a printer or production standard requires one. The conversion is powered by Adobe PDF Library technology, giving applications a consistent server-side process without requiring local PDF rendering and color-management libraries.\u003C\u002Fp>\n\n\u003Cp>For example, a Node.js web-to-print service can receive a marketing brochure exported in RGB, convert it with a CMYK preset before sending it to a commercial print queue, and retain the output resource ID for a later preflight or PDF\u002FX step. Automating the conversion makes the preparation rule repeatable and supplies the intended CMYK output to the print provider's established preflight and proofing process.\u003C\u002Fp>\n\n\u003Cp>This example streams a local PDF through Axios and FormData, selects the \u003Ccode>acrobat9-cmyk\u003C\u002Fcode> preset, and prints the JSON response.\u003C\u002Fp>\n\n\u003Ch2>JavaScript RGB-to-CMYK Code Example\u003C\u002Fh2>\n\n\u003Cp>Install \u003Ccode>axios\u003C\u002Fcode> and \u003Ccode>form-data\u003C\u002Fcode>, then replace the API-key and local PDF path placeholders. Keep the profile value in application configuration when different print destinations require different output conditions.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to convert PDF colors from RGB to CMYK.\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('color_profile', 'acrobat9-cmyk');\ndata.append('output', 'pdfrest_pdf_with_converted_colors');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: apiUrl + '\u002Fpdf-with-converted-colors',\n  headers: {\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error);\n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-converted-colors.js\">pdfRest Convert PDF Colors multipart JavaScript sample\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Select the Output Color Profile\u003C\u002Fh2>\n\n\u003Cp>The \u003Ccode>color_profile\u003C\u002Fcode> field controls the conversion target. This tutorial uses the built-in \u003Ccode>acrobat9-cmyk\u003C\u002Fcode> preset to demonstrate an RGB-to-CMYK request. A preset is convenient when its intended color condition matches the workflow. When a print provider supplies a specific ICC profile, use the custom-profile option documented for the endpoint rather than assuming a generic CMYK profile will produce the required result.\u003C\u002Fp>\n\n\u003Cp>RGB and CMYK have different reproducible color ranges, so the selected profile defines how highly saturated screen colors are mapped into print. Choosing the intended preset or custom ICC profile gives pdfRest a controlled production target instead of leaving color conversion to an unspecified output device.\u003C\u002Fp>\n\n\u003Cp>\u003Ccode>data.getHeaders()\u003C\u002Fcode> supplies the multipart boundary required by the request. The PDF stream prevents Node.js from loading the complete input into memory, and \u003Ccode>maxBodyLength: Infinity\u003C\u002Fcode> avoids Axios rejecting the request because of its client-side body-size default.\u003C\u002Fp>\n\n\u003Ch2>Continue the Print Workflow\u003C\u002Fh2>\n\n\u003Cp>Check the response status and expected output fields before saving or forwarding the PDF. For production use, add a timeout, distinguish connection failures from API validation errors, and prevent documents or credentials from being written to shared logs. The converted PDF can then move directly into the print provider's normal preflight, proofing, or PDF\u002FX preparation process.\u003C\u002Fp>\n\n\u003Cp>The response resource ID can be passed directly to another pdfRest operation, such as converting the result to PDF\u002FX, without an intermediate download and upload. This makes color conversion one controlled stage in a larger automated print-preparation pipeline.\u003C\u002Fp>\n\n\u003Cp>When the source PDF is already uploaded, use a JSON payload with its resource ID. See the official \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-converted-colors.js\">Convert PDF Colors JSON-payload JavaScript sample\u003C\u002Fa>. Try presets in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-colors\">Convert PDF Colors API reference\u003C\u002Fa> for the current profile and custom-ICC parameters.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-10-22T14:26:39.000+00:00","2026-09-11T03:35:03.000+00:00","Learn how to convert PDF colors from RGB to CMYK using pdfRest API Toolkit with JavaScript","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert PDF Files from RGB to CMYK with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-10-22T14:26:39.000Z\",\n      \"dateModified\": \"2026-09-10T19:31:23.947Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert PDF colors from RGB to CMYK using pdfRest API Toolkit with JavaScript\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert PDF Colors API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-converted-colors API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-colors\"\n        }\n      ],\n      \"keywords\": \"CMYK, Color Management, Convert PDF Colors, JavaScript, RGB\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF Files from RGB to CMYK with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5472,5473,5474,5475,5476,5477,5478],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2161,"name":2162,"slug":2163,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2149,"name":2150,"slug":2151,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2169,"name":2170,"slug":2171,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2165,"name":2166,"slug":2167,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-javascript-in-nodejs\u002F","How to Convert PDF Files from RGB to CMYK with JavaScript in NodeJS, Tutorial | pdfRest",{"id":5483,"uuid":5484,"title":5485,"slug":5486,"html":5487,"comment_id":5483,"feature_image":48,"featured":284,"visibility":1257,"created_at":5488,"updated_at":5489,"published_at":5488,"custom_excerpt":5490,"codeinjection_head":5491,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5492,"primary_tag":5500,"url":5501,"excerpt":5490,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5502,"meta_description":5490,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6712d8ef533c9f26b9438949","5c68b11e-fb2a-43d3-a0af-60428bcb9691","How to Convert PDF Files from RGB to CMYK with PHP","how-to-convert-pdf-files-from-rgb-to-cmyk-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF from RGB to CMYK with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F'>Convert PDF Colors API Tool\u003C\u002Fa> offers a flexible and efficient way to modify the color profile of PDF documents. This tutorial will demonstrate how to use PHP, specifically with the Guzzle HTTP client, to send an API call to convert PDF colors, focusing on the common RGB to CMYK conversion.\u003C\u002Fp>\n\n\u003Cp>Converting RGB (Red, Green, Blue) colors to CMYK (Cyan, Magenta, Yellow, Black) is essential for preparing PDF documents for printing. CMYK is the color model used by most printers, and accurate RGB to CMYK conversions ensure that the printed colors align with the desired appearance. This is particularly important for projects like brochures, magazines, and marketing materials where color fidelity is crucial.\u003C\u002Fp>\n\n\u003Ch2>Convert PDF from RGB to CMYK with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">\nrequire 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\n$headers = [\n  'Api-Key' =--> 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile', \u002F\u002F Set the filename for the file to be converted, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'color_profile', \u002F\u002F Specify the field name for the color profile.\n      'contents' => 'acrobat9-cmyk' \u002F\u002F Set the value for the color profile (in this case, 'acrobat9-cmyk').\n    ],\n    [\n      'name' => 'output', \u002F\u002F Specify the field name for the output option.\n      'contents' => 'pdfrest_pdf_with_converted_colors' \u002F\u002F Set the value for the output option (in this case, 'pdfrest_pdf_with_converted_colors').\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the converted PDF content.\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-converted-colors.php\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by including the necessary libraries using the line:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">require 'vendor\u002Fautoload.php';\n\u003C\u002Fpre>\n\n\u003Cp>This line loads the Guzzle HTTP client, which is used to make HTTP requests.\u003C\u002Fp>\n\n\u003Cp>Next, we instantiate the Guzzle client:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$client = new Client();\n\u003C\u002Fpre>\n\n\u003Cp>This creates a new HTTP client that will be used to send requests.\u003C\u002Fp>\n\n\u003Cp>The API key is set in the headers for authentication purposes:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>Ensure you replace the placeholder with your actual API key.\u003C\u002Fp>\n\n\u003Cp>The options array is constructed to include the multipart data for the request:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'color_profile',\n      'contents' => 'acrobat9-cmyk'\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_pdf_with_converted_colors'\n    ]\n  ]\n];\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>The 'file' part specifies the PDF file to be converted. The 'color_profile' part sets the desired color profile, and the 'output' part determines the output format.\u003C\u002Fp>\n\n\u003Cp>The request is created and sent asynchronously:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors', $headers);\n$res = $client->sendAsync($request, $options)->wait();\n\u003C\u002Fpre>\n\n\u003Cp>This sends a POST request to the specified endpoint with the provided headers and options. The response is then outputted:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">echo $res->getBody();\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you successfully learned how to use PHP to send an API request to convert the colors of a PDF document from RGB to CMYK using the pdfRest Convert PDF Colors API Tool. This process can be integrated into larger applications where PDF color conversion is needed.\u003C\u002Fp>\n\n\u003Cp>For further exploration, consider trying out all the pdfRest API Tools available in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. You can also refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for more detailed information on each endpoint and its parameters.\u003C\u002Fp>\n\n\u003Cp>Note: This example demonstrates a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-converted-colors.php\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-10-18T21:53:51.000+00:00","2026-09-02T18:27:37.000+00:00","Learn how to convert PDFs from RGB to CMYK with PHP using pdfRest API Toolkit","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-php\u002F#article\",\n      \"headline\": \"How to Convert PDF Files from RGB to CMYK with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-php\u002F\",\n      \"datePublished\": \"2024-10-18T21:53:51.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:25.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert PDFs from RGB to CMYK with PHP using pdfRest API Toolkit\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert PDF Colors API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-converted-colors API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-colors\"\n        }\n      ],\n      \"keywords\": \"CMYK, Color Management, Convert PDF Colors, PHP, RGB\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF Files from RGB to CMYK with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5493,5494,5495,5496,5497,5498,5499],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2161,"name":2162,"slug":2163,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2149,"name":2150,"slug":2151,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2169,"name":2170,"slug":2171,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2165,"name":2166,"slug":2167,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-php\u002F","How to Convert PDF Files from RGB to CMYK with PHP, Tutorial | pdfRest",{"id":5504,"uuid":5505,"title":5506,"slug":5507,"html":5508,"comment_id":5504,"feature_image":48,"featured":284,"visibility":1257,"created_at":5509,"updated_at":5489,"published_at":5509,"custom_excerpt":5510,"codeinjection_head":5511,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5512,"primary_tag":5520,"url":5521,"excerpt":5510,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5522,"meta_description":5510,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6712d123533c9f26b9438934","334295cd-8d77-4933-b3ad-a9e6a22a67fc","How to Convert PDF Files from RGB to CMYK with Python","how-to-convert-pdf-files-from-rgb-to-cmyk-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF from RGB to CYMK with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F'>Convert PDF Colors API Tool\u003C\u002Fa> is a valuable resource for developers working with PDF documents that require precise color control, especially when converting from RGB to CMYK. This tutorial will guide you through the process of using Python to send an API call to the Convert PDF Colors endpoint, allowing you to effortlessly achieve this color profile conversion.\u003C\u002Fp>\n\n\u003Cp>Converting RGB (Red, Green, Blue) colors to CMYK (Cyan, Magenta, Yellow, Black) is essential for preparing PDF documents for printing. CMYK is the color model used by most printers, and accurately converting RGB colors to CMYK ensures that the printed colors match the intended appearance. This is particularly important for projects like brochures, magazines, and marketing materials where color accuracy is crucial.\u003C\u002Fp>\n\n\u003Ch2>Convert PDF from RGB to CYMK with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\npdf_with_converted_colors_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors'\n\n# The \u002Fpdf-with-converted-colors endpoint can take a single PDF file or id as input.\n# This sample demonstrates setting color_profile to 'acrobat9-cmyk'.\nmp_encoder_pdfWithConvertedColors = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_pdfWithConvertedColors_out',\n        'color_profile': 'acrobat9-cmyk',\n    }\n)\n\n# Let's set the headers that the pdf-with-converted-colors endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdfWithConvertedColors.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to pdf-with-converted-colors endpoint...\")\nresponse = requests.post(pdf_with_converted_colors_endpoint_url, data=mp_encoder_pdfWithConvertedColors, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-converted-colors.py\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary modules, including \u003Ccode>MultipartEncoder\u003C\u002Fcode> from \u003Ccode>requests_toolbelt\u003C\u002Fcode>, which is used to handle multipart form data. The \u003Ccode>requests\u003C\u002Fcode> library is also imported for making HTTP requests, and \u003Ccode>json\u003C\u002Fcode> for handling JSON responses.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">pdf_with_converted_colors_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-converted-colors'\n\u003C\u002Fpre>\n\n\u003Cp>This line sets the endpoint URL for the Convert PDF Colors API. This is where the POST request will be sent.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_pdfWithConvertedColors = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_pdfWithConvertedColors_out',\n        'color_profile': 'acrobat9-cmyk',\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>Here, \u003Ccode>MultipartEncoder\u003C\u002Fcode> is used to prepare the data to be sent in the request. The \u003Ccode>fields\u003C\u002Fcode> dictionary includes:\u003C\u002Fp>\n\n\u003Cul>\n    \u003Cli>\u003Ccode>'file'\u003C\u002Fcode>: The PDF file to be uploaded, opened in binary mode.\u003C\u002Fli>\n    \u003Cli>\u003Ccode>'output'\u003C\u002Fcode>: The desired name for the output file.\u003C\u002Fli>\n    \u003Cli>\u003Ccode>'color_profile'\u003C\u002Fcode>: The target color profile, set to 'acrobat9-cmyk' in this example.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdfWithConvertedColors.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>headers\u003C\u002Fcode> dictionary is constructed to include the necessary headers for the API request. The \u003Ccode>'Content-Type'\u003C\u002Fcode> is automatically set by \u003Ccode>MultipartEncoder\u003C\u002Fcode>, and the \u003Ccode>'Api-Key'\u003C\u002Fcode> is a placeholder for your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(pdf_with_converted_colors_endpoint_url, data=mp_encoder_pdfWithConvertedColors, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This line sends the POST request to the specified endpoint with the prepared data and headers. The response is then checked to determine if the request was successful.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you have learned how to use Python to send an API request to the pdfRest Convert PDF Colors endpoint. This allows you to programmatically change the color profile of PDF documents from RGB to CMYK, which can be particularly useful in digital media workflows.\u003C\u002Fp>\n\n\u003Cp>To explore more functionalities, try out all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on each API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example demonstrates a multipart API call. For code samples using JSON payloads, visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-converted-colors.py\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-10-18T21:20:35.000+00:00","Learn how to convert PDF color profiles from RGB to CMYK using pdfRest API Toolkit with Python","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-python\u002F#article\",\n      \"headline\": \"How to Convert PDF Files from RGB to CMYK with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-python\u002F\",\n      \"datePublished\": \"2024-10-18T21:20:35.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:25.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert PDF color profiles from RGB to CMYK using pdfRest API Toolkit with Python\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert PDF Colors API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-pdf-colors\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-converted-colors API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-colors\"\n        }\n      ],\n      \"keywords\": \"CMYK, Color Management, Convert PDF Colors, Python, RGB\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF Files from RGB to CMYK with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5513,5514,5515,5516,5517,5518,5519],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2161,"name":2162,"slug":2163,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2169,"name":2170,"slug":2171,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2165,"name":2166,"slug":2167,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2149,"name":2150,"slug":2151,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-files-from-rgb-to-cmyk-with-python\u002F","How to Convert PDF Files from RGB to CMYK with Python, Tutorial | pdfRest",{"id":5524,"uuid":5525,"title":5526,"slug":5527,"html":5528,"comment_id":5524,"feature_image":48,"featured":284,"visibility":1257,"created_at":5529,"updated_at":5530,"published_at":5529,"custom_excerpt":5531,"codeinjection_head":5532,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5533,"primary_tag":5543,"url":5544,"excerpt":5531,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5545,"meta_description":5531,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"66e4b7bf533c9f26b9438509","4ffb654c-c4c6-46ca-8f86-e1829ebdd3d0","How to Convert PDF Forms from XFA to Acroforms in .NET with C#","how-to-convert-pdf-forms-from-xfa-to-acroforms-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use XFA to Acroforms with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest XFA to Acroforms API Tool allows developers to convert XFA forms into Acroforms, which are more widely supported and easier to work with in various PDF readers and editors. This tutorial will show you how to send an API call to convert XFA to Acroforms using C#.\u003C\u002Fp>\n\n\u003Cp>Users might need to convert XFA forms to Acroforms to ensure compatibility with a broader range of PDF viewers. For example, a business might receive XFA-based forms from clients but need to convert them to Acroforms to integrate seamlessly with their document management system, which only supports Acroforms.\u003C\u002Fp>\n\n\u003Ch2>XFA to Acroforms with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf-with-acroforms\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-acroforms.cs\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>Let's break down the code to understand how it works:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>This line initializes an instance of \u003Ccode>HttpClient\u003C\u002Fcode> with the base address set to the pdfRest API endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf-with-acroforms\"))\n\u003C\u002Fpre>\n\n\u003Cp>Here, we create a new \u003Ccode>HttpRequestMessage\u003C\u002Fcode> object with the HTTP method set to POST and the endpoint specified as \"pdf-with-acroforms\".\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>This line adds the API key to the request headers. Replace \u003Ccode>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\u003C\u002Fcode> with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n\u003C\u002Fpre>\n\n\u003Cp>We specify that the request expects a JSON response by adding the \"application\u002Fjson\" media type to the Accept header.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n\u003C\u002Fpre>\n\n\u003Cp>This line initializes a new \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> object to hold the multipart form data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n\u003C\u002Fpre>\n\n\u003Cp>We read the file to be uploaded into a byte array. Replace \u003Ccode>\u002Fpath\u002Fto\u002Ffile\u003C\u002Fcode> with the actual path to your PDF file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\u003C\u002Fpre>\n\n\u003Cp>Here, we create a \u003Ccode>ByteArrayContent\u003C\u002Fcode> object from the byte array and add it to the multipart content with the name \"file\". We also set the Content-Type header to \"application\u002Fpdf\".\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Content = multipartContent;\nvar response = await httpClient.SendAsync(request);\n\u003C\u002Fpre>\n\n\u003Cp>We set the request content to the multipart content and send the request asynchronously.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiResult = await response.Content.ReadAsStringAsync();\nConsole.WriteLine(\"API response received.\");\nConsole.WriteLine(apiResult);\n\u003C\u002Fpre>\n\n\u003Cp>Finally, we read the API response as a string and print it to the console.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we demonstrated how to use C# to call the pdfRest XFA to Acroforms API. This allows you to convert XFA forms to Acroforms, ensuring broader compatibility and easier handling of PDF forms.\u003C\u002Fp>\n\n\u003Cp>We encourage you to explore all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example uses a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-acroforms.cs\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-09-13T22:07:59.000+00:00","2026-09-02T18:27:38.000+00:00","Learn how to use the pdfRest XFA to Acroforms API Tool to convert PDF forms with C#","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert PDF Forms from XFA to Acroforms in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-09-13T22:07:59.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:26.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use the pdfRest XFA to Acroforms API Tool to convert PDF forms with C#\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"XFA to AcroForms API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fxfa-to-acroforms\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-acroforms API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fxfa-to-acroforms\"\n        }\n      ],\n      \"keywords\": \".NET, Acroforms, Conversion, Convert, Forms, XFA, XFA to Acroforms\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF Forms from XFA to Acroforms in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5534,5535,5536,5537,5538,5539,5540,5541,5542],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1814,"name":1815,"slug":1816,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1782,"name":1783,"slug":1784,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1786,"name":1787,"slug":1788,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1798,"name":1799,"slug":1800,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-in-net-with-c\u002F","How to Convert PDF Forms from XFA to Acroforms in .NET with C#, Tutorial | pdfRest",{"id":5547,"uuid":5548,"title":5549,"slug":5550,"html":5551,"comment_id":5547,"feature_image":48,"featured":284,"visibility":1257,"created_at":5552,"updated_at":5530,"published_at":5552,"custom_excerpt":5553,"codeinjection_head":5554,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5555,"primary_tag":5565,"url":5566,"excerpt":5553,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5567,"meta_description":5553,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"66e4b8b5533c9f26b943851d","731e2c47-8a4f-444c-bebb-7b22e5054367","How to Convert PDF Forms from XFA to Acroforms with cURL","how-to-convert-pdf-forms-from-xfa-to-acroforms-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use XFA to Acroforms with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest XFA to Acroforms API Tool allows users to convert XFA forms into Acroforms, making them more accessible and easier to handle. This tutorial will show you how to send an API call to the XFA to Acroforms endpoint using cURL, a command-line tool for transferring data with URLs.\u003C\u002Fp>\n\n\u003Cp>Imagine you have a collection of XFA forms that need to be filled out by users who may not have the necessary software to handle XFA. By converting these forms to Acroforms, you make them more universally accessible, ensuring that users can fill them out using standard PDF readers. This conversion process can be automated using the pdfRest API and cURL.\u003C\u002Fp>\n\n\u003Ch2>XFA to Acroforms with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-acroforms\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\"\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-acroforms.sh\">pdf-with-acroforms.sh\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>Let's break down the provided code to understand how each part works:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-acroforms\"\n\u003C\u002Fpre>\n\n\u003Cp>This line initiates a POST request to the pdfRest API endpoint for converting XFA forms to Acroforms.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\n\u003C\u002Fpre>\n\n\u003Cp>This header tells the server that the client expects the response to be in JSON format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\n\u003C\u002Fpre>\n\n\u003Cp>This header specifies that the content type of the request is multipart\u002Fform-data, which is necessary for file uploads.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>This header includes the API key required for authentication. Replace \u003Ccode>xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\u003C\u002Fcode> with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\n\u003C\u002Fpre>\n\n\u003Cp>This line specifies the file to be uploaded. Replace \u003Ccode>\u002Fpath\u002Fto\u002Ffile\u003C\u002Fcode> with the actual path to your XFA form file.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we demonstrated how to use cURL to call the pdfRest XFA to Acroforms API endpoint. This process involves setting the appropriate headers and specifying the file to be converted.\u003C\u002Fp>\n\n\u003Cp>We encourage you to explore all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-acroforms.sh\">pdf-with-acroforms.sh\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-09-13T22:12:05.000+00:00","Learn how to use pdfRest XFA to Acroforms API Tool to convert PDF forms with cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-curl\u002F#article\",\n      \"headline\": \"How to Convert PDF Forms from XFA to Acroforms with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-curl\u002F\",\n      \"datePublished\": \"2024-09-13T22:12:05.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:25.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest XFA to Acroforms API Tool to convert PDF forms with cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"XFA to AcroForms API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fxfa-to-acroforms\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-acroforms API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fxfa-to-acroforms\"\n        }\n      ],\n      \"keywords\": \"Acroforms, Conversion, Convert, Forms, XFA, XFA to Acroforms, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF Forms from XFA to Acroforms with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5556,5557,5558,5559,5560,5561,5562,5563,5564],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1814,"name":1815,"slug":1816,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1786,"name":1787,"slug":1788,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1798,"name":1799,"slug":1800,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1782,"name":1783,"slug":1784,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-curl\u002F","How to Convert PDF Forms from XFA to Acroforms with cURL, Tutorial | pdfRest",{"id":5569,"uuid":5570,"title":5571,"slug":5572,"html":5573,"comment_id":5569,"feature_image":48,"featured":284,"visibility":1257,"created_at":5099,"updated_at":5574,"published_at":4984,"custom_excerpt":5575,"codeinjection_head":5576,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5577,"primary_tag":5587,"url":5588,"excerpt":5575,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5589,"meta_description":5575,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c58533c9f26b943b4c9","c4875749-1cad-4cff-b496-abdb833005f8","How to Convert PDF Forms from XFA to AcroForms with Java","how-to-convert-pdf-forms-from-xfa-to-acroforms-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This tutorial shows you how to convert PDF forms from XFA to AcroForms from a Java application with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fxfa-to-acroforms\u002F\">XFA to AcroForms API Tool\u003C\u002Fa>. The request sends an XFA PDF to \u003Ccode>\u002Fpdf-with-acroforms\u003C\u002Fcode> and returns a separate PDF containing standard AcroForm fields. The walkthrough gives you a practical starting point that you can adapt when you need to convert PDF forms from XFA to AcroForms in your own document workflow.\u003C\u002Fp>\n\n\u003Ch2>Why Convert PDF Forms from XFA to AcroForms with Java?\u003C\u002Fh2>\n\n\u003Cp>An organization modernizing a forms workflow may receive dynamic XFA documents that are not handled consistently by every viewer or downstream tool. Converting them to AcroForms produces standard PDF form fields for later processing.\u003C\u002Fp>\n\n\u003Cp>The Java sample uploads the XFA PDF as \u003Ccode>file\u003C\u002Fcode> and calls \u003Ccode>\u002Fpdf-with-acroforms\u003C\u002Fcode>. The response contains a new PDF resource; it does not modify the uploaded source in place.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONObject;\n\npublic class PDFWithAcroforms {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf-with-acroforms\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client = new OkHttpClient().newBuilder().build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPDFWithAcroforms.java\">Java sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>This dependency set assigns a clear role to each library: HTTP communication, credential lookup, or JSON handling.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>The startup code keeps a visible default path, accepts an override from the command line, and reads the API key through dotenv.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf-with-acroforms\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client = new OkHttpClient().newBuilder().build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\u003C\u002Fpre>\n\n\u003Cp>The Java sample uploads the XFA PDF as \u003Ccode>file\u003C\u002Fcode> and calls \u003Ccode>\u002Fpdf-with-acroforms\u003C\u002Fcode>. The response contains a new PDF resource; it does not modify the uploaded source in place. The multipart section packages fields and files together without hard-coding a \u003Ccode>Content-Type\u003C\u002Fcode> boundary.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf-with-acroforms\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client = new OkHttpClient().newBuilder().build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\u003C\u002Fpre>\n\n\u003Cp>The request builder posts the multipart content to pdfRest and keeps deployment-region changes independent of the rest of the Java code.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    try {\n      OkHttpClient client = new OkHttpClient().newBuilder().build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>The response block prints the HTTP status and JSON body so generated resource IDs or API error details are visible.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You have now seen how to convert PDF forms from XFA to AcroForms from a Java application. With that foundation, this conversion can prepare legacy forms for data import, field flattening, validation, and distribution.\u003C\u002Fp>\n\n\u003Cp>When you move beyond the sample, keep in mind that acroForms and XFA do not provide identical behavior in every document, particularly when calculations, scripts, or dynamic layout are involved. Test field names, values, validation, and downstream import or flattening steps against the converted form before replacing a legacy workflow.\u003C\u002Fp>\n\n\u003Cp>You can experiment with the Convert PDF Forms from XFA to Acroforms operation in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. The \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fxfa-to-acroforms\u002F\">XFA to AcroForms API Tool documentation\u003C\u002Fa> describes the full parameter and response contract.\u003C\u002Fp>\n\n\u003Cp>Note: The Convert PDF Forms from XFA to Acroforms example above uses multipart form data; to avoid transferring the same input again, follow the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPDFWithAcroforms.java\">JSON payload example\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-02T18:27:39.000+00:00","Convert XFA-based PDF forms into AcroForms with Java for broader PDF workflow compatibility.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-java\u002F#article\",\n      \"headline\": \"How to Convert PDF Forms from XFA to AcroForms with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:33.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:33.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert XFA-based PDF forms into AcroForms with Java for broader PDF workflow compatibility.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"XFA to AcroForms API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fxfa-to-acroforms\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-acroforms API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fxfa-to-acroforms\"\n        }\n      ],\n      \"keywords\": \"Acroforms, Conversion, Convert, Forms, Java, XFA, XFA to Acroforms\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF Forms from XFA to AcroForms with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5578,5579,5580,5581,5582,5583,5584,5585,5586],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1814,"name":1815,"slug":1816,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1786,"name":1787,"slug":1788,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1798,"name":1799,"slug":1800,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1782,"name":1783,"slug":1784,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-java\u002F","Convert PDF Forms from XFA to AcroForms with Java | pdfRest",{"id":5591,"uuid":5592,"title":5593,"slug":5594,"html":5595,"comment_id":5591,"feature_image":48,"featured":284,"visibility":1257,"created_at":5596,"updated_at":5574,"published_at":5596,"custom_excerpt":5597,"codeinjection_head":5598,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5599,"primary_tag":5609,"url":5610,"excerpt":5597,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5611,"meta_description":5597,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"66e4b841533c9f26b9438513","2d19b4db-094e-4107-8843-1613463de97a","How to Convert PDF Forms from XFA to Acroforms with JavaScript in NodeJS","how-to-convert-pdf-forms-from-xfa-to-acroforms-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use XFA to Acroforms with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest XFA to Acroforms API Tool is a powerful utility that allows developers to convert XFA (XML Forms Architecture) PDFs into Acroform PDFs. This tutorial will guide you through the process of sending an API call to the XFA to Acroforms endpoint using JavaScript. By following this tutorial, you will learn how to use the provided code to make a successful API call and understand each part of the code.\u003C\u002Fp>\n\n\u003Cp>A user might need to convert XFA PDFs to Acroforms to ensure compatibility with a broader range of PDF viewers and editors. For instance, many older PDF forms created with XFA may not be fully supported by modern PDF readers. Converting these forms to Acroforms can help ensure that they are accessible and functional across various platforms and devices.\u003C\u002Fp>\n\n\u003Ch2>XFA to Acroforms with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to convert a XFA PDF to an acroform file.\nvar axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\ndata.append(\"output\", \"pdfrest_acroform_pdf\");\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: \"post\",\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-acroforms\",\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", \u002F\u002F Replace with your API key\n    ...data.getHeaders(), \u002F\u002F set headers for the request\n  },\n  data: data, \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error);\n  });\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-acroforms.js\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>Let's break down the code step by step to understand how it works:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\u003C\u002Fpre>\n\n\u003Cp>This section imports the necessary modules: \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests, \u003Ccode>form-data\u003C\u002Fcode> for handling form data, and \u003Ccode>fs\u003C\u002Fcode> for interacting with the file system.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\ndata.append(\"output\", \"pdfrest_acroform_pdf\");\u003C\u002Fpre>\n\n\u003Cp>Here, a new instance of \u003Ccode>FormData\u003C\u002Fcode> is created, and the PDF file to be converted is appended to it using \u003Ccode>fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\")\u003C\u002Fcode>. The \u003Ccode>output\u003C\u002Fcode> parameter is set to \u003Ccode>pdfrest_acroform_pdf\u003C\u002Fcode>, specifying the desired output format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: \"post\",\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-acroforms\",\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", \u002F\u002F Replace with your API key\n    ...data.getHeaders(), \u002F\u002F set headers for the request\n  },\n  data: data, \u002F\u002F set the data to be sent with the request\n};\u003C\u002Fpre>\n\n\u003Cp>This block defines the configuration for the \u003Ccode>axios\u003C\u002Fcode> request. The \u003Ccode>method\u003C\u002Fcode> is set to \u003Ccode>post\u003C\u002Fcode>, and \u003Ccode>maxBodyLength\u003C\u002Fcode> is set to \u003Ccode>Infinity\u003C\u002Fcode> to allow for large files. The \u003Ccode>url\u003C\u002Fcode> specifies the endpoint for the API call. The \u003Ccode>headers\u003C\u002Fcode> include the API key (replace the placeholder with your actual API key) and the headers generated by \u003Ccode>data.getHeaders()\u003C\u002Fcode>. The \u003Ccode>data\u003C\u002Fcode> field includes the form data to be sent with the request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error);\n  });\u003C\u002Fpre>\n\n\u003Cp>This section sends the request using \u003Ccode>axios\u003C\u002Fcode> and handles the response or any errors. If the request is successful, the response data is logged to the console. If an error occurs, it is logged to the console.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we demonstrated how to convert an XFA PDF to an Acroform PDF using JavaScript and the pdfRest API. By following the steps and understanding the code, you can now integrate this functionality into your own applications.\u003C\u002Fp>\n\n\u003Cp>We encourage you to explore all the pdfRest API Tools available in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on each API endpoint, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. Note that this example demonstrates a multipart API call, and code samples using JSON payloads can be found in \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-acroforms.js\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-09-13T22:10:09.000+00:00","Learn how to use pdfRest API Tool to convert PDF forms from XFA to Acroforms with JavaScript","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert PDF Forms from XFA to Acroforms with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-09-13T22:10:09.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:25.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest API Tool to convert PDF forms from XFA to Acroforms with JavaScript\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"XFA to AcroForms API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fxfa-to-acroforms\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-acroforms API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fxfa-to-acroforms\"\n        }\n      ],\n      \"keywords\": \"Acroforms, Conversion, Convert, Forms, JavaScript, XFA, XFA to Acroforms\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF Forms from XFA to Acroforms with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5600,5601,5602,5603,5604,5605,5606,5607,5608],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1814,"name":1815,"slug":1816,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1786,"name":1787,"slug":1788,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1798,"name":1799,"slug":1800,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1782,"name":1783,"slug":1784,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-javascript-in-nodejs\u002F","How to Convert PDF Forms from XFA to Acroforms with JavaScript in NodeJS, Tutorial | pdfRest",{"id":5613,"uuid":5614,"title":5615,"slug":5616,"html":5617,"comment_id":5613,"feature_image":48,"featured":284,"visibility":1257,"created_at":5618,"updated_at":5574,"published_at":5618,"custom_excerpt":5619,"codeinjection_head":5620,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5621,"primary_tag":5631,"url":5632,"excerpt":5619,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5633,"meta_description":5619,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"66e4b731533c9f26b94384ff","d5cea129-f236-460c-b8b7-e5d6417f7708","How to Convert PDF Forms from XFA to Acroforms with PHP","how-to-convert-pdf-forms-from-xfa-to-acroforms-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use XFA to Acroforms with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest XFA to Acroforms API Tool provides a straightforward way to convert XFA forms into Acroforms using PHP. This tutorial will guide you through the process of sending an API call to the XFA to Acroforms endpoint using PHP, making it easier to integrate this functionality into your applications.\u003C\u002Fp>\n\n\u003Cp>In real-world scenarios, you might encounter XFA forms that need to be converted into Acroforms for better compatibility with various PDF viewers and tools. For instance, if you have a legacy system generating XFA forms, converting them to Acroforms ensures that end-users can easily fill out and submit these forms using standard PDF viewers.\u003C\u002Fp>\n\n\u003Ch2>XFA to Acroforms with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">\nrequire 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\n$headers = [\n  'Api-Key' =--> 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile', \u002F\u002F Set the filename for the file to be processed, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'output', \u002F\u002F Specify the field name for the output option.\n      'contents' => 'pdfrest_acroform' \u002F\u002F Set the value for the output option (in this case, 'pdfrest_acroform').\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-acroforms', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the acroform document.\n\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-acroforms.php\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>Let's break down the provided code and understand each part:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">require 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\u003C\u002Fpre>\n\n\u003Cp>This line includes the Composer autoload file, which loads all the necessary dependencies, including the Guzzle HTTP client.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">use GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\u003C\u002Fpre>\n\n\u003Cp>These lines import the required classes from the Guzzle HTTP client library and the PSR-7 standard for HTTP messages, which helps in creating and handling HTTP requests and streams.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\u003C\u002Fpre>\n\n\u003Cp>This line creates a new instance of the Guzzle HTTP client, which will be used to send the API request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\u003C\u002Fpre>\n\n\u003Cp>The headers array sets the API key required for authentication. Replace 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile', \u002F\u002F Set the filename for the file to be processed, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'output', \u002F\u002F Specify the field name for the output option.\n      'contents' => 'pdfrest_acroform' \u002F\u002F Set the value for the output option (in this case, 'pdfrest_acroform').\n    ]\n  ]\n];\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>The options array specifies the multipart form data. The 'file' part includes the file to be converted, and the 'output' part specifies the desired output format. Adjust the file path and content type as needed.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-acroforms', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\u003C\u002Fpre>\n\n\u003Cp>This line creates a new HTTP POST request to the specified API endpoint, including the headers for authentication.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\u003C\u002Fpre>\n\n\u003Cp>The sendAsync method sends the request asynchronously, and the wait method waits for the response. This ensures that the script does not proceed until the response is received.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">echo $res->getBody(); \u002F\u002F Output the response body, which contains the acroform document.\n\u003C\u002Fpre>\n\n\u003Cp>This line outputs the response body, which contains the converted Acroform document.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we demonstrated how to use PHP to call the pdfRest XFA to Acroforms API endpoint. This allows you to convert XFA forms to Acroforms programmatically, making your applications more versatile and user-friendly.\u003C\u002Fp>\n\n\u003Cp>We encourage you to explore all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on all available endpoints and their parameters, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example uses a multipart API call. You can find code samples using JSON payloads at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-acroforms.php\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-09-13T22:05:37.000+00:00","Learn how to convert XFA forms to Acroforms using pdfRest API Tool with PHP","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-php\u002F#article\",\n      \"headline\": \"How to Convert PDF Forms from XFA to Acroforms with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-php\u002F\",\n      \"datePublished\": \"2024-09-13T22:05:37.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:26.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert XFA forms to Acroforms using pdfRest API Tool with PHP\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"XFA to AcroForms API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fxfa-to-acroforms\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-acroforms API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fxfa-to-acroforms\"\n        }\n      ],\n      \"keywords\": \"Acroforms, Conversion, Convert, Forms, PHP, XFA, XFA to Acroforms\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF Forms from XFA to Acroforms with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5622,5623,5624,5625,5626,5627,5628,5629,5630],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1814,"name":1815,"slug":1816,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1786,"name":1787,"slug":1788,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1798,"name":1799,"slug":1800,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1782,"name":1783,"slug":1784,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-php\u002F","How to Convert PDF Forms from XFA to Acroforms with PHP, Tutorial | pdfRest",{"id":5635,"uuid":5636,"title":5637,"slug":5638,"html":5639,"comment_id":5635,"feature_image":48,"featured":284,"visibility":1257,"created_at":5640,"updated_at":5641,"published_at":5640,"custom_excerpt":5642,"codeinjection_head":5643,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5644,"primary_tag":5654,"url":5655,"excerpt":5642,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5656,"meta_description":5642,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"66e4b567533c9f26b94384ed","ce183b36-2527-4383-8b62-c4f869f2556d","How to Convert PDF Forms from XFA to Acroforms with Python","how-to-convert-pdf-forms-from-xfa-to-acroforms-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use XFA to Acroforms with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest XFA to Acroforms API Tool allows users to convert XFA forms, which are XML-based forms, into Acroforms, which are more widely supported in PDF viewers and editors. This tutorial will guide you through the process of sending an API call to the XFA to Acroforms endpoint using Python, enabling you to automate the conversion of XFA forms to Acroforms.\u003C\u002Fp>\n\n\u003Cp>Imagine you work for a company that has a large archive of XFA-based forms that need to be updated or processed using modern PDF tools. Since many of these tools do not support XFA forms, converting them to Acroforms becomes essential. By using the pdfRest API and Python, you can automate this conversion process, saving time and effort while ensuring compatibility with a broader range of PDF software.\u003C\u002Fp>\n\n\u003Ch2>XFA to Acroforms with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nacroform_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-acroforms'\n\n# The \u002Fpdf-with-acroforms endpoint can take a single PDF file or id as input.\n# This sample demonstrates converting an XFA PDF to an acroform document.\nmp_encoder_acroform = MultipartEncoder(\n    fields={\n        'file': ('file_name', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_acroform_out',\n    }\n)\n\n# Let's set the headers that the acroform endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_acroform.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to pdf-with-acroforms endpoint...\")\nresponse = requests.post(acroform_endpoint_url, data=mp_encoder_acroform, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-acroforms.py\">pdf-with-acroforms.py\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>Let's take a closer look at how this code works:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">acroform_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-acroforms'\n\u003C\u002Fpre>\n\n\u003Cp>This line sets the URL for the API endpoint that we will be sending our request to. The endpoint is designed to convert XFA PDFs to AcroForms.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_acroform = MultipartEncoder(\n    fields={\n        'file': ('file_name', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_acroform_out',\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>Here, we are using the \u003Ccode>MultipartEncoder\u003C\u002Fcode> from the \u003Ccode>requests_toolbelt\u003C\u002Fcode> library to create a multipart form-data payload. The \u003Ccode>fields\u003C\u002Fcode> dictionary contains:\u003C\u002Fp>\n\n\u003Cul>\n    \u003Cli>\u003Ccode>'file'\u003C\u002Fcode>: This is the file to be uploaded. The \u003Ccode>open('\u002Fpath\u002Fto\u002Ffile', 'rb')\u003C\u002Fcode> function opens the file in binary read mode.\u003C\u002Fli>\n    \u003Cli>\u003Ccode>'output'\u003C\u002Fcode>: This specifies the name of the output file.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_acroform.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\u003C\u002Fpre>\n\n\u003Cp>We then set up the headers for our request. The \u003Ccode>Accept\u003C\u002Fcode> header indicates that we expect a JSON response. The \u003Ccode>Content-Type\u003C\u002Fcode> header is automatically set to \u003Ccode>multipart\u002Fform-data\u003C\u002Fcode> by the \u003Ccode>MultipartEncoder\u003C\u002Fcode>. The \u003Ccode>Api-Key\u003C\u002Fcode> header should contain your API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(acroform_endpoint_url, data=mp_encoder_acroform, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This line sends a POST request to the specified endpoint with the multipart form-data payload and headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Finally, we check if the response is successful. If it is, we parse the JSON response and print it in a readable format. If not, we print the error message.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to send an API call to the pdfRest XFA to Acroforms endpoint using Python. This allows you to convert XFA-based forms to Acroforms, which are more widely supported. To explore more functionalities, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fxfa-to-acroforms\u002F\">API Reference Guide\u003C\u002Fa>. Note that this example demonstrates a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-acroforms.py\">pdf-with-acroforms.py\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-09-13T21:57:59.000+00:00","2026-09-02T18:27:40.000+00:00","Learn how to use pdfRest XFA to Acroforms API Tool to convert XFA forms to Acroforms for expanded compatibility","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-python\u002F#article\",\n      \"headline\": \"How to Convert PDF Forms from XFA to Acroforms with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-python\u002F\",\n      \"datePublished\": \"2024-09-13T21:57:59.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:26.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest XFA to Acroforms API Tool to convert XFA forms to Acroforms for expanded compatibility\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"XFA to AcroForms API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fxfa-to-acroforms\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-acroforms API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fxfa-to-acroforms\"\n        }\n      ],\n      \"keywords\": \"Acroforms, Conversion, Convert, Forms, Python, XFA, XFA to Acroforms\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF Forms from XFA to Acroforms with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5645,5646,5647,5648,5649,5650,5651,5652,5653],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1814,"name":1815,"slug":1816,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1782,"name":1783,"slug":1784,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1786,"name":1787,"slug":1788,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1798,"name":1799,"slug":1800,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-forms-from-xfa-to-acroforms-with-python\u002F","How to Convert PDF Forms from XFA to Acroforms with Python, Tutorial | pdfRest",{"id":5658,"uuid":5659,"title":5660,"slug":5661,"html":5662,"comment_id":5658,"feature_image":48,"featured":284,"visibility":1257,"created_at":5663,"updated_at":5641,"published_at":5663,"custom_excerpt":5664,"codeinjection_head":5665,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5666,"primary_tag":5672,"url":5673,"excerpt":5664,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5674,"meta_description":5664,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65cbf446533c9f26b9436322","8918d241-4870-44f1-a32b-22d307028bd9","How to Convert PDF to BMP in .NET with C#","how-to-convert-pdf-to-bmp-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to BMP with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F'>PDF to Images API Tool\u003C\u002Fa> is a powerful resource for developers who need to convert PDF documents into image files programmatically. This tutorial will guide you through the process of sending an API call to the PDF to Images service using C#.\u003C\u002Fp>\n\u003Cp>As an example, this API could be used for an application that processes documents and needs to display previews as images, or an archival system that converts stored PDFs into images for easier access and viewing.\u003C\u002Fp>\n\n\u003Ch2>Convert PDF to BMP C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"bmp\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source code reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fbmp.cs\">pdfRest API Samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code block above demonstrates how to perform a multipart\u002Fform-data POST request to the pdfRest API's BMP endpoint using C#. Let's break it down:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>This initializes a new instance of the HttpClient class and sets the base address for the API requests.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var request = new HttpRequestMessage(HttpMethod.Post, \"bmp\"))\n\u003C\u002Fpre>\n\n\u003Cp>A new HttpRequestMessage is created for a POST request to the \"bmp\" endpoint, which is used for converting PDF to BMP images.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>This line adds your API key to the request headers for authentication purposes.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n\u003C\u002Fpre>\n\n\u003Cp>A new instance of MultipartFormDataContent is created to hold the PDF file content.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n\u003C\u002Fpre>\n\n\u003Cp>The PDF file is read into a byte array, wrapped in a ByteArrayContent object, and added to the multipart content with the name \"file\".\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\u003C\u002Fpre>\n\n\u003Cp>This sets the content type of the file part to \"application\u002Fpdf\", indicating that the file being sent is a PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\n\u003C\u002Fpre>\n\n\u003Cp>The request is sent asynchronously and the response is captured in the \"response\" variable.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>The content of the response is read as a string, which contains the result of the API call.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've learned how to convert a PDF to BMP images using the pdfRest API and C#. By understanding the multipart\u002Fform-data request structure, you can adapt this example to convert PDFs into various image formats supported by pdfRest. Feel free to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for further exploration.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fbmp.cs\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-13T22:59:18.000+00:00","Learn how to use pdfRest PDF to Images API Tool to convert PDF pages to BMP image files with C#","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert PDF to BMP in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-02-13T22:59:18.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:48.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest PDF to Images API Tool to convert PDF pages to BMP image files with C#\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fbmp API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\"\n        }\n      ],\n      \"keywords\": \".NET, BMP, PDF to Images\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to BMP in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5667,5668,5669,5670,5671],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1538,"name":1539,"slug":1540,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1530,"name":1531,"slug":1532,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-bmp-in-net-with-c\u002F","How to Convert PDF to BMP in .NET with C#, Tutorial | pdfRest",{"id":5676,"uuid":5677,"title":5678,"slug":5679,"html":5680,"comment_id":5676,"feature_image":48,"featured":284,"visibility":1257,"created_at":5681,"updated_at":5682,"published_at":5681,"custom_excerpt":5683,"codeinjection_head":5684,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5685,"primary_tag":5691,"url":5692,"excerpt":5683,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5693,"meta_description":5683,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65f08a9c533c9f26b94369e9","a5ff0ef5-f93d-4cf7-a4bb-e392c6ac8bce","How to Convert PDF to BMP with cURL","how-to-convert-pdf-to-bmp-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to BMP with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F'>PDF to Images API Tool\u003C\u002Fa> is a powerful resource that allows users to convert PDF documents into image files. This tutorial will demonstrate how to send an API call to the PDF to Images endpoint using cURL, a command-line tool for transferring data with URLs. The API is designed to be simple and efficient, making it accessible for developers to integrate PDF to image conversion into their applications or workflows.\u003C\u002Fp>\n\n\u003Cp>There are many scenarios where converting a PDF to images could be useful. For instance, a web developer might need to display the content of a PDF on a website without relying on the user's PDF reader. Alternatively, an archivist could use this tool to convert scanned documents stored as PDFs into image files for easier viewing and sharing. The ability to automate this process through an API call can significantly streamline such tasks.\u003C\u002Fp>\n\n\u003Ch2>Convert PDF to BMP with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fbmp\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>Reference to the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fbmp.sh\">pdfRest API Samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This section will explain the different components of the cURL command used to call the PDF to Images API:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-X POST\u003C\u002Fpre>\n\n\u003Cp>This specifies the HTTP method for the request, which is POST in this case, indicating that data will be sent to the server.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">\"https:\u002F\u002Fapi.pdfrest.com\u002Fbmp\"\u003C\u002Fpre>\n\n\u003Cp>This is the endpoint URL that specifies the API's PDF to Images service for converting PDFs to BMP image files.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\u003C\u002Fpre>\n\n\u003Cp>This header tells the server that the client expects a response in JSON format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the data being sent in the request is in multipart form-data format, which is used for uploading files.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\u003C\u002Fpre>\n\n\u003Cp>This header provides the API key required for authentication with the pdfRest service. The 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' is a placeholder for the actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\u003C\u002Fpre>\n\n\u003Cp>This form field is used to upload the PDF file to be converted. The '@' symbol indicates that a file is being uploaded, followed by the path to the PDF file on the local system.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\u003C\u002Fpre>\n\n\u003Cp>This form field specifies the prefix for the output file(s). The API will generate image files with this prefix followed by a page number and the appropriate file extension.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial has walked you through the process of using cURL to call the pdfRest PDF to Images API to convert a PDF file into image files. By understanding the structure of the API call and the purpose of each component, you can adapt this example to fit your specific needs.\u003C\u002Fp>\n\n\u003Cp>Feel free to explore and demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, and for more detailed information, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fbmp.sh\">pdfRest API Samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-12T17:02:20.000+00:00","2026-09-02T18:27:41.000+00:00","Learn how to create BMP image files of PDF pages using PDF to Images API Tool by pdfRest with cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-curl\u002F#article\",\n      \"headline\": \"How to Convert PDF to BMP with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-curl\u002F\",\n      \"datePublished\": \"2024-03-12T17:02:20.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:40.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to create BMP image files of PDF pages using PDF to Images API Tool by pdfRest with cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fbmp API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\"\n        }\n      ],\n      \"keywords\": \"BMP, PDF to Images, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to BMP with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5686,5687,5688,5689,5690],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1538,"name":1539,"slug":1540,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1530,"name":1531,"slug":1532,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-bmp-with-curl\u002F","How to Convert PDF to BMP with cURL, Tutorial | pdfRest",{"id":5695,"uuid":5696,"title":5697,"slug":5698,"html":5699,"comment_id":5695,"feature_image":48,"featured":284,"visibility":1257,"created_at":5700,"updated_at":5701,"published_at":4984,"custom_excerpt":5702,"codeinjection_head":5703,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5704,"primary_tag":5710,"url":5711,"excerpt":5702,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5712,"meta_description":5702,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c59533c9f26b943b4d7","2a0ca12c-5e2a-4217-9a8b-d78d0299c3b9","How to Convert PDF to BMP with Java","how-to-convert-pdf-to-bmp-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>Learn how to convert PDF to BMP with Java and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\">PDF to Images API Tool\u003C\u002Fa>. The example combines the source PDF with page, resolution, and color controls that determine the bitmap outputs. We'll move from input and authentication setup through the request and returned data involved when you convert PDF to BMP.\u003C\u002Fp>\n\n\u003Ch2>Why Convert PDF to BMP with Java?\u003C\u002Fh2>\n\n\u003Cp>Some document-imaging or print systems require uncompressed bitmap pages instead of PDF. A Java backend can rasterize the PDF into BMP outputs before handing the pages to that downstream system.\u003C\u002Fp>\n\n\u003Cp>The sample calls \u003Ccode>\u002Fbmp\u003C\u002Fcode> and supplies page and color controls in addition to the source PDF. Multi-page input can produce multiple image resources in the response.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class Bmp {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_bmp\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fbmp\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FBmp.java\">Java sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The Java setup uses OkHttp for transport, dotenv for loading \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode>, and \u003Ccode>org.json\u003C\u002Fcode> for structured request or response data.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>The input setup uses runtime arguments when supplied and otherwise falls back to the documented input path and environment-based credential.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_bmp\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fbmp\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The sample calls \u003Ccode>\u002Fbmp\u003C\u002Fcode> and supplies page and color controls in addition to the source PDF. Multi-page input can produce multiple image resources in the response. The OkHttp body leaves boundary construction to OkHttp so the header remains synchronized with the serialized content.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fbmp\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>This POST request ties the body to its endpoint and applies the required \u003Ccode>Api-Key\u003C\u002Fcode> header before OkHttp sends it.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>This result handling uses both status and body to distinguish a successful resource from validation or processing failures.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>Together, we stepped through the Java request needed to convert PDF to BMP. With that foundation, bMP output is useful for compatibility testing, legacy imaging, and workflows where uncompressed raster pages are required.\u003C\u002Fp>\n\n\u003Cp>As you build this into a larger workflow, keep in mind that bMP output is typically much larger than compressed image formats, making page selection and resolution especially important. Choose the lowest DPI and color model that still satisfies the destination system, and retain the response mapping when one PDF produces several page images.\u003C\u002Fp>\n\n\u003Cp>Try the Convert PDF to BMP operation with representative files in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. Review the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\u002F\">PDF to Images API Tool documentation\u003C\u002Fa> for supported values and production considerations.\u003C\u002Fp>\n\n\u003Cp>Note: The Convert PDF to BMP example above uses multipart form data; for the resource-ID form of this operation, use the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FBmp.java\">JSON payload example\u003C\u002Fa> as a guide.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T17:33:13.000+00:00","2026-09-02T18:27:44.000+00:00","Render PDF pages as BMP images with Java for imaging and legacy-system workflows.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-java\u002F#article\",\n      \"headline\": \"How to Convert PDF to BMP with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:33.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:33.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Render PDF pages as BMP images with Java for imaging and legacy-system workflows.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fbmp API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\"\n        }\n      ],\n      \"keywords\": \"BMP, Java, PDF to Images\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to BMP with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5705,5706,5707,5708,5709],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1538,"name":1539,"slug":1540,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1530,"name":1531,"slug":1532,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-bmp-with-java\u002F","Convert PDF to BMP with Java | pdfRest",{"id":5714,"uuid":5715,"title":5716,"slug":5717,"html":5718,"comment_id":5714,"feature_image":48,"featured":284,"visibility":1257,"created_at":5719,"updated_at":5720,"published_at":5719,"custom_excerpt":5721,"codeinjection_head":5722,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5723,"primary_tag":5729,"url":5730,"excerpt":5721,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5731,"meta_description":5721,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65cbf514533c9f26b9436336","92cbf767-7497-4ee8-a14d-dd6b52702fcb","How to Convert PDF to BMP with JavaScript in NodeJS","how-to-convert-pdf-to-bmp-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Render PDF Pages as BMP Images with Node.js\u003C\u002Fh2>\n\n\u003Cp>Some imaging systems, desktop workflows, and legacy integrations require BMP files rather than PDF pages. The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\">PDF to Images API Tool\u003C\u002Fa> renders selected PDF pages through the \u003Ccode>\u002Fbmp\u003C\u002Fcode> endpoint and produces one bitmap image for each requested page. This gives an integration that requires BMP a direct API path from a multipage PDF to the image files its downstream system accepts.\u003C\u002Fp>\n\n\u003Cp>BMP is useful when a downstream system explicitly expects a straightforward bitmap format, but the files can be much larger than compressed JPEG or PNG output. For browser previews, email, or general web delivery, another supported image format may be more efficient. Choosing BMP should reflect the receiving system's requirement rather than an assumption that all raster formats behave the same way.\u003C\u002Fp>\n\n\u003Cp>For example, a Node.js document-inspection service may need to send a specific PDF page to an established Windows imaging component that accepts BMP input. The service can render only the relevant page, store the returned image in the component's work queue, and avoid installing a local PDF renderer in every application environment.\u003C\u002Fp>\n\n\u003Cp>This example uses Axios, FormData, and a file stream to upload the PDF, select all pages, and request RGB BMP output at 300 DPI.\u003C\u002Fp>\n\u003Ch2>JavaScript PDF-to-BMP Code Example\u003C\u002Fh2>\n\n\u003Cp>Install \u003Ccode>axios\u003C\u002Fcode> and \u003Ccode>form-data\u003C\u002Fcode>, then replace the API-key and source-path placeholders. The current sample keeps the US and EU API base URLs configurable so deployment can select the appropriate processing region.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to convert a PDF into BMP image files, one per PDF page.\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n\n\u002F\u002F Create a new form data instance and append the file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('pages', '1-last');\ndata.append('resolution', '300');\ndata.append('color_model', 'rgb');\ndata.append('output', 'pdfrest_bmp');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: apiUrl + '\u002Fbmp',\n  headers: {\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error);\n});\n\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fbmp.js\">pdfRest PDF-to-BMP multipart JavaScript sample\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Control Pages, Resolution, and Color\u003C\u002Fh2>\n\n\u003Cp>The \u003Ccode>pages\u003C\u002Fcode> field accepts individual page numbers and ranges. Use \u003Ccode>1-last\u003C\u002Fcode> to render the entire PDF, or narrow the request to values such as \u003Ccode>1\u003C\u002Fcode>, \u003Ccode>2-4\u003C\u002Fcode>, or \u003Ccode>1,5,8-last\u003C\u002Fcode>. Rendering only the pages the application needs reduces processing and avoids generating unused files.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>resolution\u003C\u002Fcode> field controls raster detail in dots per inch. Higher values produce more pixels and larger outputs. pdfRest supports a broad range of resolutions, but the best value depends on the downstream task. A screen-only integration may need less detail than print inspection, image analysis, or OCR. Select the resolution that matches the receiving system instead of using the highest value by default.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>color_model\u003C\u002Fcode> field can produce RGB, RGBA, CMYK, or grayscale output where supported. Match the selection to the receiving system's required treatment of color, transparency, and page backgrounds.\u003C\u002Fp>\n\n\u003Ch2>Handle One Output per Page\u003C\u002Fh2>\n\n\u003Cp>A multipage PDF produces multiple images. Parse the response collections and associate each output with its source page rather than assuming the endpoint returns one file. Output URLs support downloading the BMPs, while resource IDs can be used by another compatible pdfRest operation. If the workflow needs a single package, the generated resources can be passed to the Zip Files API Tool.\u003C\u002Fp>\n\n\u003Cp>Production code should check the HTTP status, validate the returned JSON, apply suitable timeouts, and distinguish API errors from network failures. Keep the API key in an environment variable or secret manager and avoid logging document data. Use the response collections to map page outputs into the downstream system.\u003C\u002Fp>\n\n\u003Cp>If the PDF has already been uploaded, submit its resource ID in JSON rather than uploading the file again. The official \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fbmp.js\">PDF-to-BMP JSON-payload JavaScript sample\u003C\u002Fa> demonstrates this request. Use \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> to configure settings and consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fpdf-to-images\">PDF to Images API reference\u003C\u002Fa> for current page, resolution, and color options.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-13T23:02:44.000+00:00","2026-09-22T19:03:00.000+00:00","Learn how to convert PDF pages to BMP image files using JavaScript in NodeJS with pdfRest PDF to Images API Tool","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert PDF to BMP with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-02-13T23:02:44.000Z\",\n      \"dateModified\": \"2026-09-22T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert PDF pages to BMP image files using JavaScript in NodeJS with pdfRest PDF to Images API Tool\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fbmp API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\"\n        }\n      ],\n      \"keywords\": \"BMP, JavaScript, PDF to Images\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to BMP with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5724,5725,5726,5727,5728],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1538,"name":1539,"slug":1540,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1530,"name":1531,"slug":1532,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-bmp-with-javascript-in-nodejs\u002F","How to Convert PDF to BMP with JavaScript in NodeJS, Tutorial | pdfRest",{"id":5733,"uuid":5734,"title":5735,"slug":5736,"html":5737,"comment_id":5733,"feature_image":48,"featured":284,"visibility":1257,"created_at":5738,"updated_at":5739,"published_at":5738,"custom_excerpt":5740,"codeinjection_head":5741,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5742,"primary_tag":5748,"url":5749,"excerpt":5740,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5750,"meta_description":5740,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65cbf4e2533c9f26b943632c","217eb784-5c6e-411d-be13-5ff323b37dae","How to Convert PDF to BMP with PHP","how-to-convert-pdf-to-bmp-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Convert PDF Pages to BMP Images with PHP\u003C\u002Fh2>\n\n\u003Cp>Applications sometimes need to deliver a PDF page to a component that works with bitmap images but cannot open PDFs. The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\">PDF to Images API Tool\u003C\u002Fa> renders PDF pages as BMP files through the \u003Ccode>\u002Fbmp\u003C\u002Fcode> endpoint, providing a consistent API workflow without requiring PDF rendering software inside the PHP application.\u003C\u002Fp>\n\n\u003Cp>BMP is typically chosen for compatibility with a receiving system that specifically requires it. Because BMP output can be substantially larger than compressed PNG or JPEG images, it is generally not the first choice for website thumbnails or bandwidth-sensitive delivery. pdfRest supports several image output formats through related endpoints, so the application can use BMP where required and choose a more compact format elsewhere.\u003C\u002Fp>\n\n\u003Cp>For example, a PHP-based records portal can receive a multipage PDF and render selected pages as BMP files for a legacy OCR or imaging service that accepts that format. The portal submits only the pages the older component needs and associates each returned bitmap with its source page, creating a clear bridge between modern PDF intake and the existing system.\u003C\u002Fp>\n\n\u003Cp>This example uses Guzzle to send a local PDF and rendering parameters as multipart form data.\u003C\u002Fp>\n\u003Ch2>PHP PDF-to-BMP Code Example\u003C\u002Fh2>\n\n\u003Cp>Install Guzzle with Composer, set the API key in secure configuration, and replace the local PDF path. The corrected sample declares the file as \u003Ccode>application\u002Fpdf\u003C\u002Fcode>; the placeholder in the older code is not a valid content type.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile.pdf', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => 'file.pdf', \u002F\u002F Set the filename for the file to be converted, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => 'application\u002Fpdf' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'pages', \u002F\u002F Specify the field name for the pages option.\n      'contents' => '1-last' \u002F\u002F Set the value for the pages option (in this case, '1-last').\n    ],\n    [\n      'name' => 'resolution', \u002F\u002F Specify the field name for the resolution option.\n      'contents' => '300' \u002F\u002F Set the value for the resolution option (in this case, '300').\n    ],\n    [\n      'name' => 'color_model', \u002F\u002F Specify the field name for the color_model option.\n      'contents' => 'rgb' \u002F\u002F Set the value for the color_model option (in this case, 'rgb').\n    ],\n    [\n      'name' => 'output', \u002F\u002F Specify the field name for the output option.\n      'contents' => 'pdfrest_bmp' \u002F\u002F Set the value for the output option (in this case, 'pdfrest_bmp').\n    ]\n  ]\n];\n\n$request = new Request('POST', $apiUrl.'\u002Fbmp', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the converted BMP image.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fbmp.php\">pdfRest PDF-to-BMP multipart PHP sample\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Set the Rendering Parameters\u003C\u002Fh2>\n\n\u003Cp>Guzzle's \u003Ccode>multipart\u003C\u002Fcode> option contains the uploaded PDF and the endpoint fields. The \u003Ccode>pages\u003C\u002Fcode> value determines which pages are rendered. Use \u003Ccode>1-last\u003C\u002Fcode> for the complete document or specify individual pages and ranges when the workflow needs only part of the file.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>resolution\u003C\u002Fcode> value determines pixel density. Higher DPI increases detail and file size, so select it according to the downstream requirement. A document-inspection or OCR process may benefit from more resolution than a simple screen preview, but increasing DPI cannot restore detail that is absent from the original page.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>color_model\u003C\u002Fcode> setting should match the consuming system. RGB is a common default; grayscale can reduce output size when color is unnecessary. The selected color model is applied consistently across every requested page, creating output aligned with the consuming system.\u003C\u002Fp>\n\n\u003Ch2>Process Multiple BMP Results\u003C\u002Fh2>\n\n\u003Cp>The endpoint generates one image for each selected PDF page. Parse the response as a collection that maps the generated outputs to the requested page range. Download the images from their output URLs when they need to leave the pdfRest workflow, or retain resource IDs for compatible follow-up operations. The Zip Files API Tool can combine several output resources when the application needs one downloadable package.\u003C\u002Fp>\n\n\u003Cp>Catch Guzzle request and connection exceptions, inspect the HTTP status, and validate the response schema before using output fields. Apply timeouts appropriate to the expected PDF size and resolution. Keep the API key outside source code, close file resources, and avoid exposing document content in logs or error pages.\u003C\u002Fp>\n\n\u003Cp>When the source PDF is already uploaded, use its resource ID in a JSON request. See the official \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fbmp.php\">PDF-to-BMP JSON-payload PHP sample\u003C\u002Fa>. Use \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> to configure output settings and consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fpdf-to-images\">PDF to Images API reference\u003C\u002Fa> for the current parameter ranges and response structure.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-13T23:01:54.000+00:00","2026-09-22T19:03:01.000+00:00","Learn how to use pdfRest PDF to Images API Tool to convert PDF pages to BMP image files using PHP","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-php\u002F#article\",\n      \"headline\": \"How to Convert PDF to BMP with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-php\u002F\",\n      \"datePublished\": \"2024-02-13T23:01:54.000Z\",\n      \"dateModified\": \"2026-09-22T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest PDF to Images API Tool to convert PDF pages to BMP image files using PHP\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fbmp API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\"\n        }\n      ],\n      \"keywords\": \"BMP, PDF to Images, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to BMP with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5743,5744,5745,5746,5747],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1538,"name":1539,"slug":1540,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1530,"name":1531,"slug":1532,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-bmp-with-php\u002F","How to Convert PDF to BMP with PHP, Tutorial | pdfRest",{"id":5752,"uuid":5753,"title":5754,"slug":5755,"html":5756,"comment_id":5752,"feature_image":48,"featured":284,"visibility":1257,"created_at":5757,"updated_at":5758,"published_at":5757,"custom_excerpt":5759,"codeinjection_head":5760,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5761,"primary_tag":5767,"url":5768,"excerpt":5759,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5769,"meta_description":5759,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65cbf556533c9f26b9436340","9204b772-d53d-4f4c-9608-47e2d568f50c","How to Convert PDF to BMP with Python","how-to-convert-pdf-to-bmp-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to BMP with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F'>PDF to Images API Tool\u003C\u002Fa> provides a convenient way to convert PDF documents into image files programmatically. This tool is especially useful when you need to extract visual content from PDFs for use in web services, content management systems, or for further image processing tasks.\u003C\u002Fp>\n\u003Cp>For example, a user might need to convert a PDF brochure into image files to embed them on a website or to create thumbnails for a document management system.\u003C\u002Fp>\n\n\u003Ch2>Convert PDF to BMP with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nbmp_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fbmp'\n\n# The \u002Fbmp endpoint can take a single PDF file or id as input and turn them into BMP image files.\n# This sample takes in a PDF and converts all pages into grayscale BMP files.\nmp_encoder_bmp = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'pages': '1-last',\n        'resolution': '600',\n        'color_model': 'gray',\n        'output' : 'example_bmp_out',\n    }\n)\n\n# Let's set the headers that the bmp endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_bmp.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to bmp endpoint...\")\nresponse = requests.post(bmp_endpoint_url, data=mp_encoder_bmp, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fbmp.py\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This code snippet demonstrates how to use the pdfRest API to convert a PDF file into BMP images using Python:\u003C\u002Fp>\n\n\u003Cul>\n    \u003Cli>\u003Ccode>requests_toolbelt\u003C\u002Fcode> and \u003Ccode>requests\u003C\u002Fcode> libraries are used to construct and send the HTTP request.\u003C\u002Fli>\n    \u003Cli>\u003Ccode>MultipartEncoder\u003C\u002Fcode> is utilized to encode the files and parameters for the POST request.\u003C\u002Fli>\n    \u003Cli>The \u003Ccode>fields\u003C\u002Fcode> dictionary includes all the parameters for the API request:\u003C\u002Fli>\n    \u003Cul>\n        \u003Cli>\u003Ccode>'file'\u003C\u002Fcode>: The PDF file to be converted. Replace \u003Ccode>'\u002Fpath\u002Fto\u002Ffile'\u003C\u002Fcode> with the actual file path.\u003C\u002Fli>\n        \u003Cli>\u003Ccode>'pages'\u003C\u002Fcode>: Defines the pages to convert. \u003Ccode>'1-last'\u003C\u002Fcode> means all pages.\u003C\u002Fli>\n        \u003Cli>\u003Ccode>'resolution'\u003C\u002Fcode>: The resolution in DPI for the output images.\u003C\u002Fli>\n        \u003Cli>\u003Ccode>'color_model'\u003C\u002Fcode>: Specifies the color model, 'gray' for grayscale images.\u003C\u002Fli>\n        \u003Cli>\u003Ccode>'output'\u003C\u002Fcode>: The base name for the output files.\u003C\u002Fli>\n    \u003C\u002Ful>\n    \u003Cli>Headers are set to accept JSON responses and include the API key for authentication.\u003C\u002Fli>\n    \u003Cli>The POST request is sent to the \u003Ccode>\u002Fbmp\u003C\u002Fcode> endpoint, and the response is handled accordingly.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following this tutorial, you've learned how to send an API call to the pdfRest PDF to Images API to convert a PDF into BMP images. You can now apply this knowledge to integrate PDF conversion features into your applications or workflows.\u003C\u002Fp>\n\n\u003Cp>Feel free to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for more information.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fbmp.py\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-13T23:03:50.000+00:00","2026-09-02T18:27:45.000+00:00","Learn how to convert PDF pages to BMP images using pdfRest PDF to Images API Tool with Python","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-python\u002F#article\",\n      \"headline\": \"How to Convert PDF to BMP with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-python\u002F\",\n      \"datePublished\": \"2024-02-13T23:03:50.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:48.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert PDF pages to BMP images using pdfRest PDF to Images API Tool with Python\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fbmp API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\"\n        }\n      ],\n      \"keywords\": \"BMP, PDF to Images, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to BMP with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-bmp-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5762,5763,5764,5765,5766],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1538,"name":1539,"slug":1540,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1530,"name":1531,"slug":1532,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-bmp-with-python\u002F","How to Convert PDF to BMP with Python, Tutorial | pdfRest",{"id":5771,"uuid":5772,"title":5773,"slug":5774,"html":5775,"comment_id":5771,"feature_image":48,"featured":284,"visibility":1257,"created_at":5776,"updated_at":5758,"published_at":5776,"custom_excerpt":5777,"codeinjection_head":5778,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5779,"primary_tag":5786,"url":5787,"excerpt":5777,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5788,"meta_description":5777,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65f08b56533c9f26b94369fd","e7e5d53b-0642-4609-b3e5-8c6899ebce48","How to Convert PDF to Excel with cURL","how-to-convert-pdf-to-excel-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use PDF to Excel with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-excel\u002F'>PDF to Excel API Tool\u003C\u002Fa> is a powerful resource for converting PDF documents into editable Excel files. This tool is particularly useful for automating the process of extracting data from PDFs and making it available for analysis or reporting in a more flexible format like Excel. This tutorial will demonstrate how to make an API call to the PDF to Excel endpoint using cURL, a widely used command-line tool for transferring data with URLs.\u003C\u002Fp>\n\n\u003Cp>You might need to convert financial reports, invoices, or data tables from PDF to Excel to perform calculations, sort data, or integrate it with other datasets. For instance, an accountant could use this API to convert batches of financial statements into Excel, enabling efficient data manipulation and analysis without the need for manual data entry.\u003C\u002Fp>\n\n\u003Ch2>PDF to Excel with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fexcel\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>Reference to the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fexcel.sh\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This cURL command is used to send a POST request to the PDF to Excel API endpoint:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fexcel\"\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>-X POST\u003C\u002Fcode> specifies that this is a POST request, which is required to send data to the server to create or update resources.\u003C\u002Fp>\n\n\u003Cp>Headers are set to specify the expected response format and the content type of the request:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\n-H \"Content-Type: multipart\u002Fform-data\"\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>Accept: application\u002Fjson\u003C\u002Fcode> header tells the server that the client expects a JSON response. The \u003Ccode>Content-Type: multipart\u002Fform-data\u003C\u002Fcode> header indicates that the request body contains form data.\u003C\u002Fp>\n\n\u003Cp>The API key is included as a header for authentication:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>Replace \u003Ccode>xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\u003C\u002Fcode> with your actual API key provided by pdfRest.\u003C\u002Fp>\n\n\u003Cp>The file to be converted is included in the form data:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>-F\u003C\u002Fcode> flag denotes form data. The \u003Ccode>file=@\u002Fpath\u002Fto\u002Ffile\u003C\u002Fcode> specifies the path to the PDF file that needs to be converted. The \u003Ccode>@\u003C\u002Fcode> symbol is used to upload a file with the given path.\u003C\u002Fp>\n\n\u003Cp>Optionally, you can specify the output filename:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>output=example_out\u003C\u002Fcode> form field sets the base name for the output file. The server will append the appropriate file extension.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following this tutorial, you have learned how to use cURL to call the pdfRest PDF to Excel API to convert a PDF document into an Excel file. This is just one example of the capabilities of pdfRest's API tools. You can explore and demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for more detailed information on the available endpoints and their functionalities.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fexcel.sh\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-12T17:05:26.000+00:00","Learn how to use pdfRest PDF to Excel API Tool to convert PDF files to Excel spreadsheets with cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-curl\u002F#article\",\n      \"headline\": \"How to Convert PDF to Excel with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-curl\u002F\",\n      \"datePublished\": \"2024-03-12T17:05:26.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:40.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest PDF to Excel API Tool to convert PDF files to Excel spreadsheets with cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Excel API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-excel\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fexcel API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-microsoft-excel\"\n        }\n      ],\n      \"keywords\": \"Excel, Microsoft Office, PDF to Excel, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to Excel with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5780,5781,5782,5783,5784,5785],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1669,"name":1670,"slug":1671,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1649,"name":1650,"slug":1651,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-excel-with-curl\u002F","How to Convert PDF to Excel with cURL, Tutorial | pdfRest",{"id":5790,"uuid":5791,"title":5792,"slug":5793,"html":5794,"comment_id":5795,"feature_image":48,"featured":284,"visibility":1257,"created_at":5796,"updated_at":5797,"published_at":5796,"custom_excerpt":5798,"codeinjection_head":5799,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5800,"primary_tag":5807,"url":5808,"excerpt":5798,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5809,"meta_description":5798,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1367","807debd2-7f2f-4ea6-b154-f6dc92ad554c","How to Convert PDF to Excel with in .NET with C#","how-to-convert-pdf-to-excel-with-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to Excel with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-excel\u002F'>PDF to Excel API Tool\u003C\u002Fa> allows developers to convert PDF documents into Excel files programmatically. This can be particularly useful in scenarios where you need to extract data from a PDF report and manipulate or analyze it within a spreadsheet. For example, a financial analyst might receive monthly reports in PDF format and need to convert them to Excel to perform further analysis or integrate with other financial models.\u003C\u002Fp>\n\n\u003Cp>This tutorial will show how to send an API call to PDF to Excel using C#. By following this guide, you will learn how to make a request to the pdfRest API to convert a PDF file into an Excel document.\u003C\u002Fp>\n\n\u003Ch2>PDF to Excel with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"excel\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fexcel.cs\">Source Code\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the C# Code\u003C\u002Fh2>\n\n\u003Cp>This code snippet demonstrates how to send a PDF to Excel conversion request using the pdfRest API:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>Here, an instance of \u003Ccode>HttpClient\u003C\u002Fcode> is created with the base address set to the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>The API key is added to the request headers. Replace \u003Ccode>\"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\u003C\u002Fcode> with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n\u003C\u002Fpre>\n\n\u003Cp>A new instance of \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> is created to hold the multipart form data for the request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n\u003C\u002Fpre>\n\n\u003Cp>The PDF file is read into a byte array, and a new \u003Ccode>ByteArrayContent\u003C\u002Fcode> is created with this array. It is then added to the multipart content with the name \"file\" and the file name \"file_name\". Replace \u003Ccode>\"\u002Fpath\u002Fto\u002Ffile.pdf\"\u003C\u002Fcode> with the actual file path and \u003Ccode>\"file_name.pdf\"\u003C\u002Fcode> with the actual file name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\u003C\u002Fpre>\n\n\u003Cp>The content type of the file being uploaded is set to \u003Ccode>application\u002Fpdf\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\n\u003C\u002Fpre>\n\n\u003Cp>The request is sent asynchronously, and the response is awaited.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>The response content is read as a string, which contains the result of the API call.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use C# to call the pdfRest PDF to Excel API to convert a PDF file into an Excel spreadsheet. By understanding how to make this API call, you can now integrate this functionality into your own applications and automate the conversion process.\u003C\u002Fp>\n\n\u003Cp>I encourage you to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for further details on other endpoints and features.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fexcel.cs\">JSON Payload Examples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","658f2b0a2d4014c9499b3c27","2023-12-29T20:24:42.000+00:00","2026-09-02T18:27:46.000+00:00","Learn how you can use C# to call the PDF to Excel API Tool from pdfRest. Convert your PDF formatted file into Microsoft Excel easily.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert PDF to Excel with in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-in-net-with-c\u002F\",\n      \"datePublished\": \"2023-12-29T20:24:42.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:57.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how you can use C# to call the PDF to Excel API Tool from pdfRest. Convert your PDF formatted file into Microsoft Excel easily.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Excel API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-excel\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fexcel API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-microsoft-excel\"\n        }\n      ],\n      \"keywords\": \".NET, Excel, Microsoft Office, PDF to Excel\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to Excel with in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5801,5802,5803,5804,5805,5806],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1669,"name":1670,"slug":1671,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1649,"name":1650,"slug":1651,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-excel-with-in-net-with-c\u002F","How to Convert PDF to Excel with in .NET with C#, Tutorial | pdfRest",{"id":5811,"uuid":5812,"title":5813,"slug":5814,"html":5815,"comment_id":5811,"feature_image":48,"featured":284,"visibility":1257,"created_at":5700,"updated_at":5797,"published_at":5816,"custom_excerpt":5817,"codeinjection_head":5818,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5819,"primary_tag":5826,"url":5827,"excerpt":5817,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5828,"meta_description":5817,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c59533c9f26b943b4e1","131f2dd0-ef5c-4bfd-b779-bbf5556e107d","How to Convert PDF to Excel with Java","how-to-convert-pdf-to-excel-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>Follow this Java walkthrough to convert PDF to Excel with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-excel\u002F\">PDF to Excel API Tool\u003C\u002Fa>. The Java client posts the PDF to \u003Ccode>\u002Fexcel\u003C\u002Fcode> and retains the workbook resource information returned in the response for download or reuse. Along the way, you'll see which fields are needed to convert PDF to Excel and how the response fits into later processing.\u003C\u002Fp>\n\n\u003Ch2>Why Convert PDF to Excel with Java?\u003C\u002Fh2>\n\n\u003Cp>An accounts-payable application may receive tabular reports as PDFs while analysts need rows and columns they can sort or reconcile. Converting the document to Excel provides a practical starting point for that review.\u003C\u002Fp>\n\n\u003Cp>The Java request sends a PDF to \u003Ccode>\u002Fexcel\u003C\u002Fcode>. The generated workbook is returned as a resource, so the response ID or URL should be retained before the configured file-retention period expires.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONObject;\n\npublic class Excel {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_excel\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fexcel\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FExcel.java\">Java sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The library group combines OkHttp networking with dotenv configuration and \u003Ccode>org.json\u003C\u002Fcode> processing.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>This initialization step separates file selection from authentication so either value can change without rewriting the request.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_excel\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fexcel\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The Java request sends a PDF to \u003Ccode>\u002Fexcel\u003C\u002Fcode>. The generated workbook is returned as a resource, so the response ID or URL should be retained before the configured file-retention period expires. The multipart builder collects the named parts before OkHttp calculates the final multipart header and body encoding.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fexcel\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\u003C\u002Fpre>\n\n\u003Cp>The authenticated call adds the API key header, selects the operation URL, and attaches the prepared body; changing the base constant switches between US and EU service hosts.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>The final section shows the raw outcome for learning purposes; production code can retain output IDs and branch on reported errors.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial showed how a Java application can convert PDF to Excel. With that foundation, you can use the conversion for statements, tabular reports, exported dashboards, and other PDFs whose information must move into spreadsheet workflows.\u003C\u002Fp>\n\n\u003Cp>For production use, keep in mind that conversion reconstructs editable spreadsheet content from the PDF rather than recovering the original workbook. Review merged cells, multi-column layouts, totals, and page-spanning tables before feeding the result into calculations or automated reconciliation.\u003C\u002Fp>\n\n\u003Cp>Use \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> to inspect the request and output from the Convert PDF to Excel operation. For the complete set of options supported by Convert PDF to Excel, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-microsoft-excel\u002F\">PDF to Excel API Tool documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: The Convert PDF to Excel example above uses multipart form data; for an existing resource rather than a new upload, review how the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FExcel.java\">JSON payload example\u003C\u002Fa> constructs the request.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T21:57:34.000+00:00","Convert PDF content into an editable Excel workbook with Java.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-java\u002F#article\",\n      \"headline\": \"How to Convert PDF to Excel with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:34.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:34.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert PDF content into an editable Excel workbook with Java.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Excel API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-excel\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fexcel API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-microsoft-excel\"\n        }\n      ],\n      \"keywords\": \"Excel, Java, Microsoft Office, PDF to Excel\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to Excel with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5820,5821,5822,5823,5824,5825],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1669,"name":1670,"slug":1671,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1649,"name":1650,"slug":1651,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-excel-with-java\u002F","Convert PDF to Excel with Java | pdfRest",{"id":5830,"uuid":5831,"title":5832,"slug":5833,"html":5834,"comment_id":5835,"feature_image":48,"featured":284,"visibility":1257,"created_at":5836,"updated_at":5837,"published_at":5836,"custom_excerpt":5838,"codeinjection_head":5839,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5840,"primary_tag":5847,"url":5848,"excerpt":5838,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5849,"meta_description":5838,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1368","a7b38910-b243-44e6-97ff-94e5aeab6a62","How to Convert PDF to Excel with JavaScript in NodeJS","how-to-convert-pdf-to-excel-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to Excel with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-excel\u002F'>PDF to Excel API Tool\u003C\u002Fa> allows developers to convert PDF documents into editable Excel files programmatically. This tutorial will demonstrate how to make an API call to the PDF to Excel API using JavaScript.\u003C\u002Fp>\n\u003Cp>A user might use PDF to Excel conversion when they need to extract tabular data from a PDF report and manipulate or analyze it in a spreadsheet format.\u003C\u002Fp>\n\n\u003Ch2>PDF to Excel with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to convert a PDF to an Excel file.\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('output', 'pdfrest_excel_pdf');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fexcel', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source code reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fexcel.js\">pdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the JavaScript Code\u003C\u002Fh2>\n\n\u003Cp>The code above uses the \u003Ccode>axios\u003C\u002Fcode> library to make HTTP requests and \u003Ccode>form-data\u003C\u002Fcode> to handle multipart\u002Fform-data, which is required for file uploads. Let's break down the key parts of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('output', 'pdfrest_excel_pdf');\n\u003C\u002Fpre>\n\n\u003Cp>This creates a new \u003Ccode>FormData\u003C\u002Fcode> object and appends the PDF file and output parameters. The file is read from the specified path, and the output parameter is the desired name for the converted Excel file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fexcel',\n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\n\u003C\u002Fpre>\n\n\u003Cp>The configuration object for the \u003Ccode>axios\u003C\u002Fcode> request sets the HTTP method to POST, allows for an unlimited request body length, specifies the API endpoint, and includes the necessary headers, such as the API key and content-type. Replace 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\u003C\u002Fpre>\n\n\u003Cp>This sends the request and logs the response or error. The response will contain information about the converted Excel file, such as a download link or resource ID, depending on the API's configuration.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following this tutorial, you've learned how to make a multipart API call to convert a PDF to an Excel file using JavaScript. You can now integrate this functionality into your applications to automate the process of extracting data from PDFs into a more accessible and editable format.\u003C\u002Fp>\n\n\u003Cp>Feel free to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for more information.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fexcel.js\">JSON Payload excel.js\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","658f2b2a2d4014c9499b3c31","2023-12-29T20:25:14.000+00:00","2026-09-02T18:27:47.000+00:00","Learn how you can use JavaScript to call the PDF to Excel API Tool from pdfRest. Convert your PDF formatted file into Microsoft Excel easily.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert PDF to Excel with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2023-12-29T20:25:14.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:56.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how you can use JavaScript to call the PDF to Excel API Tool from pdfRest. Convert your PDF formatted file into Microsoft Excel easily.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Excel API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-excel\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fexcel API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-microsoft-excel\"\n        }\n      ],\n      \"keywords\": \"Excel, JavaScript, Microsoft Office, PDF to Excel\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to Excel with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5841,5842,5843,5844,5845,5846],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1669,"name":1670,"slug":1671,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1649,"name":1650,"slug":1651,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-excel-with-javascript-in-nodejs\u002F","How to Convert PDF to Excel with JavaScript in NodeJS, Tutorial | pdfRest",{"id":5851,"uuid":5852,"title":5853,"slug":5854,"html":5855,"comment_id":5856,"feature_image":48,"featured":284,"visibility":1257,"created_at":5857,"updated_at":5858,"published_at":5857,"custom_excerpt":5859,"codeinjection_head":5860,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5861,"primary_tag":5868,"url":5869,"excerpt":5859,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5870,"meta_description":5859,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1366","a3cec6c1-bacb-44a0-9098-7d916a5748b2","How to Convert PDF to Excel with PHP","how-to-convert-pdf-to-excel-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to Excel with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-excel\u002F\">PDF to Excel API Tool\u003C\u002Fa> is a powerful resource for developers looking to automate the conversion of PDF documents into Excel spreadsheets. This capability is particularly useful in scenarios where data needs to be extracted from PDFs for analysis or reporting purposes. For example, a financial analyst might need to convert bank statements provided in PDF format into Excel to perform further calculations and data manipulation.\u003C\u002Fp>\n\n\u003Cp>This tutorial will demonstrate how to send an API call to the PDF to Excel endpoint using PHP, allowing for seamless integration of this functionality into PHP-based applications or workflows.\u003C\u002Fp>\n\n\u003Ch2>PDF to Excel with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_excel'\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fexcel', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fexcel.php\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the PHP Code\u003C\u002Fh2>\n\n\u003Cp>The provided PHP code utilizes the Guzzle HTTP client to send an API request to pdfRest's PDF to Excel conversion service. Here's a breakdown of the key components:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">require 'vendor\u002Fautoload.php';\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\u003C\u002Fpre>\n\n\u003Cp>This snippet includes the necessary classes from the Guzzle library and initializes the HTTP client.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>$headers\u003C\u002Fcode> array contains the API key required for authentication with the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$options = [\n  'multipart' => [\n    \u002F\u002F File part\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    \u002F\u002F Output part\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_excel'\n    ]\n  ]\n];\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>$options\u003C\u002Fcode> array specifies the multipart payload for the request. The 'file' part includes the file to be converted, and the 'output' part indicates the desired output option.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fexcel', $headers);\n$res = $client->sendAsync($request, $options)->wait();\necho $res->getBody();\n\u003C\u002Fpre>\n\n\u003Cp>A new POST request is created with the endpoint URL and headers, and the request is sent asynchronously. The response body, which contains the Excel document, is then outputted.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you've learned how to convert a PDF document to an Excel spreadsheet using the pdfRest API with PHP. This can be a significant timesaver and can help streamline data processing tasks.\u003C\u002Fp>\n\n\u003Cp>To explore more capabilities and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further reference and documentation, check out the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">Cloud API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fexcel.php\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","658f2ad32d4014c9499b3c1d","2023-12-29T20:23:47.000+00:00","2026-09-10T20:19:12.000+00:00","Learn how you can use PHP to call the PDF to Excel API Tool from pdfRest. Convert your PDF formatted file into Microsoft Excel easily.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-php\u002F#article\",\n      \"headline\": \"How to Convert PDF to Excel with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-php\u002F\",\n      \"datePublished\": \"2023-12-29T20:23:47.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:57.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how you can use PHP to call the PDF to Excel API Tool from pdfRest. Convert your PDF formatted file into Microsoft Excel easily.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Excel API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-excel\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fexcel API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-microsoft-excel\"\n        }\n      ],\n      \"keywords\": \"Excel, Microsoft Office, PDF to Excel, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to Excel with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5862,5863,5864,5865,5866,5867],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1669,"name":1670,"slug":1671,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1649,"name":1650,"slug":1651,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-excel-with-php\u002F","How to Convert a PDF into Excel with PHP, Tutorial | pdfRest",{"id":5872,"uuid":5873,"title":5874,"slug":5875,"html":5876,"comment_id":5877,"feature_image":48,"featured":284,"visibility":1257,"created_at":5878,"updated_at":5837,"published_at":5878,"custom_excerpt":5879,"codeinjection_head":5880,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5881,"primary_tag":5888,"url":5889,"excerpt":5879,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5890,"meta_description":5879,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1365","4a83ff1e-c626-4353-964f-affd31131239","How to Convert PDF to Excel with Python","how-to-convert-pdf-to-excel-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to Excel with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-excel\u002F'>PDF to Excel API Tool\u003C\u002Fa> is a powerful resource for developers who need to convert PDF documents into Excel spreadsheets programmatically. This tutorial will guide you through the process of sending an API call to the PDF to Excel API using Python.\u003C\u002Fp>\n\u003Cp>There are many reasons to convert PDF to Excel. One example is extracting tabular data from PDF reports to perform data analysis or manipulation within an Excel spreadsheet, which is more suitable for such tasks.\u003C\u002Fp>\n\n\u003Ch2>PDF to Excel with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nexcel_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fexcel'\n\n# The \u002Fexcel endpoint can take a single PDF file or id as input.\n# This sample demonstrates converting a PDF to an Excel document.\nmp_encoder_excel = MultipartEncoder(\n    fields={\n        'file': ('file_name', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_excel_out',\n    }\n)\n\n# Let's set the headers that the Excel endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_excel.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to excel endpoint...\")\nresponse = requests.post(excel_endpoint_url, data=mp_encoder_excel, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source code reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fexcel.py\">pdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Python Code\u003C\u002Fh2>\n\n\u003Cp>The code above demonstrates how to use the pdfRest API to convert a PDF file to an Excel spreadsheet using Python:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Ccode>MultipartEncoder\u003C\u002Fcode> is used to encode the PDF file and the desired output name as multipart form-data for the POST request.\u003C\u002Fli>\n\u003Cli>The \u003Ccode>fields\u003C\u002Fcode> dictionary contains the file to be converted and the desired output file name. The 'file' key expects a tuple with the filename, file object, and content type.\u003C\u002Fli>\n\u003Cli>The \u003Ccode>headers\u003C\u002Fcode> dictionary sets the required headers, including the 'Accept' header specifying the response format, the 'Content-Type' header set by the \u003Ccode>MultipartEncoder\u003C\u002Fcode>, and the 'Api-Key' header for authentication.\u003C\u002Fli>\n\u003Cli>A POST request is sent to the \u003Ccode>excel_endpoint_url\u003C\u002Fcode> with the encoded data and headers.\u003C\u002Fli>\n\u003Cli>The response is checked for success (\u003Ccode>response.ok\u003C\u002Fcode>), and the JSON response is printed. If the request fails, the error text is printed instead.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we accomplished sending an API request to convert a PDF to an Excel spreadsheet using the pdfRest API. This is particularly useful for automating the extraction of data from PDFs into a more flexible format like Excel. Users are encouraged to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for further exploration.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fexcel.py\">pdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","658f2ab02d4014c9499b3c13","2023-12-29T20:23:12.000+00:00","Learn how you can use Python to call the PDF to Excel API Tool from pdfRest. Convert your PDF files into Microsoft Excel .xlsx format.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-python\u002F#article\",\n      \"headline\": \"How to Convert PDF to Excel with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-python\u002F\",\n      \"datePublished\": \"2023-12-29T20:23:12.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:57.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how you can use Python to call the PDF to Excel API Tool from pdfRest. Convert your PDF files into Microsoft Excel .xlsx format.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Excel API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-excel\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fexcel API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-microsoft-excel\"\n        }\n      ],\n      \"keywords\": \"Excel, Microsoft Office, PDF to Excel, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to Excel with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-excel-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5882,5883,5884,5885,5886,5887],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1669,"name":1670,"slug":1671,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1649,"name":1650,"slug":1651,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-excel-with-python\u002F","How to Convert a PDF to Excel with Python, Tutorial | pdfRest",{"id":5892,"uuid":5893,"title":5894,"slug":5895,"html":5896,"comment_id":5892,"feature_image":48,"featured":284,"visibility":1257,"created_at":5897,"updated_at":5898,"published_at":5897,"custom_excerpt":5899,"codeinjection_head":5900,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5901,"primary_tag":5908,"url":5909,"excerpt":5899,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5910,"meta_description":5899,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ce60d1533c9f26b94363c3","e9f5f7cc-7726-47b4-9315-207cb90b9822","How to Convert PDF to JPG in .NET with C#","how-to-convert-pdf-to-jpg-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to JPG with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F'>PDF to Images API Tool\u003C\u002Fa> allows developers to convert PDF documents into image files programmatically. This API is useful in scenarios where you need to display PDF content as images on platforms that do not support PDF rendering natively, or when you want to generate thumbnails or previews of PDF documents for a user interface. \u003C\u002Fp>\n\u003Cp>For example, an application that manages digital assets might use this API to create image previews of uploaded PDF files so that users can quickly browse through a collection without opening each file.\u003C\u002Fp>\n\n\u003Ch2>Convert PDF to JPG with C# Code Example\u003C\u002Fh2>\n\n\u003Cp>Here is the complete C# code example that demonstrates how to make an API call to the PDF to Images endpoint using pdfRest:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"jpg\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fjpg.cs\">pdfRest API Samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This code snippet is a C# example of how to send a multipart\u002Fform-data request to the pdfRest API to convert a PDF file to images:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>This initializes a new instance of the HttpClient class and sets the base address for the API calls to the pdfRest service.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var request = new HttpRequestMessage(HttpMethod.Post, \"jpg\"))\n\u003C\u002Fpre>\n\n\u003Cp>A new HttpRequestMessage is created with the HTTP method POST to the \"jpg\" endpoint, which is used to convert PDF to JPG images.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>This line adds your API key to the request headers for authorization. Replace \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n\u003C\u002Fpre>\n\n\u003Cp>A new instance of MultipartFormDataContent is created to hold the parts of the multipart\u002Fform-data request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\u003C\u002Fpre>\n\n\u003Cp>These lines read the PDF file as a byte array, create a ByteArrayContent with this array, and add it to the multipartContent with the name \"file\" and a filename. The content type for this part is set to \"application\u002Fpdf\".\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Content = multipartContent;\n\u003C\u002Fpre>\n\n\u003Cp>The multipart content is then assigned to the Content property of the request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\n\u003C\u002Fpre>\n\n\u003Cp>This line sends the request asynchronously and waits for the response from the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>Once the response is received, the content is read as a string, which contains the result of the API call.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we walked through the process of making an API call to the pdfRest PDF to Images endpoint using C#. The code example provided demonstrates how to send a PDF file and receive the converted images in response. You can now explore and demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for more details on the available endpoints and their usage.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fjpg.cs\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-15T19:06:57.000+00:00","2026-09-02T18:27:48.000+00:00","Learn how to use pdfRest PDF to Images API Tool to convert PDF documents to JPG image files with C#","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert PDF to JPG in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-02-15T19:06:57.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:47.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest PDF to Images API Tool to convert PDF documents to JPG image files with C#\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fjpg API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\"\n        }\n      ],\n      \"keywords\": \".NET, JPG, PDF to Images, Thumbnail\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to JPG in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5902,5903,5904,5905,5906,5907],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1538,"name":1539,"slug":1540,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1542,"name":1543,"slug":1544,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1562,"name":1563,"slug":1564,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-jpg-in-net-with-c\u002F","How to Convert PDF to JPG in .NET with C#, Tutorial | pdfRest",{"id":5912,"uuid":5913,"title":5914,"slug":5915,"html":5916,"comment_id":5912,"feature_image":48,"featured":284,"visibility":1257,"created_at":5917,"updated_at":5898,"published_at":5917,"custom_excerpt":5918,"codeinjection_head":5919,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5920,"primary_tag":5927,"url":5928,"excerpt":5918,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5929,"meta_description":5918,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65f08adc533c9f26b94369f3","dbc03c62-9d52-4eda-a3cc-0d772a26f268","How to Convert PDF to JPG with cURL","how-to-convert-pdf-to-jpg-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to JPG with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F'>PDF to Images API Tool\u003C\u002Fa> is a powerful resource for developers who need to convert PDF documents into image files programmatically. This tool provides a simple and efficient way to transform entire PDFs or select pages into images in various formats such as JPEG, PNG, and TIFF. This tutorial will guide you through the process of sending an API call to the PDF to Images API using cURL, a command-line tool for getting or sending data using URL syntax.\u003C\u002Fp>\n\n\u003Cp>There are many scenarios where converting a PDF to images could be useful. For instance, a web application might allow users to preview the first page of a PDF document as a thumbnail before downloading it. Alternatively, a document management system might convert uploaded PDFs into images to enable quick viewing without the need for a PDF reader. These are just a couple of examples where the PDF to Images API can be utilized.\u003C\u002Fp>\n\n\u003Ch2>Convert PDF to JPG with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fjpg\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\" \\\n  -F \"pages=1-last\" \\\n  -F \"resolution=300\" \\\n  -F \"color_model=rgb\" \\\n  -F \"jpeg_quality=100\"\n\u003C\u002Fpre>\n\n\u003Cp>Reference to the code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fjpg.sh\">pdfRest API samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The above code block demonstrates how to use cURL to make a POST request to the pdfRest API's PDF to Images endpoint. Here's what each part of the command does:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fjpg\"\u003C\u002Fpre>\n\n\u003Cp>This specifies that you are making a POST request to the endpoint that converts PDFs to JPG images.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\u003C\u002Fpre>\n\n\u003Cp>This header tells the server that the client expects a response in JSON format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the data being sent in the request is multipart form data, which is necessary for file uploads.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\u003C\u002Fpre>\n\n\u003Cp>You must replace the placeholder with your actual API key to authenticate the request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\u003C\u002Fpre>\n\n\u003Cp>This form field is where you specify the file path to the PDF you want to convert.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\u003C\u002Fpre>\n\n\u003Cp>Here you define the base name for the output files. The API will add a page number and file extension to this base name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"pages=1-last\"\u003C\u002Fpre>\n\n\u003Cp>This field specifies the range of pages to convert. \"1-last\" means all pages in the PDF will be converted.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"resolution=300\"\u003C\u002Fpre>\n\n\u003Cp>The resolution field sets the DPI (dots per inch) for the output images, which affects their quality and size.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"color_model=rgb\"\u003C\u002Fpre>\n\n\u003Cp>This option sets the color model for the output images. \"rgb\" is suitable for full-color images.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"jpeg_quality=100\"\u003C\u002Fpre>\n\n\u003Cp>Finally, this sets the quality of the JPEG output. A value of 100 indicates the highest quality.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you've learned how to use cURL to call the pdfRest PDF to Images API to convert a PDF into high-quality images. By following the steps outlined above, you can integrate this functionality into your own applications or workflows. To explore more possibilities and try out all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For a deeper understanding of the API's capabilities and additional options you can use in your requests, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fjpg.sh\">pdfRest API samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-12T17:03:24.000+00:00","Learn how to convert PDF pages into JPG images with pdfRest PDF to Images API Tool using cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-with-curl\u002F#article\",\n      \"headline\": \"How to Convert PDF to JPG with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-with-curl\u002F\",\n      \"datePublished\": \"2024-03-12T17:03:24.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:40.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert PDF pages into JPG images with pdfRest PDF to Images API Tool using cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fjpg API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\"\n        }\n      ],\n      \"keywords\": \"JPG, PDF to Images, Thumbnail, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to JPG with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5921,5922,5923,5924,5925,5926],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1538,"name":1539,"slug":1540,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1542,"name":1543,"slug":1544,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1562,"name":1563,"slug":1564,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-jpg-with-curl\u002F","How to Convert PDF to JPG with cURL, Tutorial | pdfRest",{"id":5931,"uuid":5932,"title":5933,"slug":5934,"html":5935,"comment_id":5931,"feature_image":48,"featured":284,"visibility":1257,"created_at":5936,"updated_at":5937,"published_at":5816,"custom_excerpt":5938,"codeinjection_head":5939,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5940,"primary_tag":5947,"url":5948,"excerpt":5938,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5949,"meta_description":5938,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c5a533c9f26b943b4ec","3084eab6-c509-49eb-9e42-d44d75e60bce","How to Convert PDF to JPG with Java","how-to-convert-pdf-to-jpg-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>In the following tutorial, you'll use Java and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\">PDF to Images API Tool\u003C\u002Fa> to convert PDF to JPG. The request demonstrates page selection and raster controls, including JPEG quality, for producing one image resource per rendered page. The example is designed to clarify both the API-specific fields and the surrounding HTTP request used to convert PDF to JPG.\u003C\u002Fp>\n\n\u003Ch2>Why Convert PDF to JPG with Java?\u003C\u002Fh2>\n\n\u003Cp>A document portal may need lightweight page previews without loading an entire PDF viewer. Converting selected pages to JPEG creates familiar image assets for thumbnails, review queues, and previews.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>\u002Fjpg\u003C\u002Fcode> request accepts page-selection and image settings along with the PDF. Each rendered page is represented in the response as an output resource.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class Jpg {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_jpg\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fjpg\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FJpg.java\">Java sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>This client relies on OkHttp to send the call, dotenv to resolve credentials, and \u003Ccode>org.json\u003C\u002Fcode> to inspect or format JSON.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>The sample configuration supports quick local testing while allowing normal callers to provide their own path and \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_jpg\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fjpg\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>\u002Fjpg\u003C\u002Fcode> request accepts page-selection and image settings along with the PDF. Each rendered page is represented in the response as an output resource. This request body sets \u003Ccode>MultipartBody.FORM\u003C\u002Fcode>, allowing OkHttp to generate the matching boundary automatically.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fjpg\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The HTTP request joins authentication, routing, and payload in one place while leaving regional service selection in the API URL constant.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>The example output logic makes success and failure information available to the caller, including any temporary resources that must be saved or reused before expiration.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>We have now covered the request and response flow for using Java to convert PDF to JPG. With that foundation, jPEG works well for photographic pages and compact previews where lossy compression is acceptable.\u003C\u002Fp>\n\n\u003Cp>Before relying on the result in an automated workflow, lower JPEG quality reduces transfer and storage costs but can introduce artifacts around small text and line art. Use modest settings for thumbnails, higher settings for review copies, and explicit page ranges when an application needs only selected previews.\u003C\u002Fp>\n\n\u003Cp>Continue testing representative documents with the Convert PDF to JPG operation in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. The \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\u002F\">PDF to Images API Tool documentation\u003C\u002Fa> provides authoritative defaults, accepted fields, and limitations for the Convert PDF to JPG operation.\u003C\u002Fp>\n\n\u003Cp>Note: The Convert PDF to JPG example above uses multipart form data; when the input is already stored in pdfRest, see the request shape in the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FJpg.java\">JSON payload example\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T17:33:14.000+00:00","2026-09-02T18:27:49.000+00:00","Render PDF pages as JPEG images with Java and control image output settings.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-with-java\u002F#article\",\n      \"headline\": \"How to Convert PDF to JPG with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:34.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:34.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Render PDF pages as JPEG images with Java and control image output settings.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fjpg API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\"\n        }\n      ],\n      \"keywords\": \"JPG, Java, PDF to Images, Thumbnail\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to JPG with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5941,5942,5943,5944,5945,5946],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1538,"name":1539,"slug":1540,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1542,"name":1543,"slug":1544,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1562,"name":1563,"slug":1564,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-jpg-with-java\u002F","Convert PDF to JPG with Java | pdfRest",{"id":5951,"uuid":5952,"title":5953,"slug":5954,"html":5955,"comment_id":5951,"feature_image":48,"featured":284,"visibility":1257,"created_at":5956,"updated_at":5937,"published_at":5956,"custom_excerpt":5957,"codeinjection_head":5958,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5959,"primary_tag":5966,"url":5967,"excerpt":5957,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5968,"meta_description":5957,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ce6130533c9f26b94363cd","6126d4a6-91d8-43f8-9c3a-65dfaa37593a","How to Convert PDF to JPG with JavaScript in NodeJS","how-to-convert-pdf-to-jpg-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to JPG with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F'>PDF to Images API Tool\u003C\u002Fa> is a powerful resource for developers who need to convert PDF documents into image files programmatically. This tutorial will guide you through the process of sending an API call to the PDF to Images tool using JavaScript.\u003C\u002Fp>\n\u003Cp>This functionality is particularly useful in scenarios such as creating thumbnails for document previews, processing documents for web publication, or extracting visual content from PDFs for further use.\u003C\u002Fp>\n\n\u003Ch2>Convert PDF to JPG with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to convert a PDF into JPG image files, one per PDF page.\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile')); \ndata.append('pages', '1-last');\ndata.append('resolution', '300');\ndata.append('color_model', 'rgb');\ndata.append('jpeg_quality', '75');\ndata.append('output', 'pdfrest_jpg');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fjpg', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source code reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fjpg.js\">pdfRest API Samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided code is a JavaScript example that uses the Axios library to send a multipart\u002Fform-data POST request to the pdfRest API to convert a PDF file into JPG images.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\u003C\u002Fpre>\n\n\u003Cp>These lines import the required modules: Axios for HTTP requests, FormData to construct the multipart\u002Fform-data payload, and fs to interact with the file system.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile')); \n...\ndata.append('output', 'pdfrest_jpg');\n\u003C\u002Fpre>\n\n\u003Cp>This snippet creates a new FormData instance and appends the file and various parameters such as 'pages', 'resolution', 'color_model', 'jpeg_quality', and 'output'.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  ...\n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\u003C\u002Fpre>\n\n\u003Cp>The configuration object for Axios includes the API endpoint URL, the method (POST), headers including the API key, and the FormData instance as the request body.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the Axios instance sends the request and handles the response or error. If successful, the response data is logged to the console.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following this tutorial, you've learned how to convert a PDF to JPG images using the pdfRest API with JavaScript. You can now integrate this functionality into your own applications and automate document processing tasks.\u003C\u002Fp>\n\n\u003Cp>For further exploration and to demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fjpg.js\">pdfRest API Samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-15T19:08:32.000+00:00","Learn how to convert PDF documents to JPG image files using pdfRest PDF to Images API Tool with JavaScript","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert PDF to JPG with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-02-15T19:08:32.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:47.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert PDF documents to JPG image files using pdfRest PDF to Images API Tool with JavaScript\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fjpg API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\"\n        }\n      ],\n      \"keywords\": \"JPG, JavaScript, PDF to Images, Thumbnail\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to JPG with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5960,5961,5962,5963,5964,5965],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1538,"name":1539,"slug":1540,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1542,"name":1543,"slug":1544,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1562,"name":1563,"slug":1564,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-jpg-with-javascript-in-nodejs\u002F","How to Convert PDF to JPG with JavaScript in NodeJS, Tutorial | pdfRest",{"id":5970,"uuid":5971,"title":5972,"slug":5973,"html":5974,"comment_id":5970,"feature_image":48,"featured":284,"visibility":1257,"created_at":5975,"updated_at":5937,"published_at":5975,"custom_excerpt":5976,"codeinjection_head":5977,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5978,"primary_tag":5985,"url":5986,"excerpt":5976,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":5987,"meta_description":5976,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ce61d2533c9f26b94363d7","2b337870-75ae-4897-b3ae-b72a6c16674b","How to Convert PDF to JPG with PHP","how-to-convert-pdf-to-jpg-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to JPG with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F'>PDF to Images API Tool\u003C\u002Fa> allows developers to convert PDF documents into image files programmatically. In this tutorial, we will explore how to send an API call to the PDF to Images endpoint using PHP.\u003C\u002Fp>\n\u003Cp>This functionality is particularly useful in scenarios where you need to display PDF content as images on a web page, extract images for archival purposes, or prepare documents for presentations where image formats are required.\u003C\u002Fp>\n\n\u003Ch2>Convert PDF to JPG with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">\nrequire 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'pages',\n      'contents' => '1-last'\n    ],\n    [\n      'name' => 'resolution',\n      'contents' => '300'\n    ],\n    [\n      'name' => 'color_model',\n      'contents' => 'rgb'\n    ],\n    [\n      'name' => 'jpeg_quality',\n      'contents' => '75'\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_jpg'\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fjpg', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fjpg.php\">PDF to Images API PHP Sample Code\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code above is a PHP script that uses the Guzzle HTTP client to make a multipart\u002Fform-data POST request to the pdfRest API. Here's a breakdown of the key parts:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Ccode>require 'vendor\u002Fautoload.php';\u003C\u002Fcode>: This line includes the Composer autoload file, which autoloads the Guzzle HTTP client library.\u003C\u002Fli>\n\u003Cli>\u003Ccode>use GuzzleHttp\\Client;\u003C\u002Fcode>: This imports the Guzzle HTTP client class into the current namespace.\u003C\u002Fli>\n\u003Cli>\u003Ccode>$headers\u003C\u002Fcode>: This array contains the necessary headers for the request, including the 'Api-Key' used for authentication with the pdfRest API.\u003C\u002Fli>\n\u003Cli>\u003Ccode>$options\u003C\u002Fcode>: This array specifies the multipart\u002Fform-data fields. Each field has a 'name' and 'contents' key, and some fields may include additional headers or filenames.\u003C\u002Fli>\n\u003Cli>\u003Ccode>new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fjpg', $headers);\u003C\u002Fcode>: This creates a new HTTP POST request with the specified URL and headers.\u003C\u002Fli>\n\u003Cli>\u003Ccode>$client->sendAsync($request, $options)->wait();\u003C\u002Fcode>: This sends the request asynchronously and waits for the response.\u003C\u002Fli>\n\u003Cli>\u003Ccode>echo $res->getBody();\u003C\u002Fcode>: This line outputs the response body, which should contain the converted image data.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've demonstrated how to call the pdfRest PDF to Images API using PHP. By sending a multipart\u002Fform-data request, we've instructed the API to convert a PDF file into images, with options to specify pages, resolution, color model, JPEG quality, and output file name. To explore all of the pdfRest API Tools, you can visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for more details.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fjpg.php\">JSON Payload PHP Sample Code\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-15T19:11:14.000+00:00","Learn how to convert PDF to JPG using pdfRest PDF to Images API Tool with PHP","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-with-php\u002F#article\",\n      \"headline\": \"How to Convert PDF to JPG with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-with-php\u002F\",\n      \"datePublished\": \"2024-02-15T19:11:14.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:47.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert PDF to JPG using pdfRest PDF to Images API Tool with PHP\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fjpg API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\"\n        }\n      ],\n      \"keywords\": \"JPG, PDF to Images, PHP, Thumbnail\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to JPG with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[5979,5980,5981,5982,5983,5984],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1538,"name":1539,"slug":1540,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1542,"name":1543,"slug":1544,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1562,"name":1563,"slug":1564,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-jpg-with-php\u002F","How to Convert PDF to JPG with PHP, Tutorial | pdfRest",{"id":5989,"uuid":5990,"title":5991,"slug":5992,"html":5993,"comment_id":5994,"feature_image":48,"featured":284,"visibility":1257,"created_at":5995,"updated_at":5996,"published_at":5995,"custom_excerpt":5997,"codeinjection_head":5998,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":5999,"primary_tag":6006,"url":6007,"excerpt":5997,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6008,"meta_description":5997,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1353","b49d3070-82cc-4268-8f50-cef20fdaa2ee","How to Convert PDF to JPG with Python","how-to-convert-pdf-to-jpg-image-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to JPG with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F'>PDF to Images API Tool\u003C\u002Fa> is a powerful resource that allows users to convert PDF documents into image files, such as JPEGs. This can be incredibly useful in scenarios where you need to display PDF content as images on a website, in a presentation, or for archival purposes where images are preferred.\u003C\u002Fp>\n\u003Cp>In this tutorial, we will walk through how to send an API call to the PDF to Images API using Python.\u003C\u002Fp>\n\n\u003Ch2>Convert PDF to JPG Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\njpg_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fjpg'\n\nmp_encoder_jpg = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'pages': '1-last',\n        'resolution': '600',\n        'color_model': 'cmyk',\n        'jpeg_quality': '90',\n        'output' : 'example_jpg_out',\n    }\n)\n\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_jpg.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\n\nprint(\"Sending POST request to jpg endpoint...\")\nresponse = requests.post(jpg_endpoint_url, data=mp_encoder_jpg, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Source of the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fjpg.py\">pdf-rest-api-samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code provided is a Python script that uses the pdfRest API to convert a PDF document into JPEG images. Let's break down each part of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\u003C\u002Fpre>\n\n\u003Cp>This imports the necessary libraries. \u003Ccode>MultipartEncoder\u003C\u002Fcode> from \u003Ccode>requests_toolbelt\u003C\u002Fcode> is used for encoding files as multipart\u002Fform-data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">jpg_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fjpg'\u003C\u002Fpre>\n\n\u003Cp>This sets the API endpoint URL for the PDF to JPEG conversion service.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_jpg = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        ...\n    }\n)\u003C\u002Fpre>\n\n\u003Cp>This section constructs the multipart payload. It includes the PDF file to convert and other parameters such as:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Ccode>'pages'\u003C\u002Fcode>: Defines the range of pages to convert. '1-last' means all pages.\u003C\u002Fli>\n\u003Cli>\u003Ccode>'resolution'\u003C\u002Fcode>: Sets the resolution of the output images in DPI.\u003C\u002Fli>\n\u003Cli>\u003Ccode>'color_model'\u003C\u002Fcode>: Specifies the color model of the output images.\u003C\u002Fli>\n\u003Cli>\u003Ccode>'jpeg_quality'\u003C\u002Fcode>: Determines the quality of the JPEG images.\u003C\u002Fli>\n\u003Cli>\u003Ccode>'output'\u003C\u002Fcode>: The prefix for the output file names.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-python\">headers = {\n    ...\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\u003C\u002Fpre>\n\n\u003Cp>The headers include the content type and the API key for authentication.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(jpg_endpoint_url, data=mp_encoder_jpg, headers=headers)\u003C\u002Fpre>\n\n\u003Cp>This sends the POST request to the API endpoint with the payload and headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    ...\nelse:\n    print(response.text)\u003C\u002Fpre>\n\n\u003Cp>If the request is successful, the script prints the JSON response. Otherwise, it prints the error response.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've learned how to use Python to send an API call to the pdfRest PDF to Images API to convert a PDF file into JPEG images. By following the steps outlined, you can transform PDFs into high-quality images for various applications.\u003C\u002Fp>\n\n\u003Cp>Feel free to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for more information.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fjpg.py\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","6582151f2d4014c9499b39ee","2023-12-19T22:11:43.000+00:00","2026-09-02T18:27:50.000+00:00","Learn how to use the PDF to Image API Tool from pdfRest with Python to turn PDF documents into JPG image formats.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-image-with-python\u002F#article\",\n      \"headline\": \"How to Convert PDF to JPG with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-image-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-image-with-python\u002F\",\n      \"datePublished\": \"2023-12-19T22:11:43.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:59.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use the PDF to Image API Tool from pdfRest with Python to turn PDF documents into JPG image formats.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fjpg API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\"\n        }\n      ],\n      \"keywords\": \"JPG, PDF to Images, Python, Thumbnail\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to JPG with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-jpg-image-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6000,6001,6002,6003,6004,6005],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1538,"name":1539,"slug":1540,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1542,"name":1543,"slug":1544,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1562,"name":1563,"slug":1564,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-jpg-image-with-python\u002F","How to Convert PDF to JPG Image with Python, Tutorial | pdfRest",{"id":6010,"uuid":6011,"title":6012,"slug":6013,"html":6014,"comment_id":6010,"feature_image":48,"featured":284,"visibility":1257,"created_at":6015,"updated_at":5996,"published_at":6015,"custom_excerpt":6016,"codeinjection_head":6017,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6018,"primary_tag":6026,"url":6027,"excerpt":6016,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6028,"meta_description":6016,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6870380d533c9f26b9439cb1","2e4ce75f-f263-4483-82ec-946c3fc13a9a","How to Convert PDF to Markdown in .NET with C#","how-to-convert-pdf-to-markdown-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to Markdown with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-markdown\u002F'>PDF to Markdown API Tool\u003C\u002Fa> is an efficient solution for developers looking to convert PDF documents into Markdown format using C#. This tutorial will guide you through the process of sending an API call to the PDF to Markdown endpoint using C#. By following this guide, you will learn how to integrate this functionality into your applications, making it easier to manipulate and present PDF content in a more accessible and editable Markdown format.\u003C\u002Fp>\n\n\u003Cp>Converting PDFs to Markdown can be incredibly useful for content creators and developers who need to repurpose or edit documents. For instance, a technical writer might receive a PDF document containing a user manual that needs to be updated. By converting the PDF to Markdown, the writer can easily edit the content in a text editor, apply version control, and collaborate with others, streamlining the documentation process.\u003C\u002Fp>\n\n\u003Ch2>PDF to Markdown with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"markdown\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"on\"));\n        multipartContent.Add(byteArrayOption, \"page_break_comments\");\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"Markdown API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fmarkdown.cs\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by creating an instance of \u003Ccode>HttpClient\u003C\u002Fcode> with a base address set to the pdfRest API endpoint. This sets up the client to send requests to \u003Ccode>https:\u002F\u002Fapi.pdfrest.com\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>A new \u003Ccode>HttpRequestMessage\u003C\u002Fcode> is created for a POST request to the \"markdown\" endpoint. The API key is added to the request headers for authentication, and the request is set to accept JSON responses.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var request = new HttpRequestMessage(HttpMethod.Post, \"markdown\"))\n{\n    request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n    request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> is used to construct the request body. The PDF file is read as a byte array and added to the form data with the field name \"file\". The content type is specified as \"application\u002Fpdf\".\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n\nvar byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\u003C\u002Fpre>\n\n\u003Cp>An additional option to include page break comments is added to the form data. This is done by adding a byte array containing the string \"on\".\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"on\"));\nmultipartContent.Add(byteArrayOption, \"page_break_comments\");\n\u003C\u002Fpre>\n\n\u003Cp>The request is sent asynchronously, and the response is read as a string. The output is printed to the console.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\n\nvar apiResult = await response.Content.ReadAsStringAsync();\n\nConsole.WriteLine(\"Markdown API response received.\");\nConsole.WriteLine(apiResult);\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following this tutorial, you have learned how to make an API call to convert a PDF document to Markdown using C#. This process can be integrated into your applications to automate document conversion tasks. For further exploration, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for more detailed information.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fmarkdown.cs\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-07-10T22:00:45.000+00:00","Learn how to convert PDF content to structured Markdown output with pdfRest API Toolkit in C#.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert PDF to Markdown in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-in-net-with-c\u002F\",\n      \"datePublished\": \"2025-07-10T22:00:45.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:13.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert PDF content to structured Markdown output with pdfRest API Toolkit in C#.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Markdown API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-markdown\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fmarkdown API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-markdown\"\n        }\n      ],\n      \"keywords\": \".NET, AI, Convert, Extract, PDF to Markdown\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to Markdown in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6019,6020,6021,6022,6023,6024,6025],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1500,"name":1501,"slug":1502,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1279,"name":1280,"slug":1281,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-markdown-in-net-with-c\u002F","How to Convert PDF to Markdown in .NET with C#, Tutorial | pdfRest",{"id":6030,"uuid":6031,"title":6032,"slug":6033,"html":6034,"comment_id":6030,"feature_image":48,"featured":284,"visibility":1257,"created_at":6035,"updated_at":6036,"published_at":6035,"custom_excerpt":6037,"codeinjection_head":6038,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6039,"primary_tag":6047,"url":6048,"excerpt":6037,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6049,"meta_description":6037,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6870385e533c9f26b9439cc5","31dd3919-32ca-4e74-b7eb-eb6b04d29e94","How to Convert PDF to Markdown with cURL","how-to-convert-pdf-to-markdown-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to Markdown with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-markdown\u002F'>PDF to Markdown API Tool\u003C\u002Fa> is a powerful utility that allows users to convert PDF documents into Markdown format, a lightweight markup language that is easy to read and write. This tutorial will guide you through the process of sending an API call to the PDF to Markdown endpoint using cURL, a command-line tool used for transferring data with URLs. By using cURL, you can automate the conversion process and integrate it into your existing workflows.\u003C\u002Fp>\n\n\u003Cp>A user might want to convert a PDF document to Markdown for easier editing and collaboration. For instance, a technical writer may receive documentation in PDF format and need to convert it to Markdown to integrate it into a version-controlled repository, allowing for collaborative editing and version tracking. By using the PDF to Markdown API, this process can be streamlined and automated, saving time and reducing the potential for errors.\u003C\u002Fp>\n\n\u003Ch2>PDF to Markdown with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">\ncurl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fmarkdown\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\"\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fmarkdown.sh\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided code is a shell script that uses cURL to send a POST request to the pdfRest API's PDF to Markdown endpoint. Let's break down each part of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fmarkdown\"\u003C\u002Fpre>\n\n\u003Cp>This line specifies that we are making a POST request to the URL \u003Ccode>https:\u002F\u002Fapi.pdfrest.com\u002Fmarkdown\u003C\u002Fcode>, which is the endpoint for converting PDFs to Markdown.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the client expects the server to respond with JSON formatted data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>Content-Type\u003C\u002Fcode> header is set to \u003Ccode>multipart\u002Fform-data\u003C\u002Fcode>, which is necessary for file uploads. This tells the server that the request body contains file data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\u003C\u002Fpre>\n\n\u003Cp>This header includes the API key, which is a unique identifier used to authenticate the request. Replace \u003Ccode>xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\u003C\u002Fcode> with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>-F\u003C\u002Fcode> option is used to specify the file to be uploaded. The \u003Ccode>@\u003C\u002Fcode> symbol indicates that the following path is a file path. Replace \u003Ccode>\u002Fpath\u002Fto\u002Ffile\u003C\u002Fcode> with the actual path to the PDF file you want to convert.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use cURL to send a request to the pdfRest PDF to Markdown API, allowing you to convert PDF files into Markdown format. This process can be integrated into your workflows for automated document conversion.\u003C\u002Fp>\n\n\u003Cp>To explore more about pdfRest API tools, you can demo all available tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fmarkdown.sh\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-07-10T22:02:06.000+00:00","2026-09-02T18:27:51.000+00:00","Learn how to convert PDF content to structured Markdown output using pdfRest API Toolkit with cURL.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-curl\u002F#article\",\n      \"headline\": \"How to Convert PDF to Markdown with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-curl\u002F\",\n      \"datePublished\": \"2025-07-10T22:02:06.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:13.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert PDF content to structured Markdown output using pdfRest API Toolkit with cURL.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Markdown API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-markdown\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fmarkdown API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-markdown\"\n        }\n      ],\n      \"keywords\": \"AI, Convert, Extract, PDF to Markdown, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to Markdown with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6040,6041,6042,6043,6044,6045,6046],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1500,"name":1501,"slug":1502,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1279,"name":1280,"slug":1281,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-markdown-with-curl\u002F","How to Convert PDF to Markdown with cURL, Tutorial | pdfRest",{"id":6051,"uuid":6052,"title":6053,"slug":6054,"html":6055,"comment_id":6051,"feature_image":48,"featured":284,"visibility":1257,"created_at":6056,"updated_at":6036,"published_at":6056,"custom_excerpt":6057,"codeinjection_head":6058,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6059,"primary_tag":6067,"url":6068,"excerpt":6057,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6069,"meta_description":6057,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"687038b5533c9f26b9439ccf","ee2bc45a-e30c-4237-8186-f84fe68ca370","How to Convert PDF to Markdown with Java","how-to-convert-pdf-to-markdown-with-java-code","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to Markdown with Java?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-markdown\u002F'>PDF to Markdown API Tool\u003C\u002Fa> provides a seamless way to convert PDF documents into Markdown format, which is widely used for formatting text on the web. This tutorial will guide you on how to send an API call to the PDF to Markdown endpoint using Java, enabling you to automate the conversion process within your Java applications.\u003C\u002Fp>\n\n\u003Cp>You might have a repository of PDF documents that you want to convert into Markdown for easier web publishing or integration into a content management system. For example, a technical writer might use this tool to convert PDF manuals into Markdown to maintain a consistent format across a documentation website.\u003C\u002Fp>\n\n\u003Ch2>PDF to Markdown with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONObject;\n\npublic class Markdown {\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"page_break_comments\", \"on\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fmarkdown\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client = new OkHttpClient().newBuilder().build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FMarkdown.java\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary libraries such as OkHttp for HTTP requests and Dotenv for environment variable management. The \u003Ccode>DEFAULT_FILE_PATH\u003C\u002Fcode> and \u003Ccode>DEFAULT_API_KEY\u003C\u002Fcode> are placeholders for the file path and API key, respectively.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">File inputFile;\nif (args.length > 0) {\n  inputFile = new File(args[0]);\n} else {\n  inputFile = new File(DEFAULT_FILE_PATH);\n}\n\u003C\u002Fpre>\n\n\u003Cp>This snippet checks if a file path is provided as a command-line argument. If not, it defaults to the specified file path.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\u003C\u002Fpre>\n\n\u003Cp>The Dotenv library is used to load environment variables, allowing you to manage sensitive information like API keys securely.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n    RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\nRequestBody requestBody =\n    new MultipartBody.Builder()\n        .setType(MultipartBody.FORM)\n        .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n        .addFormDataPart(\"page_break_comments\", \"on\")\n        .build();\n\u003C\u002Fpre>\n\n\u003Cp>This segment constructs the request body for the API call. It specifies the file to be uploaded and includes a form data part named \"page_break_comments\" set to \"on\", which instructs the API to include comments for page breaks in the Markdown output.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Request request =\n    new Request.Builder()\n        .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n        .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fmarkdown\")\n        .post(requestBody)\n        .build();\n\u003C\u002Fpre>\n\n\u003Cp>The request is built with the API key in the header, targeting the PDF to Markdown endpoint. It uses the POST method to send the multipart form data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">try {\n  OkHttpClient client = new OkHttpClient().newBuilder().build();\n  Response response = client.newCall(request).execute();\n  System.out.println(\"Result code \" + response.code());\n  if (response.body() != null) {\n    System.out.println(prettyJson(response.body().string()));\n  }\n} catch (IOException e) {\n  throw new RuntimeException(e);\n}\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the OkHttp client executes the request, and the response is printed in a formatted JSON string. If an IOException occurs, it is caught and thrown as a RuntimeException.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use Java to call the pdfRest PDF to Markdown API, converting PDF files into Markdown format. This process can be integrated into larger Java applications, enabling automated document conversion workflows.\u003C\u002Fp>\n\n\u003Cp>To explore more, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed documentation, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example demonstrates a multipart API call. For code samples using JSON payloads, visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FMarkdown.java\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-07-10T22:03:33.000+00:00","Learn how to convert PDF content to structured Markdown output with Java using pdfRest API Toolkit.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-java-code\u002F#article\",\n      \"headline\": \"How to Convert PDF to Markdown with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-java-code\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-java-code\u002F\",\n      \"datePublished\": \"2025-07-10T22:03:33.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:13.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert PDF content to structured Markdown output with Java using pdfRest API Toolkit.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Markdown API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-markdown\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fmarkdown API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-markdown\"\n        }\n      ],\n      \"keywords\": \"AI, Convert, Extract, Java, PDF to Markdown\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to Markdown with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-java-code\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6060,6061,6062,6063,6064,6065,6066],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1500,"name":1501,"slug":1502,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1279,"name":1280,"slug":1281,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-markdown-with-java-code\u002F","How to Convert PDF to Markdown with Java, Tutorial | pdfRest",{"id":6071,"uuid":6072,"title":6073,"slug":6074,"html":6075,"comment_id":6071,"feature_image":48,"featured":284,"visibility":1257,"created_at":6076,"updated_at":6036,"published_at":6076,"custom_excerpt":6077,"codeinjection_head":6078,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6079,"primary_tag":6087,"url":6088,"excerpt":6077,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6089,"meta_description":6077,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6870384d533c9f26b9439cbb","84b36f1a-6748-458e-9284-71c8639fe319","How to Convert PDF to Markdown with JavaScript in NodeJS","how-to-convert-pdf-to-markdown-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to Markdown with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-markdown\u002F'>PDF to Markdown API Tool\u003C\u002Fa> provides a seamless way to convert PDF documents into Markdown format using JavaScript. This tutorial will guide you through sending an API call to the PDF to Markdown endpoint using JavaScript. By following the steps outlined, you'll be able to automate the conversion process, enabling easy integration into your applications or workflows.\u003C\u002Fp>\n\n\u003Cp>Imagine a scenario where you have a repository of PDF documents that need to be converted into a format suitable for web publishing or collaborative editing. Markdown is a lightweight markup language that is widely used for creating formatted text using a plain-text editor. By converting PDFs into Markdown, you can easily integrate these documents into web pages or collaborative platforms like GitHub, making them accessible and editable by a broader audience.\u003C\u002Fp>\n\n\u003Ch2>PDF to Markdown with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to generate markdown from a PDF document.\nvar axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\ndata.append(\"page_break_comments\", \"on\");\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: \"post\",\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: \"https:\u002F\u002Fapi.pdfrest.com\u002Fmarkdown\",\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", \u002F\u002F Replace with your API key\n    ...data.getHeaders(), \u002F\u002F set headers for the request\n  },\n  data: data, \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error);\n  });\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fmarkdown.js\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary modules: \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests, \u003Ccode>form-data\u003C\u002Fcode> for handling form submissions, and \u003Ccode>fs\u003C\u002Fcode> for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\ndata.append(\"page_break_comments\", \"on\");\n\u003C\u002Fpre>\n\n\u003Cp>Here, a new \u003Ccode>FormData\u003C\u002Fcode> instance is created to manage the data being sent to the API. The PDF file is appended using \u003Ccode>fs.createReadStream()\u003C\u002Fcode>, which reads the file from the specified path. The \u003Ccode>page_break_comments\u003C\u002Fcode> parameter is set to \"on\", which means that comments indicating page breaks will be included in the Markdown output.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: \"post\",\n  maxBodyLength: Infinity,\n  url: \"https:\u002F\u002Fapi.pdfrest.com\u002Fmarkdown\",\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    ...data.getHeaders(),\n  },\n  data: data,\n};\n\u003C\u002Fpre>\n\n\u003Cp>The configuration for the \u003Ccode>axios\u003C\u002Fcode> request is defined here. The request method is set to \"post\", and the URL is the endpoint for the PDF to Markdown API. The \u003Ccode>maxBodyLength\u003C\u002Fcode> is set to \u003Ccode>Infinity\u003C\u002Fcode> to accommodate large files. The headers include the API key, which must be replaced with your actual key, and headers from the \u003Ccode>FormData\u003C\u002Fcode> instance.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error);\n  });\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>axios\u003C\u002Fcode> request is executed, and the response is handled. If successful, the response data is logged to the console. If an error occurs, it is caught and logged.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to convert a PDF document to Markdown using JavaScript and the pdfRest API. This process allows you to automate and integrate document conversions into your applications. To explore more, try out all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on each API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fmarkdown.js\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-07-10T22:01:49.000+00:00","Learn how to use pdfRest API Toolkit with JavaScript to convert PDF content to structured Markdown output.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert PDF to Markdown with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2025-07-10T22:01:49.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:13.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest API Toolkit with JavaScript to convert PDF content to structured Markdown output.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Markdown API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-markdown\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fmarkdown API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-markdown\"\n        }\n      ],\n      \"keywords\": \"AI, Convert, Extract, JavaScript, PDF to Markdown\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to Markdown with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6080,6081,6082,6083,6084,6085,6086],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1500,"name":1501,"slug":1502,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1279,"name":1280,"slug":1281,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-markdown-with-javascript-in-nodejs\u002F","How to Convert PDF to Markdown with JavaScript in NodeJS, Tutorial | pdfRest",{"id":6091,"uuid":6092,"title":6093,"slug":6094,"html":6095,"comment_id":6091,"feature_image":48,"featured":284,"visibility":1257,"created_at":6096,"updated_at":6097,"published_at":6096,"custom_excerpt":6098,"codeinjection_head":6099,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6100,"primary_tag":6108,"url":6109,"excerpt":6098,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6110,"meta_description":6098,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"687037bc533c9f26b9439ca7","6f7eaa58-1435-481d-b08d-f263209013e5","How to Convert PDF to Markdown with PHP","how-to-convert-pdf-to-markdown-with-php-code","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to Markdown with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-markdown\u002F'>PDF to Markdown API Tool\u003C\u002Fa> is a powerful service that allows developers to convert PDF documents into Markdown format. This tutorial will guide you through the process of sending an API call to the PDF to Markdown endpoint using PHP, leveraging the capabilities of the Guzzle HTTP client to handle the request and response.\u003C\u002Fp>\n\n\u003Cp>A user might need to convert PDF documents to Markdown to facilitate easier editing and integration into web content management systems. For instance, a content manager might receive reports in PDF format that need to be published on a website. By converting these PDFs to Markdown, the content can be easily edited and formatted within the website's CMS, streamlining the publishing process.\u003C\u002Fp>\n\n\u003Ch2>PDF to Markdown with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">\nrequire 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\n$headers = [\n  'Api-Key' =--> 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile', \u002F\u002F Set the filename for the file to be processed, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => 'application\u002Fpdf' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'page_break_comments', \u002F\u002F Specify the field name for the page_break_comments option.\n      'contents' => 'on' \u002F\u002F Set the value for the page_break_comments option (in this case, 'on').\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fmarkdown', $headers); \u002F\u002F Create a new HTTP POST request with the updated \u002Fmarkdown endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the generated markdown from the document.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fmarkdown.php\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by requiring the Composer autoload file, which loads the necessary classes for the Guzzle HTTP client:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">require 'vendor\u002Fautoload.php';\n\u003C\u002Fpre>\n\n\u003Cp>Next, the Guzzle HTTP client, PSR-7 Request, and Utils classes are imported to handle the HTTP request and file operations:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">use GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\u003C\u002Fpre>\n\n\u003Cp>A new instance of the Guzzle HTTP client is created:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$client = new Client();\n\u003C\u002Fpre>\n\n\u003Cp>The headers array is defined to include the API key for authentication:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The options array is set up with a multipart payload. The first part contains the file to be converted, specifying the file's name, contents, filename, and content type:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => 'application\u002Fpdf'\n      ]\n    ],\n    [\n      'name' => 'page_break_comments',\n      'contents' => 'on'\n    ]\n  ]\n];\n\u003C\u002Fpre>\n\n\u003Cp>A new HTTP POST request is created with the endpoint URL and headers:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fmarkdown', $headers);\n\u003C\u002Fpre>\n\n\u003Cp>The asynchronous request is sent, and the response is awaited:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$res = $client->sendAsync($request, $options)->wait();\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the response body, which contains the converted Markdown, is output:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">echo $res->getBody();\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use PHP to send an API request to the pdfRest PDF to Markdown endpoint, converting a PDF document into Markdown format. This process can be particularly useful for integrating PDF content into web platforms.\u003C\u002Fp>\n\n\u003Cp>To explore more features and tools offered by pdfRest, you can try all the API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on each API endpoint, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note that this example demonstrates a multipart API call. For examples using JSON payloads, visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fmarkdown.php\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-07-10T21:59:24.000+00:00","2026-09-02T18:27:52.000+00:00","Learn how to use pdfRest API Toolkit to convert PDF content to structured Markdown output with PHP.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-php-code\u002F#article\",\n      \"headline\": \"How to Convert PDF to Markdown with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-php-code\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-php-code\u002F\",\n      \"datePublished\": \"2025-07-10T21:59:24.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:13.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest API Toolkit to convert PDF content to structured Markdown output with PHP.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Markdown API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-markdown\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fmarkdown API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-markdown\"\n        }\n      ],\n      \"keywords\": \"AI, Convert, Extract, PDF to Markdown, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to Markdown with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-php-code\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6101,6102,6103,6104,6105,6106,6107],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1500,"name":1501,"slug":1502,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1279,"name":1280,"slug":1281,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-markdown-with-php-code\u002F","How to Convert PDF to Markdown with PHP, Tutorial | pdfRest",{"id":6112,"uuid":6113,"title":6114,"slug":6115,"html":6116,"comment_id":6112,"feature_image":48,"featured":284,"visibility":1257,"created_at":6117,"updated_at":6097,"published_at":6117,"custom_excerpt":6118,"codeinjection_head":6119,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6120,"primary_tag":6128,"url":6129,"excerpt":6118,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6130,"meta_description":6118,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6870370d533c9f26b9439c9d","fd075cf2-3c17-43de-88d2-8c62b54d6ec3","How to Convert PDF to Markdown with Python","how-to-convert-pdf-to-markdown-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to Markdown with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-markdown\u002F'>PDF to Markdown API Tool\u003C\u002Fa> is a powerful resource for developers who need to convert PDF documents into Markdown format programmatically. This tutorial will guide you through the process of sending an API call to the PDF to Markdown endpoint using Python, allowing you to automate the conversion of PDF files into a more editable and web-friendly format.\u003C\u002Fp>\n\n\u003Cp>A user might need to convert a PDF document to Markdown for easier editing and integration into web content management systems. For instance, a technical writer could use this tool to convert PDF documentation into Markdown to be hosted on a website or a wiki, ensuring that the content remains accessible and easy to update.\u003C\u002Fp>\n\n\u003Ch2>PDF to Markdown with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nmarkdown_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fmarkdown'\n\n# The \u002Fmarkdown endpoint can take a single PDF file or id as input.\n# This sample demonstrates converting the document to markdown and returning it as JSON.\nmp_encoder_markdown = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'page_break_comments': 'on',\n    }\n)\n\n# Let's set the headers that the markdown endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_markdown.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to markdown endpoint...\")\nresponse = requests.post(markdown_endpoint_url, data=mp_encoder_markdown, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent=2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fmarkdown.py\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary libraries: \u003Ccode>requests_toolbelt\u003C\u002Fcode> for handling multipart form data, \u003Ccode>requests\u003C\u002Fcode> for making HTTP requests, and \u003Ccode>json\u003C\u002Fcode> for handling JSON data. The \u003Ccode>markdown_endpoint_url\u003C\u002Fcode> variable stores the API endpoint URL.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_markdown = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'page_break_comments': 'on',\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>This snippet creates a \u003Ccode>MultipartEncoder\u003C\u002Fcode> object to handle the multipart form data. The \u003Ccode>fields\u003C\u002Fcode> dictionary includes the PDF file to be converted and the \u003Ccode>page_break_comments\u003C\u002Fcode> parameter, which is set to 'on' to include comments at page breaks in the Markdown output.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_markdown.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>headers\u003C\u002Fcode> dictionary specifies the request headers. The \u003Ccode>'Accept'\u003C\u002Fcode> header indicates that the client expects a JSON response. The \u003Ccode>'Content-Type'\u003C\u002Fcode> is automatically set to \u003Ccode>'multipart\u002Fform-data'\u003C\u002Fcode> by the \u003Ccode>MultipartEncoder\u003C\u002Fcode>. The \u003Ccode>'Api-Key'\u003C\u002Fcode> is a placeholder for your actual API key, which is required for authentication.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(markdown_endpoint_url, data=mp_encoder_markdown, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This line sends a POST request to the markdown endpoint with the specified data and headers. If the request is successful, the response will contain the converted Markdown data in JSON format.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use Python to send an API call to the pdfRest PDF to Markdown endpoint, converting a PDF document into Markdown format. This example demonstrates a multipart API call, which is useful for handling file uploads.\u003C\u002Fp>\n\n\u003Cp>To explore more, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further details, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fmarkdown.py\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-07-10T21:56:29.000+00:00","Learn how to convert PDF content to structured Markdown output using pdfRest API Toolkit with Python.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-python\u002F#article\",\n      \"headline\": \"How to Convert PDF to Markdown with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-python\u002F\",\n      \"datePublished\": \"2025-07-10T21:56:29.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:14.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert PDF content to structured Markdown output using pdfRest API Toolkit with Python.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Markdown API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-markdown\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fmarkdown API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-markdown\"\n        }\n      ],\n      \"keywords\": \"AI, Convert, Extract, PDF to Markdown, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to Markdown with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-markdown-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6121,6122,6123,6124,6125,6126,6127],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1500,"name":1501,"slug":1502,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1279,"name":1280,"slug":1281,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-markdown-with-python\u002F","How to Convert PDF to Markdown with Python, Tutorial | pdfRest",{"id":6132,"uuid":6133,"title":6134,"slug":6135,"html":6136,"comment_id":6132,"feature_image":48,"featured":284,"visibility":1257,"created_at":6137,"updated_at":6138,"published_at":6137,"custom_excerpt":6139,"codeinjection_head":6140,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6141,"primary_tag":6147,"url":6148,"excerpt":6139,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6149,"meta_description":6139,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ce93a3533c9f26b9436485","0ac132cc-91af-47d2-9a36-f54c4aa75b6b","How to Convert PDF to PDF\u002FA in .NET with C#","how-to-convert-pdf-to-pdf-a-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Convert to PDF\u002FA with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfa\u002F'>Convert to PDF\u002FA API Tool\u003C\u002Fa> is a cloud service that allows users to convert PDF documents to the PDF\u002FA format, which is an ISO-standardized version of the PDF specialized for the digital preservation of electronic documents. This tutorial will guide you through the process of sending an API call to Convert to PDF\u002FA using C#.\u003C\u002Fp>\n\n\u003Cp>One real-world example of why a user might use Convert to PDF\u002FA is to ensure that important documents, such as legal contracts or archival records, are preserved in a format that maintains their visual appearance over time, even as software and technology evolve. PDF\u002FA helps to ensure that documents remain readable and accessible for the long term.\u003C\u002Fp>\n\n\u003Ch2>Convert to PDF\u002FA with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdfa\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"PDF\u002FA-3u\"));\n        multipartContent.Add(byteArrayOption, \"output_type\");\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdfa.cs\">pdf-rest-api-samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code example above demonstrates how to use C# to make an API call to the pdfRest Convert to PDF\u002FA endpoint. Let's break down the key parts of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") };\n\u003C\u002Fpre>\n\n\u003Cp>This line initializes a new instance of the HttpClient class and sets its BaseAddress to the pdfRest API base URL.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>This line adds your API key to the request headers. Replace the placeholder with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n\u003C\u002Fpre>\n\n\u003Cp>This line creates a new instance of MultipartFormDataContent, which allows you to send files and data in the same request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\u003C\u002Fpre>\n\n\u003Cp>These lines read the file to be converted, create a ByteArrayContent object with the file's binary data, and add it to the multipart content with the name \"file\". The file's content type is also set to \"application\u002Fpdf\".\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"PDF\u002FA-3u\"));\nmultipartContent.Add(byteArrayOption, \"output_type\");\n\u003C\u002Fpre>\n\n\u003Cp>This snippet specifies the output type for the conversion. In this case, \"PDF\u002FA-3u\" is chosen, but you can select another PDF\u002FA conformance level as needed.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\nvar apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>These lines send the request to the pdfRest API and read the response as a string.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following this tutorial, you've learned how to make a multipart API call to convert a PDF to the PDF\u002FA format using C#. This can be particularly useful for ensuring long-term preservation and accessibility of important documents.\u003C\u002Fp>\n\n\u003Cp>To explore more capabilities and try out all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further information and detailed documentation, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdfa.cs\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-15T22:43:47.000+00:00","2026-09-02T18:27:53.000+00:00","Learn how to use pdfRest Convert to PDF\u002FA API Tool to convert standard PDF to PDF\u002FA conformant files with C#.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert PDF to PDF\u002FA in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-02-15T22:43:47.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:46.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Convert to PDF\u002FA API Tool to convert standard PDF to PDF\u002FA conformant files with C#.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF\u002FA API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfa\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdfa API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-pdfa\"\n        }\n      ],\n      \"keywords\": \".NET, Archival, Convert to PDF\u002FA\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PDF\u002FA in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6142,6143,6144,6145,6146],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1706,"name":1707,"slug":1708,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1702,"name":1703,"slug":1704,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-pdf-a-in-net-with-c\u002F","How to Convert PDF to PDF\u002FA in .NET with C#, Tutorial | pdfRest",{"id":6151,"uuid":6152,"title":6153,"slug":6154,"html":6155,"comment_id":6151,"feature_image":48,"featured":284,"visibility":1257,"created_at":6156,"updated_at":6138,"published_at":6156,"custom_excerpt":6157,"codeinjection_head":6158,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6159,"primary_tag":6165,"url":6166,"excerpt":6157,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6167,"meta_description":6157,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65f09d20533c9f26b9436a30","d2dbe376-dd9c-4a2e-b0f2-d9aebfa4354f","How to Convert PDF to PDF\u002FA with cURL","how-to-convert-pdf-to-pdf-a-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Convert to PDF\u002FA with cURL?\u003C\u002Fh2>\n\n\u003Cp>pdfRest offers a \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfa\u002F'>Convert to PDF\u002FA API Tool\u003C\u002Fa> that enables users to convert documents into the PDF\u002FA format, which is an ISO-standardized version of the Portable Document Format (PDF) specialized for the digital preservation of electronic documents. This tutorial will guide you through the process of sending an API call to convert a document to PDF\u002FA using cURL, a powerful and versatile command-line tool used for transferring data with URLs.\u003C\u002Fp>\n\n\u003Cp>Converting to PDF\u002FA is crucial for industries and organizations that require long-term archival of electronic documents. For instance, legal departments, government agencies, and libraries often need to store documents in a format that will remain readable and unchanged for extended periods. By converting documents to PDF\u002FA, users ensure that their files are compliant with archival standards, preventing future compatibility issues and preserving the integrity of the document's content.\u003C\u002Fp>\n\n\u003Ch2>Convert to PDF\u002FA with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdfa\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\" \\\n  -F \"output_type=PDF\u002FA-1b\" \\\n  -F \"rasterize_if_errors_encountered=off\"\n\u003C\u002Fpre>\n\n\u003Cp>Reference to the code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdfa.sh\">pdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This cURL command is structured to send a POST request to the pdfRest API endpoint for converting files to PDF\u002FA. Let's break down the components of this command:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdfa\"\n\u003C\u002Fpre>\n\n\u003Cp>This specifies that we are making a POST request to the pdfRest Convert to PDF\u002FA API endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\n\u003C\u002Fpre>\n\n\u003Cp>This header tells the server that the client expects a response in JSON format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\n\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the data being sent in the request is in multipart form data format, which is suitable for file uploads.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>This header is where you include your unique API key provided by pdfRest to authenticate your request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\n\u003C\u002Fpre>\n\n\u003Cp>This form field specifies the file to be converted. The '@' symbol indicates that a file is attached, followed by the path to the file on your local system.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>This form field sets the prefix for the output file's name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output_type=PDF\u002FA-1b\"\n\u003C\u002Fpre>\n\n\u003Cp>This form field specifies the type of PDF\u002FA to which the document should be converted. In this case, PDF\u002FA-1b ensures that the document is visually preserved for long-term archiving.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"rasterize_if_errors_encountered=off\"\n\u003C\u002Fpre>\n\n\u003Cp>This form field tells the API whether to rasterize the pages if errors are encountered during the conversion process. Setting it to 'off' means that rasterization will not occur.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps outlined above, you have learned how to use cURL to make an API call to pdfRest's Convert to PDF\u002FA endpoint. This allows you to convert documents to a standardized format suitable for long-term archiving, ensuring their preservation and accessibility in the future.\u003C\u002Fp>\n\n\u003Cp>To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information about the API and its capabilities, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdfa.sh\">pdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-12T18:21:20.000+00:00","Learn how to use pdfRest Convert to PDF\u002FA API Tool with cURL to prepare documents for long term preservation","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-with-curl\u002F#article\",\n      \"headline\": \"How to Convert PDF to PDF\u002FA with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-with-curl\u002F\",\n      \"datePublished\": \"2024-03-12T18:21:20.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:39.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Convert to PDF\u002FA API Tool with cURL to prepare documents for long term preservation\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF\u002FA API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfa\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdfa API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-pdfa\"\n        }\n      ],\n      \"keywords\": \"Archival, Convert to PDF\u002FA, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PDF\u002FA with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6160,6161,6162,6163,6164],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1706,"name":1707,"slug":1708,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1702,"name":1703,"slug":1704,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-pdf-a-with-curl\u002F","How to Convert PDF to PDF\u002FA with cURL, Tutorial | pdfRest",{"id":6169,"uuid":6170,"title":6171,"slug":6172,"html":6173,"comment_id":6169,"feature_image":48,"featured":284,"visibility":1257,"created_at":5936,"updated_at":6174,"published_at":5816,"custom_excerpt":6175,"codeinjection_head":6176,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6177,"primary_tag":6183,"url":6184,"excerpt":6175,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6185,"meta_description":6175,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c5a533c9f26b943b4f7","1903fd11-15d6-4143-823a-1323f7522690","How to Convert PDF to PDF\u002FA with Java","how-to-convert-pdf-to-pdf-a-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This step-by-step tutorial explains how a Java application can convert PDF to PDF\u002FA through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfa\u002F\">Convert to PDF\u002FA API Tool\u003C\u002Fa>. The sample selects a PDF\u002FA conformance target with \u003Ccode>output_type\u003C\u002Fcode> and receives a newly converted PDF resource. After reviewing the example, you'll be ready to convert PDF to PDF\u002FA with your own input.\u003C\u002Fp>\n\n\u003Ch2>Why Convert PDF to PDF\u002FA with Java?\u003C\u002Fh2>\n\n\u003Cp>Records systems often require an archival profile before documents enter long-term retention. A Java workflow can create the PDF\u002FA version consistently instead of depending on desktop conversion steps.\u003C\u002Fp>\n\n\u003Cp>The request sends the source PDF to \u003Ccode>\u002Fpdfa\u003C\u002Fcode> and specifies the desired \u003Ccode>output_type\u003C\u002Fcode>. A successful conversion returns a new resource; applications should still validate that the selected profile matches their records policy.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class PDFA {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output_type\", \"PDF\u002FA-2u\")\n            .addFormDataPart(\"output\", \"pdfrest_pdfa\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdfa\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPDFA.java\">Java sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The sample brings together the HTTP client, environment-based API key loading, and JSON utilities used later in the example.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>The configuration block keeps a visible default path, accepts an override from the command line, and reads the API key through dotenv.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output_type\", \"PDF\u002FA-2u\")\n            .addFormDataPart(\"output\", \"pdfrest_pdfa\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdfa\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\u003C\u002Fpre>\n\n\u003Cp>The request sends the source PDF to \u003Ccode>\u002Fpdfa\u003C\u002Fcode> and specifies the desired \u003Ccode>output_type\u003C\u002Fcode>. A successful conversion returns a new resource; applications should still validate that the selected profile matches their records policy. The form-data setup packages fields and files together without hard-coding a \u003Ccode>Content-Type\u003C\u002Fcode> boundary.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdfa\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The client request reads the credential through dotenv and targets the endpoint shown in the source, with the EU hostname documented beside the default US value.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>The response check checks the server result before treating the body as output and exposes diagnostic JSON when the operation cannot be completed.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>The completed example gives you a practical Java starting point for learning how to convert PDF to PDF\u002FA. With that foundation, you can use PDF\u002FA conversion for records packages, regulated archives, and document-management retention workflows.\u003C\u002Fp>\n\n\u003Cp>As you apply the pattern to real documents, choose the conformance level from an actual records policy rather than selecting the newest profile by default. Validate the converted output as part of archival intake, and review documented error-handling options when source files contain features that cannot be represented directly.\u003C\u002Fp>\n\n\u003Cp>Before integrating this workflow, test representative documents with the Convert PDF to PDF\u002FA operation in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. Then use the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-pdfa\u002F\">Convert to PDF\u002FA API Tool documentation\u003C\u002Fa> to review every available parameter and response field.\u003C\u002Fp>\n\n\u003Cp>Note: The Convert PDF to PDF\u002FA example above uses multipart form data; to reuse a resource ID, follow the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPDFA.java\">JSON payload example\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-02T18:27:54.000+00:00","Convert PDF documents to a selected PDF\u002FA conformance level with Java.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-with-java\u002F#article\",\n      \"headline\": \"How to Convert PDF to PDF\u002FA with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:34.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:34.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert PDF documents to a selected PDF\u002FA conformance level with Java.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF\u002FA API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfa\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdfa API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-pdfa\"\n        }\n      ],\n      \"keywords\": \"Archival, Convert to PDF\u002FA, Java\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PDF\u002FA with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6178,6179,6180,6181,6182],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1706,"name":1707,"slug":1708,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1702,"name":1703,"slug":1704,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-pdf-a-with-java\u002F","Convert PDF to PDF\u002FA with Java | pdfRest",{"id":6187,"uuid":6188,"title":6189,"slug":6190,"html":6191,"comment_id":6187,"feature_image":48,"featured":284,"visibility":1257,"created_at":6192,"updated_at":6174,"published_at":6192,"custom_excerpt":6193,"codeinjection_head":6194,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6195,"primary_tag":6201,"url":6202,"excerpt":6193,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6203,"meta_description":6193,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ce9435533c9f26b943648f","6b6e79fe-30d8-46b1-9a51-006381491454","How to Convert PDF to PDF\u002FA with JavaScript in NodeJS","how-to-convert-pdf-to-pdf-a-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Convert to PDF\u002FA with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfa\u002F'>Convert to PDF\u002FA API Tool\u003C\u002Fa> allows users to convert documents to the PDF\u002FA format, which is an ISO-standardized version of PDF specialized for digital preservation of electronic documents. This tutorial will demonstrate how to send an API call to Convert to PDF\u002FA using JavaScript.\u003C\u002Fp>\n\u003Cp>A user might use Convert to PDF\u002FA to ensure long-term archiving of legal documents, where the PDF\u002FA format is often required for its ability to preserve the visual appearance over time.\u003C\u002Fp>\n\n\u003Ch2>Convert to PDF\u002FA with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to convert any of several formats to PDF\u002FA. \nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data object and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('output_type', 'PDF\u002FA-2b'); \ndata.append('rasterize_if_errors_encountered', 'off');\ndata.append('output', 'pdfrest_pdfa');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdfa', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Code source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdfa.js\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code above demonstrates how to use the pdfRest API to convert a document to PDF\u002FA format using JavaScript. Let's break down the code into its core components:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\u003C\u002Fpre>\n\n\u003Cp>This section imports the required modules: \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests, \u003Ccode>FormData\u003C\u002Fcode> for constructing form data payloads, and \u003Ccode>fs\u003C\u002Fcode> for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('output_type', 'PDF\u002FA-2b');\ndata.append('rasterize_if_errors_encountered', 'off');\ndata.append('output', 'pdfrest_pdfa');\n\u003C\u002Fpre>\n\n\u003Cp>Here, we create a new \u003Ccode>FormData\u003C\u002Fcode> object and append the file to be converted and API parameters. The \u003Ccode>output_type\u003C\u002Fcode> specifies the PDF\u002FA conformance level, and \u003Ccode>rasterize_if_errors_encountered\u003C\u002Fcode> determines the behavior if conversion errors are encountered.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdfa',\n  headers: {\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\n\u003C\u002Fpre>\n\n\u003Cp>This snippet sets up the configuration for the \u003Ccode>axios\u003C\u002Fcode> request, including the API endpoint URL, HTTP method, headers (including the API key), and the form data payload.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\u003C\u002Fpre>\n\n\u003Cp>The final part sends the request and handles the response or error. The response data is logged to the console in JSON format.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've learned how to use JavaScript to make an API call to pdfRest's Convert to PDF\u002FA endpoint. By following the steps outlined, you can convert documents to a format suitable for long-term archiving.\u003C\u002Fp>\n\n\u003Cp>Feel free to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for more details.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdfa.js\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-15T22:46:13.000+00:00","Learn how to convert standard PDF to PDF\u002FA conformant files using pdfRest Convert to PDF\u002FA API Tool with JavaScript.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert PDF to PDF\u002FA with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-02-15T22:46:13.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:46.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert standard PDF to PDF\u002FA conformant files using pdfRest Convert to PDF\u002FA API Tool with JavaScript.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF\u002FA API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfa\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdfa API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-pdfa\"\n        }\n      ],\n      \"keywords\": \"Archival, Convert to PDF\u002FA, JavaScript\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PDF\u002FA with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6196,6197,6198,6199,6200],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1706,"name":1707,"slug":1708,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1702,"name":1703,"slug":1704,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-pdf-a-with-javascript-in-nodejs\u002F","How to Convert PDF to PDF\u002FA with JavaScript in NodeJS, Tutorial | pdfRest",{"id":6205,"uuid":6206,"title":6207,"slug":6208,"html":6209,"comment_id":6205,"feature_image":48,"featured":284,"visibility":1257,"created_at":6210,"updated_at":6174,"published_at":6210,"custom_excerpt":6211,"codeinjection_head":6212,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6213,"primary_tag":6219,"url":6220,"excerpt":6211,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6221,"meta_description":6211,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ce9471533c9f26b9436499","fcbdb308-d8f1-48a6-b3a9-04159e64be9a","How to Convert PDF to PDF\u002FA with PHP","how-to-convert-pdf-to-pdf-a-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Convert to PDF\u002FA with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfa\u002F'>Convert to PDF\u002FA API Tool\u003C\u002Fa> allows users to convert documents to the PDF\u002FA format, which is an ISO-standardized version of the PDF specialized for the digital preservation of electronic documents. This API tool is particularly useful when you need to ensure that documents remain readable and unchanged over long periods, which is essential for archiving purposes.\u003C\u002Fp>\n\u003Cp>For example, government agencies, libraries, or businesses that need to store documents for several years would benefit from converting their files to PDF\u002FA to ensure compatibility and reliability in the future.\u003C\u002Fp>\n\n\u003Ch2>Convert to PDF\u002FA with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">\nrequire 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile', \u002F\u002F Set the filename for the file to be processed, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => '\u003CContent-type header>' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'output_type', \u002F\u002F Specify the field name for the output type.\n      'contents' => 'PDF\u002FA-2b' \u002F\u002F Set the value for the output type (in this case, 'PDF\u002FA-2b').\n    ],\n    [\n      'name' => 'output', \u002F\u002F Specify the field name for the output option.\n      'contents' => 'pdfrest_pdfa' \u002F\u002F Set the value for the output option (in this case, 'pdfrest_pdfa').\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdfa', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the processed PDF\u002FA content.\n\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source of the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdfa.php\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code provided is a PHP script that uses the Guzzle HTTP client to send an API request to convert a document to PDF\u002FA format using the pdfRest API.\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Ccode>require 'vendor\u002Fautoload.php';\u003C\u002Fcode> - This line includes the Composer autoload file to load the necessary classes for the Guzzle HTTP client.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>use GuzzleHttp\\Client;\u003C\u002Fcode> - This imports the Client class from the GuzzleHttp namespace for making HTTP requests.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>use GuzzleHttp\\Psr7\\Request;\u003C\u002Fcode> - This imports the Request class which represents an HTTP request.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>use GuzzleHttp\\Psr7\\Utils;\u003C\u002Fcode> - This imports utility methods for working with streams.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>$client = new Client();\u003C\u002Fcode> - This creates a new instance of the Guzzle HTTP client.\u003C\u002Fli>\n  \u003Cli>The \u003Ccode>$headers\u003C\u002Fcode> array includes the 'Api-Key' needed for authentication with the pdfRest API.\u003C\u002Fli>\n  \u003Cli>The \u003Ccode>$options\u003C\u002Fcode> array is configured for a multipart request, which includes the file to be converted, the desired output type ('PDF\u002FA-2b'), and the output option.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdfa', $headers);\u003C\u002Fcode> - This creates a new HTTP POST request with the specified URL and headers.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>$res = $client->sendAsync($request, $options)->wait();\u003C\u002Fcode> - This sends the request asynchronously and waits for the response.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>echo $res->getBody();\u003C\u002Fcode> - This outputs the response body, which should contain the processed PDF\u002FA file content.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've learned how to use PHP to call the pdfRest Convert to PDF\u002FA API to convert documents to the PDF\u002FA format. By following the steps outlined, you can integrate this functionality into your PHP applications to ensure long-term preservation of your documents.\u003C\u002Fp>\n\n\u003Cp>For further exploration and to demo all of the pdfRest API Tools, you can visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. Also find more information in the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdfa.php\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-15T22:47:13.000+00:00","Learn how to convert standard PDF files to PDF\u002FA conformant files using pdfRest Convert to PDF\u002FA API Tool with PHP","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-with-php\u002F#article\",\n      \"headline\": \"How to Convert PDF to PDF\u002FA with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-with-php\u002F\",\n      \"datePublished\": \"2024-02-15T22:47:13.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:46.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert standard PDF files to PDF\u002FA conformant files using pdfRest Convert to PDF\u002FA API Tool with PHP\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF\u002FA API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfa\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdfa API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-pdfa\"\n        }\n      ],\n      \"keywords\": \"Archival, Convert to PDF\u002FA, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PDF\u002FA with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-a-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6214,6215,6216,6217,6218],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1706,"name":1707,"slug":1708,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1702,"name":1703,"slug":1704,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-pdf-a-with-php\u002F","How to Convert PDF to PDF\u002FA with PHP, Tutorial | pdfRest",{"id":6223,"uuid":6224,"title":6225,"slug":6226,"html":6227,"comment_id":6228,"feature_image":48,"featured":284,"visibility":1257,"created_at":6229,"updated_at":6230,"published_at":6229,"custom_excerpt":6231,"codeinjection_head":6232,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6233,"primary_tag":6239,"url":6240,"excerpt":6231,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6241,"meta_description":6231,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1354","7a69990a-a705-46eb-88dd-644b83132dcf","How to Convert PDF to PDF\u002FA with Python","how-to-convert-pdf-to-pdfa-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Convert to PDF\u002FA with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfa\u002F'>Convert to PDF\u002FA API Tool\u003C\u002Fa> is a powerful resource that allows users to convert PDF files into the PDF\u002FA format, which is an ISO-standardized version of the PDF specialized for digital preservation of electronic documents. This tutorial will guide you through the process of sending an API call to Convert to PDF\u002FA using Python.\u003C\u002Fp>\n\u003Cp>This can be particularly useful for archiving documents in a way that preserves their visual appearance over time, ensuring that they can be reliably accessed and rendered in the future.\u003C\u002Fp>\n\n\u003Ch2>Python Code Sample for PDF\u002FA\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\npdfa_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdfa'\n\n# The \u002Fpdfa endpoint can take a single PDF file or id as input.\nmp_encoder_pdfa = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output_type': 'PDF\u002FA-1b',\n        'rasterize_if_errors_encountered': 'on',\n        'output' : 'example_pdfa_out',\n    }\n)\n\n# Let's set the headers that the pdfa endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdfa.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to pdfa endpoint...\")\nresponse = requests.post(pdfa_endpoint_url, data=mp_encoder_pdfa, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdfa.py\">pdf-rest-api-samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Python\u003C\u002Fh2>\n\n\u003Cp>The provided code block demonstrates how to make a multipart\u002Fform-data POST request to the pdfRest API to convert a PDF to PDF\u002FA format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\u003C\u002Fpre>\n\n\u003Cp>This imports the necessary modules. \u003Ccode>MultipartEncoder\u003C\u002Fcode> from \u003Ccode>requests_toolbelt\u003C\u002Fcode> is used to encode the multipart form data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">pdfa_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdfa'\u003C\u002Fpre>\n\n\u003Cp>This sets the API endpoint URL for the PDF\u002FA conversion.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_pdfa = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output_type': 'PDF\u002FA-1b',\n        'rasterize_if_errors_encountered': 'on',\n        'output' : 'example_pdfa_out',\n    }\n)\u003C\u002Fpre>\n\n\u003Cp>Here we define the payload for the POST request. The fields include:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Ccode>'file'\u003C\u002Fcode>: The PDF file to convert. Replace \u003Ccode>'\u002Fpath\u002Fto\u002Ffile'\u003C\u002Fcode> with the actual file path.\u003C\u002Fli>\n\u003Cli>\u003Ccode>'output_type'\u003C\u002Fcode>: The type of PDF\u002FA to convert to (e.g., PDF\u002FA-1b).\u003C\u002Fli>\n\u003Cli>\u003Ccode>'rasterize_if_errors_encountered'\u003C\u002Fcode>: If set to 'on', the service will rasterize the PDF if it encounters errors during conversion.\u003C\u002Fli>\n\u003Cli>\u003Ccode>'output'\u003C\u002Fcode>: The desired name for the output file.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdfa.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\u003C\u002Fpre>\n\n\u003Cp>These are the headers for the request. Replace \u003Ccode>'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\u003C\u002Fcode> with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(pdfa_endpoint_url, data=mp_encoder_pdfa, headers=headers)\u003C\u002Fpre>\n\n\u003Cp>This line sends the POST request with the encoded data and headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\u003C\u002Fpre>\n\n\u003Cp>If the request is successful, the response is printed in a formatted JSON structure. If not, the error text is printed.\u003C\u002Fp>\n\n\u003Ch2>Beyond this Tutorial\u003C\u002Fh2>\n\n\u003Cp>We have now successfully made an API call to the pdfRest Convert to PDF\u002FA endpoint using Python. This allows us to convert PDF documents to the archival PDF\u002FA format programmatically. You can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for more details.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at our \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdfa.py\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","658215f72d4014c9499b39f8","2023-12-19T22:15:19.000+00:00","2026-09-02T18:27:55.000+00:00","Learn how to make a document PDF\u002FA compliant using Python to call the Convert to PDF\u002FA API Tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfa-with-python\u002F#article\",\n      \"headline\": \"How to Convert PDF to PDF\u002FA with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfa-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfa-with-python\u002F\",\n      \"datePublished\": \"2023-12-19T22:15:19.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:59.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to make a document PDF\u002FA compliant using Python to call the Convert to PDF\u002FA API Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF\u002FA API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfa\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdfa API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-pdfa\"\n        }\n      ],\n      \"keywords\": \"Archival, Convert to PDF\u002FA, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PDF\u002FA with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfa-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6234,6235,6236,6237,6238],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1706,"name":1707,"slug":1708,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1702,"name":1703,"slug":1704,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-pdfa-with-python\u002F","How to Convert PDF to PDF\u002FA Format with Python, Tutorial | pdfRest",{"id":6243,"uuid":6244,"title":6245,"slug":6246,"html":6247,"comment_id":6243,"feature_image":48,"featured":284,"visibility":1257,"created_at":6248,"updated_at":6230,"published_at":6248,"custom_excerpt":6249,"codeinjection_head":6250,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6251,"primary_tag":6256,"url":6257,"excerpt":6249,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6258,"meta_description":6249,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65d909f5533c9f26b94365c4","eb86af33-aaf9-4e0e-86b8-569fa54047ff","How to Convert PDF to PDF\u002FX in Java","how-to-convert-pdf-to-pdf-x-in-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Convert to PDF\u002FX with Java?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfx\u002F'>Convert to PDF\u002FX API Tool\u003C\u002Fa> is a powerful resource for developers who need to ensure their PDF documents meet the rigorous standards of the PDF\u002FX format, which is a subset of the PDF specification designed for the exchange of print-ready PDF files. This tutorial will guide you through the process of using Java to send an API call to the Convert to PDF\u002FX endpoint provided by pdfRest, enabling you to automate the conversion of standard PDF files to the PDF\u002FX format for reliable printing and publishing.\u003C\u002Fp>\n\n\u003Cp>In a business scenario, for example, a printing company may need to convert a batch of customer PDFs to the PDF\u002FX-1a standard to ensure compatibility with their printing equipment and to maintain color fidelity. By using the Convert to PDF\u002FX API, the company can automate this process, reducing manual effort and the potential for errors, thus streamlining their workflow and improving customer satisfaction.\u003C\u002Fp>\n\n\u003Ch2>Convert to PDF\u002FX with Java Code Example\u003C\u002Fh2>\n\n\u003Cp>The following code is an example of how to call the pdfRest Convert to PDF\u002FX API using Java:\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class PDFX {\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output_type\", \"PDF\u002FX-4\")\n            .addFormDataPart(\"output\", \"pdfrest_pdfx\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fpdfx\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>The source code for this example can be found on GitHub at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPDFX.java\">pdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided Java code makes an API call to the pdfRest Convert to PDF\u002FX endpoint. Let's break down the key parts of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">\u003Ccode>final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\u003C\u002Fcode>\u003C\u002Fpre>\n\n\u003Cp>This line initializes the Dotenv library, which is used to load environment variables from a .env file. This allows you to keep your API key secure and not hard-coded into the program.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">\u003Ccode>final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n\u003C\u002Fcode>\u003C\u002Fpre>\n\n\u003Cp>This snippet creates a request body for the file that needs to be compressed. The file is treated as 'application\u002Fpdf' media type.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">\u003Ccode>RequestBody requestBody =\n    new MultipartBody.Builder()\n        .setType(MultipartBody.FORM)\n        .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n        .addFormDataPart(\"output_type\", \"PDF\u002FX-4\")\n        .addFormDataPart(\"output\", \"pdfrest_pdfx\")\n        .build();\n\u003C\u002Fcode>\u003C\u002Fpre>\n\n\u003Cp>Here, a multipart request body is built with the PDF file, the desired PDF\u002FX output type, and the output name for the converted file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">\u003Ccode>Request request =\n    new Request.Builder()\n        .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n        .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fcompressed-pdf\")\n        .post(requestBody)\n        .build();\n\u003C\u002Fcode>\u003C\u002Fpre>\n\n\u003Cp>The request is constructed with the API key (retrieved from environment variables), the endpoint URL, and the previously created request body.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Response response = client.newCall(request).execute();\u003C\u002Fpre>\n\n\u003Cp>This sends a request to the pdfRest API endpoint.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps in this tutorial, you have learned how to use Java to make an API call to the pdfRest Convert to PDF\u002FX endpoint. This capability can be integrated into your applications to automate the process of converting PDFs to the PDF\u002FX standard, which is essential for printing and publishing workflows.\u003C\u002Fp>\n\n\u003Cp>To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For a comprehensive guide to the API, including endpoints, parameters, and examples, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. For code samples using JSON payloads, you can find them at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPdfx.java\">pdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-23T21:11:17.000+00:00","Learn how to convert PDF documents to PDF\u002FX in Java using the Convert to PDF\u002FX API Tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-x-in-java\u002F#article\",\n      \"headline\": \"How to Convert PDF to PDF\u002FX in Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-x-in-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-x-in-java\u002F\",\n      \"datePublished\": \"2024-02-23T21:11:17.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:46.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert PDF documents to PDF\u002FX in Java using the Convert to PDF\u002FX API Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Compress PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcompress-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fcompressed-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcompress-pdf\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF\u002FX API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfx\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdfx API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-pdfx\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF\u002FX, Java\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PDF\u002FX in Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-x-in-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6252,6253,6254,6255],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2157,"name":2158,"slug":2159,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-pdf-x-in-java\u002F","How to Convert PDF to PDF\u002FX in Java, Tutorial | pdfRest",{"id":6260,"uuid":6261,"title":6262,"slug":6263,"html":6264,"comment_id":6265,"feature_image":48,"featured":284,"visibility":1257,"created_at":6266,"updated_at":6267,"published_at":6266,"custom_excerpt":6268,"codeinjection_head":6269,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6270,"primary_tag":6275,"url":6276,"excerpt":6268,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6277,"meta_description":6268,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1360","843888ff-4509-4fe0-8ba2-9aea91d79264","How to Convert PDF to PDF\u002FX with .NET C#","how-to-convert-pdf-to-pdfx-with-net-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert to PDF\u002FX with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfx\u002F'>Convert to PDF\u002FX API Tool\u003C\u002Fa> is a powerful resource for developers who need to ensure that their PDF files meet the PDF\u002FX standard, which is a subset of the PDF specification that is optimized for the reliable prepress document exchange. This tutorial will demonstrate how to send an API call to Convert to PDF\u002FX using C#. A real-world example of why a user might use Convert to PDF\u002FX is to prepare a document for professional printing, where color consistency and font embedding are crucial.\u003C\u002Fp>\n\n\u003Ch2>Convert to PDF\u002FX with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdfx\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"PDF\u002FX-3\"));\n        multipartContent.Add(byteArrayOption, \"output_type\");\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdfx.cs\">pdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the C# Code\u003C\u002Fh2>\n\n\u003Cp>The provided code snippet is a C# example of how to call the pdfRest API to convert a PDF file to the PDF\u002FX format. Let's break down the key parts of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>This line initializes a new instance of the \u003Ccode>HttpClient\u003C\u002Fcode> class and sets the base address to the pdfRest API endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>The API key is added to the request headers for authorization. Replace the placeholder with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name\");\n\u003C\u002Fpre>\n\n\u003Cp>These lines read the PDF file as a byte array, create a \u003Ccode>ByteArrayContent\u003C\u002Fcode> object with it, and add it to the \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> with the name \"file\". The \"file_name\" should be the name of the file you are uploading.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"PDF\u002FX-3\"));\nmultipartContent.Add(byteArrayOption, \"output_type\");\n\u003C\u002Fpre>\n\n\u003Cp>This specifies the desired output type for the conversion. In this case, \"PDF\u002FX-3\" is specified as the output type.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\n\u003C\u002Fpre>\n\n\u003Cp>This line sends the multipart\u002Fform-data request to the pdfRest API and waits for the response.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>Once the response is received, this line reads the content of the response asynchronously as a string.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've learned how to make a multipart\u002Fform-data API call to the pdfRest Convert to PDF\u002FX API using C#. This allows you to programmatically convert PDF files to the PDF\u002FX standard, which is essential for professional printing purposes. You are encouraged to demo all of the pdfRest API Tools in the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\u003C\u002Fa> and refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa> for more information.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdfx.cs\">pdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","658deeba2d4014c9499b3b7e","2023-12-28T21:55:06.000+00:00","2026-09-02T18:27:56.000+00:00","Learn how to ensure PDF documents are PDF\u002FX compliant with the Convert to PDF\u002FX API Tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfx-with-net-c\u002F#article\",\n      \"headline\": \"How to Convert PDF to PDF\u002FX with .NET C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfx-with-net-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfx-with-net-c\u002F\",\n      \"datePublished\": \"2023-12-28T21:55:06.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:58.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to ensure PDF documents are PDF\u002FX compliant with the Convert to PDF\u002FX API Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF\u002FX API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfx\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdfx API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-pdfx\"\n        }\n      ],\n      \"keywords\": \".NET, Convert to PDF\u002FX\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PDF\u002FX with .NET C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfx-with-net-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6271,6272,6273,6274],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2157,"name":2158,"slug":2159,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-pdfx-with-net-c\u002F","How to Use .NET to Convert to PDF\u002FX Compliance, Tutorial | pdfRest",{"id":6279,"uuid":6280,"title":6281,"slug":6282,"html":6283,"comment_id":6279,"feature_image":48,"featured":284,"visibility":1257,"created_at":6284,"updated_at":6267,"published_at":6284,"custom_excerpt":6285,"codeinjection_head":6286,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6287,"primary_tag":6293,"url":6294,"excerpt":6285,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6295,"meta_description":6285,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"672a761f533c9f26b9438b70","2573f340-dc0d-4915-9647-c47e3bb03280","How to Convert PDF to PDF\u002FX with cURL","how-to-convert-pdf-to-pdf-x-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert to PDF\u002FX with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfx\u002F'>Convert to PDF\u002FX API Tool\u003C\u002Fa> is a powerful solution for developers looking to convert documents into the PDF\u002FX standard, which is widely used for high-quality print production. This tutorial will guide you through the process of sending an API call to Convert to PDF\u002FX using cURL, a command-line tool for transferring data with URLs. By leveraging cURL, you can easily integrate this conversion functionality into your applications or workflows.\u003C\u002Fp>\n\n\u003Cp>A graphic designer might need to convert a PDF document to the PDF\u002FX format to ensure that it meets industry standards for printing. PDF\u002FX files are optimized for print production, ensuring that all necessary fonts and images are embedded and that colors are accurately represented. This process helps prevent printing errors and ensures the final product looks as intended.\u003C\u002Fp>\n\n\u003Ch2>Convert to PDF\u002FX with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdfx\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\" \\\n  -F \"output_type=PDF\u002FX-4\" \\\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdfx.sh\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided code is a cURL command that sends a POST request to the pdfRest API endpoint for converting documents to PDF\u002FX. Let's break down each part of the command:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdfx\"\u003C\u002Fpre>\n\n\u003Cp>This line specifies that a POST request is being made to the URL \u003Ccode>https:\u002F\u002Fapi.pdfrest.com\u002Fpdfx\u003C\u002Fcode>, which is the endpoint for the Convert to PDF\u002FX API tool.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the client expects the server's response to be in JSON format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>Content-Type\u003C\u002Fcode> header is set to \u003Ccode>multipart\u002Fform-data\u003C\u002Fcode>, which is necessary for uploading files in a POST request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\u003C\u002Fpre>\n\n\u003Cp>This header includes the API key, which is a unique identifier used to authenticate the request. Replace the placeholder with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>-F\u003C\u002Fcode> flag is used to specify form data. Here, it uploads the file to be converted. Replace \u003Ccode>\u002Fpath\u002Fto\u002Ffile\u003C\u002Fcode> with the actual path to your file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\u003C\u002Fpre>\n\n\u003Cp>This form field specifies the name of the output file. The converted PDF\u002FX file will be named \u003Ccode>example_out\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output_type=PDF\u002FX-4\"\u003C\u002Fpre>\n\n\u003Cp>This field indicates the desired output format. In this case, the document will be converted to the PDF\u002FX-4 standard.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use cURL to send an API request to the pdfRest Convert to PDF\u002FX endpoint. This allows you to convert documents to the PDF\u002FX format, which is essential for ensuring high-quality print production. To further explore the capabilities of pdfRest, you can try out all of their API tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>For more detailed information on the API and its various endpoints, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. This guide provides comprehensive documentation on how to use the pdfRest API effectively.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdfx.sh\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-05T19:46:39.000+00:00","Learn how to use pdfRest Convert to PDF\u002FX API Tool to convert standard PDF documents to PDF\u002FX format using cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-x-with-curl\u002F#article\",\n      \"headline\": \"How to Convert PDF to PDF\u002FX with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-x-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-x-with-curl\u002F\",\n      \"datePublished\": \"2024-11-05T19:46:39.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:23.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Convert to PDF\u002FX API Tool to convert standard PDF documents to PDF\u002FX format using cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF\u002FX API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfx\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdfx API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-pdfx\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF\u002FX, Print, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PDF\u002FX with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdf-x-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6288,6289,6290,6291,6292],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2157,"name":2158,"slug":2159,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2137,"name":2138,"slug":2139,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-pdf-x-with-curl\u002F","How to Convert PDF to PDF\u002FX with cURL, Tutorial | pdfRest",{"id":6297,"uuid":6298,"title":6299,"slug":6300,"html":6301,"comment_id":6302,"feature_image":48,"featured":284,"visibility":1257,"created_at":6303,"updated_at":6267,"published_at":6303,"custom_excerpt":6304,"codeinjection_head":6305,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6306,"primary_tag":6311,"url":6312,"excerpt":6304,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6313,"meta_description":6304,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1361","19efecbd-de47-49ac-8773-fa5c197f9ee9","How to Convert PDF to PDF\u002FX with JavaScript","how-to-convert-pdf-to-pdfx-with-javascript","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert to PDF\u002FX with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfx\u002F'>Convert to PDF\u002FX API Tool\u003C\u002Fa> allows developers to programmatically convert documents to the PDF\u002FX format, which is a subset of the PDF specification designed for prepress graphics exchange. This standardized format is used to ensure that files are ready for print production with the expectation that they will render the same way across different machines and printing presses.\u003C\u002Fp>\n\n\u003Cp>Using JavaScript to call this API can be particularly useful for web applications that need to automate the process of preparing documents for high-quality printing. For example, a graphic design platform might offer users the ability to convert their projects to PDF\u002FX before sending them off to a professional printer.\u003C\u002Fp>\n\n\u003Ch2>Convert to PDF\u002FX with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to convert any of several formats to PDF\u002FX. \nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data object and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('output_type', 'PDF\u002FX-4'); \ndata.append('output', 'pdfrest_pdfx');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdfx', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdfx.js\">pdf-rest-api-samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the JavaScript Code\u003C\u002Fh2>\n\n\u003Cp>The provided JavaScript code uses Axios for making HTTP requests and FormData to construct a multipart\u002Fform-data payload, which is required for file uploads. Here's a breakdown of the key components:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('output_type', 'PDF\u002FX-4');\ndata.append('output', 'pdfrest_pdfx');\n\u003C\u002Fpre>\n\n\u003Cp>This snippet creates a new FormData object and appends the file to be converted and additional parameters. The 'output_type' specifies the version of PDF\u002FX to which the document should be converted. The 'output' parameter is a custom name for the resulting file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  \u002F\u002F...\n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  \u002F\u002F...\n};\n\u003C\u002Fpre>\n\n\u003Cp>The 'headers' object includes the API key required for authentication and the headers from the FormData object. The API key should be replaced with your actual key obtained from pdfRest.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  \u002F\u002F Handle success\n})\n.catch(function (error) {\n  \u002F\u002F Handle error\n});\n\u003C\u002Fpre>\n\n\u003Cp>The Axios library sends the request with the specified configuration. The '.then' method handles a successful response, while '.catch' deals with any errors.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the above steps, we have successfully sent an API call to convert a document to PDF\u002FX using JavaScript. You can now explore and demo all of the pdfRest API Tools in the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\u003C\u002Fa> and refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa> for further information and additional capabilities.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdfx.js\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","658def162d4014c9499b3b88","2023-12-28T21:56:38.000+00:00","Learn how to Convert to PDF\u002FX using JavaScript to ensure your PDF documents meet compliance requirements.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfx-with-javascript\u002F#article\",\n      \"headline\": \"How to Convert PDF to PDF\u002FX with JavaScript\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfx-with-javascript\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfx-with-javascript\u002F\",\n      \"datePublished\": \"2023-12-28T21:56:38.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:58.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to Convert to PDF\u002FX using JavaScript to ensure your PDF documents meet compliance requirements.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF\u002FX API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfx\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdfx API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-pdfx\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF\u002FX, JavaScript\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PDF\u002FX with JavaScript\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfx-with-javascript\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6307,6308,6309,6310],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2157,"name":2158,"slug":2159,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-pdfx-with-javascript\u002F","How to Make a PDF\u002FX Complaint PDF with JavaScript, Tutorial | pdfRest",{"id":6315,"uuid":6316,"title":6317,"slug":6318,"html":6319,"comment_id":6320,"feature_image":48,"featured":284,"visibility":1257,"created_at":6321,"updated_at":6322,"published_at":6321,"custom_excerpt":6323,"codeinjection_head":6324,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6325,"primary_tag":6330,"url":6331,"excerpt":6323,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6332,"meta_description":6323,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b135f","7590fe71-293e-4720-9c70-280d22865e5d","How to Convert PDF to PDF\u002FX with PHP","how-to-convert-pdf-to-pdfx-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert to PDF\u002FX with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfx\u002F\">Convert to PDF\u002FX API Tool\u003C\u002Fa> is a powerful resource for converting documents to the PDF\u002FX format, which is a subset of the PDF specification intended for prepress graphics exchange. This API tool ensures that the PDF files conform to the standards required for high-quality printing and publishing.\u003C\u002Fp>\n\n\u003Cp>In this tutorial, we will demonstrate how to send an API call to Convert to PDF\u002FX with PHP, which is particularly useful for automating the conversion process in web applications or document management systems. For example, a printing service provider might use this API to ensure all incoming PDF documents are standardized to PDF\u002FX before proceeding with the printing process.\u003C\u002Fp>\n\n\u003Ch2>Convert to PDF\u002FX with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'output_type',\n      'contents' => 'PDF\u002FX-4'\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_pdfx'\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdfx', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source of the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdfx.php\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the PHP Code\u003C\u002Fh2>\n\n\u003Cp>The provided PHP code uses the Guzzle HTTP client to send a multipart\u002Fform-data POST request to the pdfRest API. Here's a breakdown of the key components:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>This sets the API key required for authentication with the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$options = [\n  'multipart' => [\n    \u002F\u002F ...multipart array...\n  ]\n];\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>$options\u003C\u002Fcode> array contains the multipart payload, which includes the file to convert and the conversion parameters:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Ccode>'name' => 'file'\u003C\u002Fcode>: The field name for the uploaded file.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r')\u003C\u002Fcode>: The file stream opened for reading.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>'filename' => '\u002Fpath\u002Fto\u002Ffile'\u003C\u002Fcode>: The path to the file to be converted.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>'Content-Type'\u003C\u002Fcode>: The MIME type of the file being uploaded.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>'name' => 'output_type'\u003C\u002Fcode>: The desired PDF\u002FX standard for the output file.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>'name' => 'output'\u003C\u002Fcode>: The output option to specify the naming convention for the processed file.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've learned how to use PHP to call the pdfRest Convert to PDF\u002FX API Tool. By sending a multipart\u002Fform-data POST request with the necessary parameters, we can convert documents to the PDF\u002FX format suitable for high-quality printing workflows. Users are encouraged to demo all of the pdfRest API Tools in the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\u003C\u002Fa> and refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa> for more information.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdfx.php\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","658dee522d4014c9499b3b74","2023-12-28T21:53:22.000+00:00","2026-09-10T20:19:14.000+00:00","Learn how to use PHP to call the Convert to PDF\u002FX API Tool from pdfRest and ensure your documents are compliant.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfx-with-php\u002F#article\",\n      \"headline\": \"How to Convert PDF to PDF\u002FX with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfx-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfx-with-php\u002F\",\n      \"datePublished\": \"2023-12-28T21:53:22.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:58.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use PHP to call the Convert to PDF\u002FX API Tool from pdfRest and ensure your documents are compliant.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF\u002FX API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfx\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdfx API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-pdfx\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF\u002FX, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PDF\u002FX with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfx-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6326,6327,6328,6329],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2157,"name":2158,"slug":2159,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-pdfx-with-php\u002F","How to make PDF Files PDF\u002FX Compliant with PHP, Tutorial | pdfRest",{"id":6334,"uuid":6335,"title":6336,"slug":6337,"html":6338,"comment_id":6339,"feature_image":48,"featured":284,"visibility":1257,"created_at":6340,"updated_at":6341,"published_at":6340,"custom_excerpt":6342,"codeinjection_head":6343,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6344,"primary_tag":6349,"url":6350,"excerpt":6342,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6351,"meta_description":6342,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b135e","df4cf304-7667-4678-a61d-b73c5243936b","How to Convert PDF to PDF\u002FX with Python","how-to-convert-pdf-to-pdfx-with-python-2","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert to PDF\u002FX with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfx\u002F'>Convert to PDF\u002FX API Tool\u003C\u002Fa> is a powerful resource for ensuring that PDF documents meet the industry standards for high-quality printing and publishing. By using this tool, you can convert your PDF files to the PDF\u002FX format, which is essential for color-accurate and reliable printing.\u003C\u002Fp>\n\n\u003Cp>This tutorial will show you how to send an API call to Convert to PDF\u002FX using Python. A real-world example of why a user might use Convert to PDF\u002FX is when a graphic designer needs to submit a print-ready file to a printing company, ensuring that the document adheres to the strict printing standards and color consistency required by the industry.\u003C\u002Fp>\n\n\u003Ch2>Convert to PDF\u002FX with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\npdfx_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdfx'\n\n# The \u002Fpdfx endpoint can take a single PDF file or id as input.\nmp_encoder_pdfx = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output_type': 'PDF\u002FX-4',\n        'output' : 'example_pdfx_out'\n    }\n)\n\n# Let's set the headers that the pdfx endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdfx.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to pdfx endpoint...\")\nresponse = requests.post(pdfx_endpoint_url, data=mp_encoder_pdfx, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>This code is sourced from the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdfx.py\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Python Code\u003C\u002Fh2>\n\n\u003Cp>The provided code snippet showcases how to interact with the pdfRest API to convert a PDF file to the PDF\u002FX standard using Python. Here's a breakdown of the key components:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\n\u003C\u002Fpre>\n\n\u003Cp>This imports the necessary modules. \u003Ccode>MultipartEncoder\u003C\u002Fcode> from \u003Ccode>requests_toolbelt\u003C\u002Fcode> is used for encoding multipart form data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_pdfx = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output_type': 'PDF\u002FX-4',\n        'output' : 'example_pdfx_out'\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>This creates a \u003Ccode>MultipartEncoder\u003C\u002Fcode> object with the fields needed for the API request. The fields include the PDF file to convert, the desired output type (PDF\u002FX-4), and the output name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdfx.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\n\u003C\u002Fpre>\n\n\u003Cp>These are the headers for the API request. The 'Content-Type' is set automatically by the encoder, and 'Api-Key' should be replaced with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(pdfx_endpoint_url, data=mp_encoder_pdfx, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This sends a POST request to the pdfRest API endpoint with the encoded data and headers.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've learned how to make a multipart API call to the pdfRest Convert to PDF\u002FX API using Python. This allows you to automate the process of converting PDFs to the PDF\u002FX standard, which is crucial for professional printing and publishing workflows. You can now explore and demo all of the pdfRest API Tools in the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\u003C\u002Fa> and refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa> for more details and options.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdfx.py\">https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdfx.py\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","658ded082d4014c9499b3b65","2023-12-28T21:47:52.000+00:00","2026-09-02T18:27:57.000+00:00","Learn how to use Python to ensure PDF documents are PDF\u002FX compliant with the Convert to PDF\u002FX API Tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfx-with-python-2\u002F#article\",\n      \"headline\": \"How to Convert PDF to PDF\u002FX with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfx-with-python-2\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfx-with-python-2\u002F\",\n      \"datePublished\": \"2023-12-28T21:47:52.000Z\",\n      \"dateModified\": \"2026-09-01T14:52:12.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use Python to ensure PDF documents are PDF\u002FX compliant with the Convert to PDF\u002FX API Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF\u002FX API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfx\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdfx API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-pdfx\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF\u002FX, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PDF\u002FX with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-pdfx-with-python-2\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6345,6346,6347,6348],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2157,"name":2158,"slug":2159,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-pdfx-with-python-2\u002F","How to Make a PDF\u002FX Compliant PDF with Python, Tutorial | pdfRest",{"id":6353,"uuid":6354,"title":6355,"slug":6356,"html":6357,"comment_id":6353,"feature_image":48,"featured":284,"visibility":1257,"created_at":6358,"updated_at":6359,"published_at":6358,"custom_excerpt":6360,"codeinjection_head":6361,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6362,"primary_tag":6370,"url":6371,"excerpt":6360,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6372,"meta_description":6360,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"667c5fac533c9f26b9437cdd","0ab60bee-907c-407d-aeab-feed145b76ce","How to Convert PDF to PNG in .NET with C#","how-to-convert-pdf-to-png-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to PNG with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest PDF to Images API Tool is a powerful resource for converting PDF documents into image formats such as PNG. This tutorial will guide you through the process of sending an API call to the PDF to Images endpoint using C#. By following this tutorial, you will learn how to use C# to interact with the pdfRest API and convert PDF files to images programmatically.\u003C\u002Fp>\n\n\u003Cp>Imagine you are developing a document management system that needs to display PDF content as images within a web application. By converting PDF pages to images, you can easily render them in any browser without relying on PDF viewers. This approach can also be useful for generating thumbnails for PDF files, which can enhance user experience by providing quick previews.\u003C\u002Fp>\n\n\u003Ch2>PDF to PNG with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"png\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpng.cs\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided code makes use of the \u003Ccode>HttpClient\u003C\u002Fcode> class to send an HTTP POST request to the pdfRest API. Let's break down the key parts of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>This line initializes an \u003Ccode>HttpClient\u003C\u002Fcode> instance with the base address set to the pdfRest API URL.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var request = new HttpRequestMessage(HttpMethod.Post, \"png\"))\n\u003C\u002Fpre>\n\n\u003Cp>Here, an \u003Ccode>HttpRequestMessage\u003C\u002Fcode> object is created for a POST request to the \"png\" endpoint, which is used for converting PDFs to PNG images.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>This line adds the API key to the request headers. Replace \u003Ccode>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\u003C\u002Fcode> with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n\u003C\u002Fpre>\n\n\u003Cp>The request is configured to accept a JSON response.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n\u003C\u002Fpre>\n\n\u003Cp>A \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> object is created to hold the file data to be sent in the request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\u003C\u002Fpre>\n\n\u003Cp>The PDF file is read into a byte array and added to the multipart content with the appropriate content type header.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Content = multipartContent;\nvar response = await httpClient.SendAsync(request);\n\u003C\u002Fpre>\n\n\u003Cp>The multipart content is set as the request content, and the request is sent asynchronously.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiResult = await response.Content.ReadAsStringAsync();\nConsole.WriteLine(\"API response received.\");\nConsole.WriteLine(apiResult);\n\u003C\u002Fpre>\n\n\u003Cp>The response is read as a string and printed to the console.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use C# to send an API call to the pdfRest PDF to Images endpoint and convert a PDF file to PNG images.\u003C\u002Fp>\n\n\u003Cp>To explore more functionalities of the pdfRest API, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on all available endpoints and parameters, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpng.cs\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-06-26T18:36:28.000+00:00","2026-09-02T18:27:58.000+00:00","Learn how to use pdfRest PDF to Images API Tool to convert PDFs to PNG images with C#","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert PDF to PNG in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-06-26T18:36:28.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:29.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest PDF to Images API Tool to convert PDFs to PNG images with C#\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpng API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\"\n        }\n      ],\n      \"keywords\": \".NET, Conversion, Convert, PDF to Images, PNG\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PNG in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6363,6364,6365,6366,6367,6368,6369],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1538,"name":1539,"slug":1540,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1546,"name":1547,"slug":1548,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-png-in-net-with-c\u002F","How to Convert PDF to PNG in .NET with C#, Tutorial | pdfRest",{"id":6374,"uuid":6375,"title":6376,"slug":6377,"html":6378,"comment_id":6374,"feature_image":48,"featured":284,"visibility":1257,"created_at":6379,"updated_at":6359,"published_at":6380,"custom_excerpt":6381,"codeinjection_head":6382,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6383,"primary_tag":6390,"url":6391,"excerpt":6381,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6392,"meta_description":6381,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"663158ee533c9f26b94375dc","3fd75c14-6d6d-4421-895e-a1a3575f0b26","How to Convert PDF to PNG with cURL","how-to-convert-pdf-to-png-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to PNG with cURL?\u003C\u002Fh2>\n\n\u003Cp>Empower your development workflows with the pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F'>PDF to Images API Tool\u003C\u002Fa>. This versatile tool simplifies the process of programmatically converting PDF documents into various image formats like JPEG, PNG, and TIFF. Whether you need to transform entire PDFs or extract specific pages, the API offers a smooth and efficient solution. This tutorial will guide you through utilizing cURL – a command-line tool for data transfer – to send an API call and leverage the power of pdfRest's image conversion capabilities.\u003C\u002Fp>\n\n\u003Cp>Transforming PDFs into images unlocks a range of valuable applications. Imagine a web app where users can preview a PDF's first page as a thumbnail before downloading. Or, a document management system that automatically converts uploaded PDFs to images for faster, reader-independent viewing. These are just a glimpse of the possibilities offered by the pdfRest PDF to Images API.\u003C\u002Fp>\n\n\u003Ch2>Convert PDF to PNG with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpng\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\" \\\n  -F \"pages=1-last\" \\\n  -F \"resolution=300\" \\\n  -F \"color_model=rgb\"\n\u003C\u002Fpre>\n\n\u003Cp>Reference to the code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpng.sh\">pdfRest API samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The above code block demonstrates how to use cURL to make a POST request to the pdfRest API's PDF to Images endpoint. Here's what each part of the command does:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpng\"\u003C\u002Fpre>\n\n\u003Cp>This specifies that you are making a POST request to the endpoint that converts PDFs to PNG images.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\u003C\u002Fpre>\n\n\u003Cp>This header tells the server that the client expects a response in JSON format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the data being sent in the request is multipart form data, which is necessary for file uploads.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\u003C\u002Fpre>\n\n\u003Cp>You must replace the placeholder with your actual API key to authenticate the request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\u003C\u002Fpre>\n\n\u003Cp>This form field is where you specify the file path to the PDF you want to convert.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\u003C\u002Fpre>\n\n\u003Cp>Here you define the base name for the output files. The API will add a page number and file extension to this base name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"pages=1-last\"\u003C\u002Fpre>\n\n\u003Cp>This field specifies the range of pages to convert. \"1-last\" means all pages in the PDF will be converted.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"resolution=300\"\u003C\u002Fpre>\n\n\u003Cp>The resolution field sets the DPI (dots per inch) for the output images, which affects their quality and size.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"color_model=rgb\"\u003C\u002Fpre>\n\n\u003Cp>This option sets the color model for the output images. \"rgb\" is suitable for full-color images.\u003C\u002Fp>\n\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you've learned how to use cURL to call the pdfRest PDF to Images API to convert a PDF into PNG files. By following the steps outlined above, you can integrate this functionality into your own applications or workflows. To explore more possibilities and try out all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For a deeper understanding of the API's capabilities and additional options you can use in your requests, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpng.sh\">pdfRest API samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-04-30T20:47:42.000+00:00","2024-04-30T21:00:13.000+00:00","Learn how to convert PDF pages into PNGs with pdfRest PDF to Images API Tool using cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-curl\u002F#article\",\n      \"headline\": \"How to Convert PDF to PNG with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-curl\u002F\",\n      \"datePublished\": \"2024-04-30T21:00:13.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:31.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert PDF pages into PNGs with pdfRest PDF to Images API Tool using cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpng API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\"\n        }\n      ],\n      \"keywords\": \"PDF to Images, PNG, Thumbnail, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PNG with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6384,6385,6386,6387,6388,6389],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1538,"name":1539,"slug":1540,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1546,"name":1547,"slug":1548,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1562,"name":1563,"slug":1564,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-png-with-curl\u002F","How to Convert PDF to PNG with cURL, Tutorial | pdfRest",{"id":6394,"uuid":6395,"title":6396,"slug":6397,"html":6398,"comment_id":6394,"feature_image":48,"featured":284,"visibility":1257,"created_at":5936,"updated_at":6359,"published_at":6399,"custom_excerpt":6400,"codeinjection_head":6401,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6402,"primary_tag":6410,"url":6411,"excerpt":6400,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6412,"meta_description":6400,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c5a533c9f26b943b501","36dcf8a4-4c12-4155-8985-d67432001e92","How to Convert PDF to PNG with Java","how-to-convert-pdf-to-png-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>By the end of this tutorial, you'll know how to convert PDF to PNG with Java and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\">PDF to Images API Tool\u003C\u002Fa>. The Java call sends the PDF with page and raster settings that control which PNG images the service creates. We'll explain the important request pieces so you can use the sample as the foundation for an integration that can convert PDF to PNG.\u003C\u002Fp>\n\n\u003Ch2>Why Convert PDF to PNG with Java?\u003C\u002Fh2>\n\n\u003Cp>A web review application may need crisp page images for annotations or previews while preserving line art and text edges. PNG output provides a lossless raster format suited to that use case.\u003C\u002Fp>\n\n\u003Cp>The Java sample posts the PDF to \u003Ccode>\u002Fpng\u003C\u002Fcode>. Page-selection and resolution fields determine which pages are rendered and how large the resulting images are.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class Png {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_png\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpng\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPng.java\">Java sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The supporting code assigns a clear role to each library: HTTP communication, credential lookup, or JSON handling.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>This setup uses runtime arguments when supplied and otherwise falls back to the documented input path and environment-based credential.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_png\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpng\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The Java sample posts the PDF to \u003Ccode>\u002Fpng\u003C\u002Fcode>. Page-selection and resolution fields determine which pages are rendered and how large the resulting images are. The body construction leaves boundary construction to OkHttp so the header remains synchronized with the serialized content.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpng\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>This builder chain posts the multipart content to pdfRest and keeps deployment-region changes independent of the rest of the Java code.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>This completion path prints the HTTP status and JSON body so generated resource IDs or API error details are visible.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By working through this example, you now have a Java pattern you can use to convert PDF to PNG. With that foundation, pNG conversion is useful for document previews, quality-assurance comparisons, and image-processing pipelines.\u003C\u002Fp>\n\n\u003Cp>When this becomes part of an application, keep in mind that pNG preserves sharp text and line art without lossy compression, but high resolution can produce large files. Match DPI and page ranges to the preview or image-processing task, and keep the returned page-to-resource ordering when handling multi-page PDFs.\u003C\u002Fp>\n\n\u003Cp>\u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> lets you try the Convert PDF to PNG operation without first building an application. When you are ready to implement it, see the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\u002F\">PDF to Images API Tool documentation\u003C\u002Fa> for the complete API contract.\u003C\u002Fp>\n\n\u003Cp>Note: The Convert PDF to PNG example above uses multipart form data; for callers that have already uploaded the source, use the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPng.java\">JSON payload example\u003C\u002Fa> as a guide.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T21:57:35.000+00:00","Convert PDF pages into PNG images from Java with configurable page and raster settings.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-java\u002F#article\",\n      \"headline\": \"How to Convert PDF to PNG with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:35.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:35.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert PDF pages into PNG images from Java with configurable page and raster settings.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpng API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert, Java, PDF to Images, PNG\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PNG with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6403,6404,6405,6406,6407,6408,6409],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1538,"name":1539,"slug":1540,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1546,"name":1547,"slug":1548,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-png-with-java\u002F","Convert PDF to PNG with Java | pdfRest",{"id":6414,"uuid":6415,"title":6416,"slug":6417,"html":6418,"comment_id":6414,"feature_image":48,"featured":284,"visibility":1257,"created_at":6419,"updated_at":6420,"published_at":6419,"custom_excerpt":6421,"codeinjection_head":6422,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6423,"primary_tag":6431,"url":6432,"excerpt":6421,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6433,"meta_description":6421,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"667c5d9a533c9f26b9437cb9","19ba2d13-079c-48c1-8166-a9fa50293e70","How to Convert PDF to PNG with JavaScript in NodeJS","how-to-convert-pdf-to-png-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to PNG with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest PDF to Images API Tool allows developers to convert PDF documents into image files, such as PNG, with ease. This tutorial will show you how to send an API call to the PDF to Images endpoint using JavaScript. By leveraging this API, you can automate the conversion process, integrate it into your web applications, and handle PDF files programmatically.\u003C\u002Fp>\n\n\u003Cp>Imagine you are developing a web application that allows users to upload PDF documents and view them as images. This is particularly useful for applications where users need to preview documents before downloading or for creating image thumbnails of PDF pages. The PDF to Images API can streamline this process, making it efficient and user-friendly.\u003C\u002Fp>\n\n\u003Ch2>PDF to PNG with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to convert a PDF into PNG image files, one per PDF page.\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile')); \ndata.append('pages', '1-last');\ndata.append('resolution', '300');\ndata.append('color_model', 'rgb');\ndata.append('output', 'pdfrest_png');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpng', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpng.js\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>Let's break down the code into smaller parts to understand how it works:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\u003C\u002Fpre>\n\n\u003Cp>Here, we are importing the necessary modules: \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests, \u003Ccode>form-data\u003C\u002Fcode> for handling multipart form data, and \u003Ccode>fs\u003C\u002Fcode> for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile')); \ndata.append('pages', '1-last');\ndata.append('resolution', '300');\ndata.append('color_model', 'rgb');\ndata.append('output', 'pdfrest_png');\n\u003C\u002Fpre>\n\n\u003Cp>We create a new instance of \u003Ccode>FormData\u003C\u002Fcode> and append the necessary fields:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Ccode>file\u003C\u002Fcode>: The PDF file to be converted, read as a stream.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>pages\u003C\u002Fcode>: Specifies which pages to convert, in this case, all pages from 1 to the last.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>resolution\u003C\u002Fcode>: The resolution of the output images, set to 300 DPI.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>color_model\u003C\u002Fcode>: The color model for the output images, set to RGB.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>output\u003C\u002Fcode>: The desired output format, specified as \u003Ccode>pdfrest_png\u003C\u002Fcode>.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpng', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \n    ...data.getHeaders() \n  },\n  data : data \n};\n\u003C\u002Fpre>\n\n\u003Cp>We define the configuration options for the \u003Ccode>axios\u003C\u002Fcode> request:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Ccode>method\u003C\u002Fcode>: The HTTP method, set to \u003Ccode>post\u003C\u002Fcode>.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>maxBodyLength\u003C\u002Fcode>: Sets the maximum length of the request body to infinity.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>url\u003C\u002Fcode>: The endpoint URL for the PDF to Images API.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>headers\u003C\u002Fcode>: Includes the API key and headers from the \u003Ccode>FormData\u003C\u002Fcode> instance.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>data\u003C\u002Fcode>: The form data to be sent with the request.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\u003C\u002Fpre>\n\n\u003Cp>We send the request using \u003Ccode>axios\u003C\u002Fcode> and handle the response or any errors. The response data is logged to the console.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we demonstrated how to use JavaScript to call the pdfRest PDF to Images API and convert a PDF document into PNG images. This example can be extended to handle various other functionalities provided by pdfRest.\u003C\u002Fp>\n\n\u003Cp>We encourage you to explore all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpng.js\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-06-26T18:27:38.000+00:00","2026-09-02T18:27:59.000+00:00","Learn how to convert PDF pages to PNG images using pdfRest PDF to Images API Tool with JavaScript","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert PDF to PNG with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-06-26T18:27:38.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:29.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert PDF pages to PNG images using pdfRest PDF to Images API Tool with JavaScript\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpng API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert, JavaScript, PDF to Images, PNG\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PNG with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6424,6425,6426,6427,6428,6429,6430],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1538,"name":1539,"slug":1540,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1546,"name":1547,"slug":1548,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-png-with-javascript-in-nodejs\u002F","How to Convert PDF to PNG with JavaScript in NodeJS, Tutorial | pdfRest",{"id":6435,"uuid":6436,"title":6437,"slug":6438,"html":6439,"comment_id":6435,"feature_image":48,"featured":284,"visibility":1257,"created_at":6440,"updated_at":6420,"published_at":6440,"custom_excerpt":6441,"codeinjection_head":6442,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6443,"primary_tag":6451,"url":6452,"excerpt":6441,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6453,"meta_description":6441,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"667c5e1b533c9f26b9437cc3","8e6aee1e-b1fd-4c4b-8673-7e9201f1cab6","How to Convert PDF to PNG with PHP","how-to-convert-pdf-to-png-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to PNG with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest PDF to Images API Tool is a powerful and flexible solution for converting PDF documents into image formats like PNG, JPEG, and others. By leveraging this tool, developers can easily integrate PDF to image conversion capabilities into their PHP applications. This tutorial will demonstrate how to send an API call to the PDF to Images endpoint using PHP, specifically focusing on converting a PDF to PNG.\u003C\u002Fp>\n\n\u003Cp>An example of why a user might use PDF to Images is for generating thumbnails or previews of PDF documents. For instance, a document management system might need to display a preview of each page of a PDF document to its users. By converting the PDF pages into images, the system can provide a quick and visually appealing way for users to browse through documents without needing to open the entire PDF file.\u003C\u002Fp>\n\n\u003Ch2>PDF to PNG with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">\nrequire 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\n$headers = [\n  'Api-Key' =--> 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile', \u002F\u002F Set the filename for the file to be converted, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'pages', \u002F\u002F Specify the field name for the pages option.\n      'contents' => '1-last' \u002F\u002F Set the value for the pages option (in this case, '1-last').\n    ],\n    [\n      'name' => 'resolution', \u002F\u002F Specify the field name for the resolution option.\n      'contents' => '300' \u002F\u002F Set the value for the resolution option (in this case, '300').\n    ],\n    [\n      'name' => 'color_model', \u002F\u002F Specify the field name for the color_model option.\n      'contents' => 'rgb' \u002F\u002F Set the value for the color_model option (in this case, 'rgb').\n    ],\n    [\n      'name' => 'output', \u002F\u002F Specify the field name for the output option.\n      'contents' => 'pdfrest_png' \u002F\u002F Set the value for the output option (in this case, 'pdfrest_png').\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpng', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the converted PNG image.\n\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source of the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpng.php\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">require 'vendor\u002Fautoload.php';\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\u003C\u002Fpre>\n\n\u003Cp>This section imports the necessary libraries. The \u003Ccode>vendor\u002Fautoload.php\u003C\u002Fcode> file is required to load the Guzzle HTTP client, and the \u003Ccode>use\u003C\u002Fcode> statements import the necessary classes from the Guzzle library.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$client = new Client();\n\u003C\u002Fpre>\n\n\u003Cp>This line creates a new instance of the Guzzle HTTP client, which will be used to send the API request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>$headers\u003C\u002Fcode> array sets the API key for authentication. Replace \u003Ccode>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\u003C\u002Fcode> with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'pages',\n      'contents' => '1-last'\n    ],\n    [\n      'name' => 'resolution',\n      'contents' => '300'\n    ],\n    [\n      'name' => 'color_model',\n      'contents' => 'rgb'\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_png'\n    ]\n  ]\n];\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>$options\u003C\u002Fcode> array configures the multipart form data for the API request. Each element in the \u003Ccode>multipart\u003C\u002Fcode> array represents a form field:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Ccode>file\u003C\u002Fcode>: Specifies the file to be converted. \u003Ccode>Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r')\u003C\u002Fcode> opens the file for reading, and \u003Ccode>'filename' => '\u002Fpath\u002Fto\u002Ffile'\u003C\u002Fcode> sets the filename. Replace \u003Ccode>\u002Fpath\u002Fto\u002Ffile\u003C\u002Fcode> with the actual path to your PDF file.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>pages\u003C\u002Fcode>: Specifies the pages to convert, in this case, all pages from the first to the last.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>resolution\u003C\u002Fcode>: Sets the resolution for the output images, here it is set to 300 DPI.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>color_model\u003C\u002Fcode>: Sets the color model for the output images, in this case, RGB.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>output\u003C\u002Fcode>: Specifies the output format, which is \u003Ccode>pdfrest_png\u003C\u002Fcode> for PNG images.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-python\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpng', $headers);\n\u003C\u002Fpre>\n\n\u003Cp>This line creates a new HTTP POST request with the specified API endpoint and headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$res = $client->sendAsync($request, $options)->wait();\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>sendAsync\u003C\u002Fcode> method sends the asynchronous request, and \u003Ccode>wait\u003C\u002Fcode> waits for the response.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">echo $res->getBody();\n\u003C\u002Fpre>\n\n\u003Cp>This line outputs the response body, which contains the converted PNG image.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we demonstrated how to use the pdfRest PDF to Images API Tool to convert a PDF document into PNG images using PHP. By following the steps outlined above, you can integrate similar functionality into your own PHP applications.\u003C\u002Fp>\n\n\u003Cp>We encourage you to explore all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpng.php\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-06-26T18:29:47.000+00:00","Learn how to use pdfRest PDF to Images API Tool with PHP to convert PDF pages to PNG images","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-php\u002F#article\",\n      \"headline\": \"How to Convert PDF to PNG with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-php\u002F\",\n      \"datePublished\": \"2024-06-26T18:29:47.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:29.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest PDF to Images API Tool with PHP to convert PDF pages to PNG images\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpng API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert, PDF to Images, PHP, PNG\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PNG with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6444,6445,6446,6447,6448,6449,6450],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1538,"name":1539,"slug":1540,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1546,"name":1547,"slug":1548,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-png-with-php\u002F","How to Convert PDF to PNG with PHP, Tutorial | pdfRest",{"id":6455,"uuid":6456,"title":6457,"slug":6458,"html":6459,"comment_id":6455,"feature_image":48,"featured":284,"visibility":1257,"created_at":6460,"updated_at":6461,"published_at":6460,"custom_excerpt":6462,"codeinjection_head":6463,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6464,"primary_tag":6472,"url":6473,"excerpt":6462,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6474,"meta_description":6462,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"667c5ea0533c9f26b9437ccd","59fec4e9-35d5-4989-91db-be13cd4746f2","How to Convert PDF to PNG with Python","how-to-convert-pdf-to-png-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to PNG with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest PDF to Images API Tool is a powerful utility that allows users to convert PDF documents into image files. This tutorial will guide you on how to send an API call to the PDF to Images endpoint using Python. This can be particularly useful for developers looking to automate the conversion of PDF files into images for further processing or display in web applications.\u003C\u002Fp>\n\n\u003Cp>Imagine a scenario where a user needs to display individual pages of a PDF document as images on a website. Using the PDF to Images API, the user can easily convert each page into an image format like PNG, which can then be embedded directly into a webpage. This is especially useful for applications such as online document viewers, digital libraries, or any service that requires high-quality image representations of PDF content.\u003C\u002Fp>\n\n\u003Ch2>PDF to PNG with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\npng_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpng'\n\n# The \u002Fpng endpoint can take a single PDF file or id as input and turn them into PNG image files.\n# This sample takes in a PDF and converts all pages into grayscale PNG files.\nmp_encoder_png = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'pages': '1-last',\n        'resolution': '600',\n        'color_model': 'gray',\n        'output' : 'example_png_out',\n    }\n)\n\n# Let's set the headers that the png endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_png.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to png endpoint...\")\nresponse = requests.post(png_endpoint_url, data=mp_encoder_png, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpng.py\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>Let's break down the code to understand how it works:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\u003C\u002Fpre>\n\n\u003Cp>This imports the necessary libraries. \u003Ccode>requests_toolbelt.MultipartEncoder\u003C\u002Fcode> is used to handle multipart form data, \u003Ccode>requests\u003C\u002Fcode> is used to make HTTP requests, and \u003Ccode>json\u003C\u002Fcode> is used to handle JSON data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">png_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpng'\n\u003C\u002Fpre>\n\n\u003Cp>This sets the endpoint URL for the PDF to Images API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_png = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'pages': '1-last',\n        'resolution': '600',\n        'color_model': 'gray',\n        'output' : 'example_png_out',\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>Here, we create a \u003Ccode>MultipartEncoder\u003C\u002Fcode> object to handle the multipart form data. The \u003Ccode>fields\u003C\u002Fcode> parameter contains:\u003C\u002Fp>\n\n\u003Cul>\n    \u003Cli>\u003Ccode>'file'\u003C\u002Fcode>: The PDF file to be converted. Replace \u003Ccode>'\u002Fpath\u002Fto\u002Ffile'\u003C\u002Fcode> with the actual file path.\u003C\u002Fli>\n    \u003Cli>\u003Ccode>'pages'\u003C\u002Fcode>: Specifies the pages to convert. \u003Ccode>'1-last'\u003C\u002Fcode> means all pages.\u003C\u002Fli>\n    \u003Cli>\u003Ccode>'resolution'\u003C\u002Fcode>: The resolution of the output images, set to 600 DPI.\u003C\u002Fli>\n    \u003Cli>\u003Ccode>'color_model'\u003C\u002Fcode>: The color model for the output images, set to grayscale.\u003C\u002Fli>\n    \u003Cli>\u003Ccode>'output'\u003C\u002Fcode>: The output file name prefix.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_png.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\u003C\u002Fpre>\n\n\u003Cp>The headers include:\u003C\u002Fp>\n\n\u003Cul>\n    \u003Cli>\u003Ccode>'Accept'\u003C\u002Fcode>: Specifies that the response should be in JSON format.\u003C\u002Fli>\n    \u003Cli>\u003Ccode>'Content-Type'\u003C\u002Fcode>: Set automatically by \u003Ccode>MultipartEncoder\u003C\u002Fcode> to \u003Ccode>'multipart\u002Fform-data'\u003C\u002Fcode>.\u003C\u002Fli>\n    \u003Cli>\u003Ccode>'Api-Key'\u003C\u002Fcode>: Your API key for authentication.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-python\">response = requests.post(png_endpoint_url, data=mp_encoder_png, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This sends a POST request to the API endpoint with the multipart form data and headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>If the response is successful, it prints the JSON response. Otherwise, it prints the error message.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use the pdfRest PDF to Images API to convert a PDF document into PNG images using Python. This is a powerful tool for automating the conversion of PDF files into image formats for various applications.\u003C\u002Fp>\n\n\u003Cp>To explore more functionalities, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed documentation, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpng.py\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-06-26T18:32:00.000+00:00","2026-09-02T18:28:00.000+00:00","Learn how to convert each page of a PDF to PNG using pdfRest PDF to Images API Tool with Python","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-python\u002F#article\",\n      \"headline\": \"How to Convert PDF to PNG with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-python\u002F\",\n      \"datePublished\": \"2024-06-26T18:32:00.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:29.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert each page of a PDF to PNG using pdfRest PDF to Images API Tool with Python\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpng API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert, PDF to Images, PNG, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PNG with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-png-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6465,6466,6467,6468,6469,6470,6471],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1538,"name":1539,"slug":1540,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1546,"name":1547,"slug":1548,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-png-with-python\u002F","How to Convert PDF to PNG with Python, Tutorial | pdfRest",{"id":6476,"uuid":6477,"title":6478,"slug":6479,"html":6480,"comment_id":6476,"feature_image":48,"featured":284,"visibility":1257,"created_at":6481,"updated_at":6482,"published_at":4275,"custom_excerpt":6483,"codeinjection_head":6484,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6485,"primary_tag":6492,"url":6493,"excerpt":6483,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6494,"meta_description":6483,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a989af0d1b70dd2e2978a3c","159f3183-bad4-495b-acfc-b3aa462d2a6b","How to Convert PDF to PostScript in .NET with C#","how-to-convert-pdf-to-postscript-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This .NET walkthrough uses C# and \u003Ccode>HttpClient\u003C\u002Fcode> to submit the request. It converts a PDF into PostScript with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-postscript\u002F\">pdfRest PDF to PostScript API Tool\u003C\u002Fa>, using visible output controls for a production workflow. The complete sample is included below so .NET with C# developers can see the file handling, request construction, and response path together.\u003C\u002Fp>\n\n\u003Ch2>Why PDF to PostScript in .NET with C#?\u003C\u002Fh2>\n\n\u003Cp>.NET applications can generate PostScript for established production systems without making users export through a local print driver. The request accepts a PDF and returns a separate managed PostScript output.\u003C\u002Fp>\n\n\u003Cp>A C# batch process may submit a report PDF with Level 3 output, selected pages, shrink-to-fit behavior, and annotation handling chosen for a print pipeline. Those decisions are captured in the request rather than left to the machine running the job.\u003C\u002Fp>\n\n\u003Cp>The source PDF is not overwritten. That separation lets the application retain an approved original and track the generated PostScript file as a downstream deliverable.\u003C\u002Fp>\n\n\u003Ch2>C# Code Example for PDF to PostScript\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">\u002F*\n * What this sample does:\n * - Converts PDF to PostScript through the \u002Fpostscript endpoint.\n * - Pair with \u002Fpdf for PDF refrying: PDF -> PostScript -> PDF. Some print and prepress\n *   workflows use this lossy roundtrip to rebuild, flatten, or normalize page content.\n * - Requests Level 3, text-safe output, all pages at original scale, shrink-to-fit\n *   without rotation, and printable annotations.\n *\n * Setup (environment):\n * - Set PDFREST_API_KEY=your_api_key_here\n * - Optional: set PDFREST_URL to override the API region.\n *\n * Usage:\n *   dotnet run -- postscript-multipart \u003CinputFile>\n *\u002F\nusing System.Net.Http.Headers;\n\nnamespace Samples.EndpointExamples.MultipartPayload;\n\npublic static class Postscript\n{\n    public static async Task Execute(string[] args)\n    {\n        var inputPath = args.Length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.pdf\";\n        var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\n        if (string.IsNullOrWhiteSpace(apiKey)) throw new InvalidOperationException(\"Missing PDFREST_API_KEY\");\n        var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n        using var client = new HttpClient { BaseAddress = new Uri(baseUrl) };\n        client.DefaultRequestHeaders.TryAddWithoutValidation(\"Api-Key\", apiKey);\n        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(\"application\u002Fjson\"));\n        using var form = new MultipartFormDataContent();\n        var inputContent = new ByteArrayContent(await File.ReadAllBytesAsync(inputPath));\n        inputContent.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Fpdf\");\n        form.Add(inputContent, \"file\", Path.GetFileName(inputPath));\n        form.Add(new StringContent(\"3\"), \"ps_level\");\n        form.Add(new StringContent(\"all\"), \"page_range\");\n        form.Add(new StringContent(\"false\"), \"binary_output\");\n        form.Add(new StringContent(\"1\"), \"scale\");\n        form.Add(new StringContent(\"false\"), \"rotate\");\n        form.Add(new StringContent(\"true\"), \"shrink_to_fit\");\n        form.Add(new StringContent(\"true\"), \"print_annotations\");\n        form.Add(new StringContent(\"postscript_from_pdf\"), \"output\");\n        var response = await client.PostAsync(\"postscript\", form);\n        var result = await response.Content.ReadAsStringAsync();\n        Console.WriteLine(result);\n        if (!response.IsSuccessStatusCode) Environment.ExitCode = 1;\n    }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpostscript.cs\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Configure the service and input\u003C\u002Fh3>\n\n\u003Cpre class=\"language-csharp\">var inputPath = args.Length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.pdf\";\n        var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\n        if (string.IsNullOrWhiteSpace(apiKey)) throw new InvalidOperationException(\"Missing PDFREST_API_KEY\");\n        var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n        using var client = new HttpClient { BaseAddress = new Uri(baseUrl) };\n        client.DefaultRequestHeaders.TryAddWithoutValidation(\"Api-Key\", apiKey);\n        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(\"application\u002Fjson\"));\u003C\u002Fpre>\n\n\u003Cp>For this PDF to PostScript example, .NET with C# sends the multipart request to \u003Ccode>\u002Fpostscript\u003C\u002Fcode>. The C# samples use framework \u003Ccode>HttpClient\u003C\u002Fcode> APIs and disposable content objects. API credentials come from \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode>, keeping the secret out of the source file and request body. The sample’s placeholder path and API key make the moving pieces visible; replace them with a real local path and protected runtime credential before using the request.\u003C\u002Fp>\n\n\u003Ch3>Select PostScript Output Settings\u003C\u002Fh3>\n\n\u003Cpre class=\"language-csharp\">var inputContent = new ByteArrayContent(await File.ReadAllBytesAsync(inputPath));\n        inputContent.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Fpdf\");\n        form.Add(inputContent, \"file\", Path.GetFileName(inputPath));\n        form.Add(new StringContent(\"3\"), \"ps_level\");\n        form.Add(new StringContent(\"all\"), \"page_range\");\n        form.Add(new StringContent(\"false\"), \"binary_output\");\n        form.Add(new StringContent(\"1\"), \"scale\");\n        form.Add(new StringContent(\"false\"), \"rotate\");\n        form.Add(new StringContent(\"true\"), \"shrink_to_fit\");\n        form.Add(new StringContent(\"true\"), \"print_annotations\");\n        form.Add(new StringContent(\"postscript_from_pdf\"), \"output\");\u003C\u002Fpre>\n\n\u003Cp>The .NET with C# sample explicitly requests \u003Ccode>ps_level=3\u003C\u002Fcode>, all pages, binary output, no rotation, unit scale, shrink-to-fit, and printable annotations. Those choices describe the new PostScript result; they do not edit or replace the uploaded PDF.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-csharp\">client.DefaultRequestHeaders.TryAddWithoutValidation(\"Api-Key\", apiKey);\n        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(\"application\u002Fjson\"));\n        using var form = new MultipartFormDataContent();\n        var inputContent = new ByteArrayContent(await File.ReadAllBytesAsync(inputPath));\n        inputContent.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Fpdf\");\n        form.Add(inputContent, \"file\", Path.GetFileName(inputPath));\n        form.Add(new StringContent(\"3\"), \"ps_level\");\n        form.Add(new StringContent(\"all\"), \"page_range\");\n        form.Add(new StringContent(\"false\"), \"binary_output\");\n        form.Add(new StringContent(\"1\"), \"scale\");\n        form.Add(new StringContent(\"false\"), \"rotate\");\u003C\u002Fpre>\n\n\u003Cp>For the PDF to PostScript form, \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> owns the uploaded streams and text values. The .NET runtime calculates the multipart boundary and content type when \u003Ccode>HttpClient\u003C\u002Fcode> sends the container.\u003C\u002Fp>\n\n\u003Ch3>Read the output resource\u003C\u002Fh3>\n\n\u003Cpre class=\"language-csharp\">form.Add(new StringContent(\"true\"), \"shrink_to_fit\");\n        form.Add(new StringContent(\"true\"), \"print_annotations\");\n        form.Add(new StringContent(\"postscript_from_pdf\"), \"output\");\n        var response = await client.PostAsync(\"postscript\", form);\n        var result = await response.Content.ReadAsStringAsync();\n        Console.WriteLine(result);\n        if (!response.IsSuccessStatusCode) Environment.ExitCode = 1;\n    }\n}\u003C\u002Fpre>\n\n\u003Cp>After the PDF to PostScript call, the client reads the response text and reports non-success status through the process exit code. A successful JSON body identifies the managed output resource, while an unsuccessful body should be surfaced to the calling application.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This .NET with C# example submitted a PDF to \u003Ccode>\u002Fpostscript\u003C\u002Fcode> and selected the controls that shape the resulting PostScript file. Retain the returned resource ID whenever the output needs to be downloaded, monitored, or used by a following workflow step.\u003C\u002Fp>\n\n\u003Cp>Try representative pdf to postscript inputs in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the authoritative request fields, accepted values, and response contract, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">pdfRest API Reference Guide\u003C\u002Fa>. The same request pattern can then be adapted to your .NET with C# application’s error handling, retention policy, and delivery workflow.\u003C\u002Fp>\n\n\u003Cp>For .NET with C# applications that already hold the source as a managed resource, the repository includes a JSON-payload PDF-to-PostScript example. It uploads the PDF separately and sends the returned ID with the PostScript options. \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpostscript.cs\">View the JSON-payload sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-02T21:53:52.000+00:00","2026-09-04T05:15:34.000+00:00","Convert PDF documents to PostScript with .NET with C# and configure page, scaling, annotation, and output settings.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-postscript-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert PDF to PostScript in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-postscript-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-postscript-in-net-with-c\u002F\",\n      \"datePublished\": \"2026-09-03T17:04:36.000Z\",\n      \"dateModified\": \"2026-09-03T17:04:36.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert PDF documents to PostScript with .NET with C# and configure page, scaling, annotation, and output settings.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to PostScript API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-postscript\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpostscript API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fpdf-to-postscript\u002FPOST\u002Fpostscript\u002F\"\n        }\n      ],\n      \"keywords\": \".NET, Conversion, PostScript, PDF to PostScript\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PostScript in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-postscript-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6486,6487,6488,6489,6490,6491],{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2133,"name":2134,"slug":2135,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2185,"name":2186,"slug":2187,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-postscript-in-net-with-c\u002F","How to Convert PDF to PostScript in .NET with C# | pdfRest",{"id":6496,"uuid":6497,"title":6498,"slug":6499,"html":6500,"comment_id":6496,"feature_image":48,"featured":284,"visibility":1257,"created_at":6481,"updated_at":6501,"published_at":4275,"custom_excerpt":6502,"codeinjection_head":6503,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6504,"primary_tag":6511,"url":6512,"excerpt":6502,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6513,"meta_description":6502,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a989af0d1b70dd2e2978a24","63e0cde7-2dc1-42e5-a18d-71181f5d5fc2","How to Convert PDF to PostScript with cURL","how-to-convert-pdf-to-postscript-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This cURL walkthrough uses the public pdfRest API directly from a shell script. It converts a PDF into PostScript with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-postscript\u002F\">pdfRest PDF to PostScript API Tool\u003C\u002Fa>, using visible output controls for a production workflow. The complete sample is included below so cURL developers can see the file handling, request construction, and response path together.\u003C\u002Fp>\n\n\u003Ch2>Why PDF to PostScript with cURL?\u003C\u002Fh2>\n\n\u003Cp>Shell automation is a practical fit when an existing print or prepress stage accepts PostScript but the upstream system delivers PDFs. The \u003Ccode>\u002Fpostscript\u003C\u002Fcode> request turns that transition into a scriptable processing step.\u003C\u002Fp>\n\n\u003Cp>For example, a release job can convert an approved PDF to Level 3 PostScript and place it in a watched production directory. Page range and scaling switches can be stored next to the job rather than relying on manual print-dialog choices.\u003C\u002Fp>\n\n\u003Cp>That keeps the original PDF intact while producing a distinct PostScript resource for the downstream stage. The response identifies that new result without requiring the script to guess its filename or location.\u003C\u002Fp>\n\n\u003Ch2>cURL Code Example for PDF to PostScript\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">#!\u002Fbin\u002Fsh\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# This sample converts PDF to PostScript through multipart \u002Fpostscript.\n# Pairing this endpoint with \u002Fpdf creates a PDF -> PostScript -> PDF workflow commonly\n# called PDF refrying. Some print and prepress workflows use it to rebuild, flatten, or\n# normalize page content, but the lossy roundtrip can discard PDF-specific features.\n# These settings request Level 3, text-safe output, all pages at original scale,\n# shrink-to-fit without rotation, and printable annotations.\nINPUT_PATH=\"\u002Fpath\u002Fto\u002Fsample.pdf\"\n\ncurl --location \"$API_URL\u002Fpostscript\" \\\n  --header \"Accept: application\u002Fjson\" \\\n  --header \"Content-Type: multipart\u002Fform-data\" \\\n  --header \"Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  --form \"file=@$INPUT_PATH;type=application\u002Fpdf\" \\\n  --form \"ps_level=3\" \\\n  --form \"page_range=all\" \\\n  --form \"binary_output=false\" \\\n  --form \"scale=1\" \\\n  --form \"rotate=false\" \\\n  --form \"shrink_to_fit=true\" \\\n  --form \"print_annotations=true\" \\\n  --form \"output=postscript_from_pdf\"\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpostscript.sh\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Configure the service and input\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>For this PDF to PostScript example, cURL sends the multipart request to \u003Ccode>\u002Fpostscript\u003C\u002Fcode>. cURL needs no language package installation. The sample keeps the service URL, API key, input path, and output name together near the top of the shell script so those values can be replaced before the request is sent. The sample’s placeholder path and API key make the moving pieces visible; replace them with a real local path and protected runtime credential before using the request.\u003C\u002Fp>\n\n\u003Ch3>Select PostScript Output Settings\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">--header \"Content-Type: multipart\u002Fform-data\" \\\n  --header \"Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  --form \"file=@$INPUT_PATH;type=application\u002Fpdf\" \\\n  --form \"ps_level=3\" \\\n  --form \"page_range=all\" \\\n  --form \"binary_output=false\" \\\n  --form \"scale=1\" \\\n  --form \"rotate=false\" \\\n  --form \"shrink_to_fit=true\" \\\n  --form \"print_annotations=true\" \\\n  --form \"output=postscript_from_pdf\"\u003C\u002Fpre>\n\n\u003Cp>The cURL sample explicitly requests \u003Ccode>ps_level=3\u003C\u002Fcode>, all pages, binary output, no rotation, unit scale, shrink-to-fit, and printable annotations. Those choices describe the new PostScript result; they do not edit or replace the uploaded PDF.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">--header \"Content-Type: multipart\u002Fform-data\" \\\n  --header \"Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  --form \"file=@$INPUT_PATH;type=application\u002Fpdf\" \\\n  --form \"ps_level=3\" \\\n  --form \"page_range=all\" \\\n  --form \"binary_output=false\" \\\n  --form \"scale=1\" \\\n  --form \"rotate=false\" \\\n  --form \"shrink_to_fit=true\" \\\n  --form \"print_annotations=true\" \\\n  --form \"output=postscript_from_pdf\"\u003C\u002Fpre>\n\n\u003Cp>For the PDF to PostScript form, each \u003Ccode>--form\u003C\u002Fcode> option creates one multipart field. cURL reads file fields from disk when their value begins with \u003Ccode>@\u003C\u002Fcode>, while ordinary quoted values become text fields.\u003C\u002Fp>\n\n\u003Ch3>Read the output resource\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\"># shrink-to-fit without rotation, and printable annotations.\nINPUT_PATH=\"\u002Fpath\u002Fto\u002Fsample.pdf\"\n\ncurl --location \"$API_URL\u002Fpostscript\" \\\n  --header \"Accept: application\u002Fjson\" \\\n  --header \"Content-Type: multipart\u002Fform-data\" \\\n  --header \"Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  --form \"file=@$INPUT_PATH;type=application\u002Fpdf\" \\\n  --form \"ps_level=3\" \\\n  --form \"page_range=all\" \\\n  --form \"binary_output=false\" \\\n  --form \"scale=1\" \\\u003C\u002Fpre>\n\n\u003Cp>After the PDF to PostScript call, the command prints the JSON response. Read \u003Ccode>outputId\u003C\u002Fcode> to retain the generated resource for a later call or download it from the returned URL before the service retention period ends.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This cURL example submitted a PDF to \u003Ccode>\u002Fpostscript\u003C\u002Fcode> and selected the controls that shape the resulting PostScript file. Retain the returned resource ID whenever the output needs to be downloaded, monitored, or used by a following workflow step.\u003C\u002Fp>\n\n\u003Cp>Try representative pdf to postscript inputs in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the authoritative request fields, accepted values, and response contract, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">pdfRest API Reference Guide\u003C\u002Fa>. The same request pattern can then be adapted to your cURL application’s error handling, retention policy, and delivery workflow.\u003C\u002Fp>\n\n\u003Cp>For cURL applications that already hold the source as a managed resource, the repository includes a JSON-payload PDF-to-PostScript example. It uploads the PDF separately and sends the returned ID with the PostScript options. \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpostscript.sh\">View the JSON-payload sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-04T05:15:33.000+00:00","Convert PDF documents to PostScript with cURL and configure page, scaling, annotation, and output settings.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-postscript-with-curl\u002F#article\",\n      \"headline\": \"How to Convert PDF to PostScript with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-postscript-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-postscript-with-curl\u002F\",\n      \"datePublished\": \"2026-09-03T17:04:36.000Z\",\n      \"dateModified\": \"2026-09-03T17:04:36.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert PDF documents to PostScript with cURL and configure page, scaling, annotation, and output settings.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to PostScript API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-postscript\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpostscript API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fpdf-to-postscript\u002FPOST\u002Fpostscript\u002F\"\n        }\n      ],\n      \"keywords\": \"Conversion, PostScript, cURL, PDF to PostScript\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PostScript with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-postscript-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6505,6506,6507,6508,6509,6510],{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2133,"name":2134,"slug":2135,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2185,"name":2186,"slug":2187,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-postscript-with-curl\u002F","How to Convert PDF to PostScript with cURL | pdfRest",{"id":6515,"uuid":6516,"title":6517,"slug":6518,"html":6519,"comment_id":6515,"feature_image":48,"featured":284,"visibility":1257,"created_at":6481,"updated_at":6501,"published_at":6520,"custom_excerpt":6521,"codeinjection_head":6522,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6523,"primary_tag":6530,"url":6531,"excerpt":6521,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6532,"meta_description":6521,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a989af0d1b70dd2e2978a2c","b2881ee7-f19d-48d5-857a-a2c2e1eb3a96","How to Convert PDF to PostScript with Java","how-to-convert-pdf-to-postscript-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This Java walkthrough uses an OkHttp multipart request from a JVM application. It converts a PDF into PostScript with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-postscript\u002F\">pdfRest PDF to PostScript API Tool\u003C\u002Fa>, using visible output controls for a production workflow. The complete sample is included below so Java developers can see the file handling, request construction, and response path together.\u003C\u002Fp>\n\n\u003Ch2>Why PDF to PostScript with Java?\u003C\u002Fh2>\n\n\u003Cp>JVM applications can support PostScript-based downstream systems while continuing to receive and manage PDFs as their primary application documents. The conversion endpoint supplies a separate output resource rather than mutating the source file.\u003C\u002Fp>\n\n\u003Cp>An enterprise print coordinator might route selected pages of an approved PDF to a legacy renderer that expects Level 3 PostScript. The Java request carries the page range, scaling, rotation, binary-output, and annotation decisions alongside the uploaded input.\u003C\u002Fp>\n\n\u003Cp>This keeps production settings in reviewable application code and allows response IDs to be recorded with the job for traceability or later retrieval.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example for PDF to PostScript\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\n\npublic class Postscript {\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, replace the URL above\n  \u002F\u002F with https:\u002F\u002Feu-api.pdfrest.com. For more information, visit\n  \u002F\u002F https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  \u002F* This sample converts PDF to PostScript through \u002Fpostscript. Pairing this endpoint\n   * with \u002Fpdf creates a PDF -> PostScript -> PDF workflow commonly called PDF refrying.\n   * Some print and prepress workflows use it to rebuild, flatten, or normalize page\n   * content, but the lossy roundtrip can discard PDF-specific features. These settings\n   * request Level 3, text-safe output, all pages at original scale, shrink-to-fit without\n   * rotation, and printable annotations.\n   *\u002F\n  public static void main(String[] args) throws IOException {\n    File inputFile = new File(args.length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.pdf\");\n    Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n    String apiKey = dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY);\n    MultipartBody.Builder form =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\n                \"file\",\n                inputFile.getName(),\n                RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\")))\n            .addFormDataPart(\"ps_level\", \"3\")\n            .addFormDataPart(\"page_range\", \"all\")\n            .addFormDataPart(\"binary_output\", \"false\")\n            .addFormDataPart(\"scale\", \"1\")\n            .addFormDataPart(\"rotate\", \"false\")\n            .addFormDataPart(\"shrink_to_fit\", \"true\")\n            .addFormDataPart(\"print_annotations\", \"true\")\n            .addFormDataPart(\"output\", \"postscript_from_pdf\");\n    Request request =\n        new Request.Builder()\n            .url(API_URL + \"\u002Fpostscript\")\n            .header(\"Api-Key\", apiKey)\n            .post(form.build())\n            .build();\n    send(request);\n  }\n\n  private static void send(Request request) throws IOException {\n    OkHttpClient client = new OkHttpClient.Builder().readTimeout(60, TimeUnit.SECONDS).build();\n    try (Response response = client.newCall(request).execute()) {\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) System.out.println(response.body().string());\n      if (!response.isSuccessful()) System.exit(1);\n    }\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPostscript.java\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Configure the service and input\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, replace the URL above\n  \u002F\u002F with https:\u002F\u002Feu-api.pdfrest.com. For more information, visit\n  \u002F\u002F https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\u003C\u002Fpre>\n\n\u003Cp>For this PDF to PostScript example, Java sends the multipart request to \u003Ccode>\u002Fpostscript\u003C\u002Fcode>. The Java samples use OkHttp for multipart HTTP requests and dotenv support for repository configuration. The sample project supplies those dependencies; applications that copy the class elsewhere need equivalent dependencies and secure runtime configuration. The sample’s placeholder path and API key make the moving pieces visible; replace them with a real local path and protected runtime credential before using the request.\u003C\u002Fp>\n\n\u003Ch3>Select PostScript Output Settings\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\"file\",\n                inputFile.getName(),\n                RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\")))\n            .addFormDataPart(\"ps_level\", \"3\")\n            .addFormDataPart(\"page_range\", \"all\")\n            .addFormDataPart(\"binary_output\", \"false\")\n            .addFormDataPart(\"scale\", \"1\")\n            .addFormDataPart(\"rotate\", \"false\")\n            .addFormDataPart(\"shrink_to_fit\", \"true\")\n            .addFormDataPart(\"print_annotations\", \"true\")\n            .addFormDataPart(\"output\", \"postscript_from_pdf\");\u003C\u002Fpre>\n\n\u003Cp>The Java sample explicitly requests \u003Ccode>ps_level=3\u003C\u002Fcode>, all pages, binary output, no rotation, unit scale, shrink-to-fit, and printable annotations. Those choices describe the new PostScript result; they do not edit or replace the uploaded PDF.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n    String apiKey = dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY);\n    MultipartBody.Builder form =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\n                \"file\",\n                inputFile.getName(),\n                RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\")))\n            .addFormDataPart(\"ps_level\", \"3\")\n            .addFormDataPart(\"page_range\", \"all\")\u003C\u002Fpre>\n\n\u003Cp>For the PDF to PostScript form, okHttp’s \u003Ccode>MultipartBody.Builder\u003C\u002Fcode> constructs the form and assigns its boundary. Each file part carries a filename and media type, while conversion options are ordinary text parts.\u003C\u002Fp>\n\n\u003Ch3>Read the output resource\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">private static void send(Request request) throws IOException {\n    OkHttpClient client = new OkHttpClient.Builder().readTimeout(60, TimeUnit.SECONDS).build();\n    try (Response response = client.newCall(request).execute()) {\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) System.out.println(response.body().string());\n      if (!response.isSuccessful()) System.exit(1);\n    }\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>After the PDF to PostScript call, the response block checks the HTTP status before printing its body. On success, the JSON contains the output resource ID and URL; on failure, the printed body gives the API error detail needed for diagnosis.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This Java example submitted a PDF to \u003Ccode>\u002Fpostscript\u003C\u002Fcode> and selected the controls that shape the resulting PostScript file. Retain the returned resource ID whenever the output needs to be downloaded, monitored, or used by a following workflow step.\u003C\u002Fp>\n\n\u003Cp>Try representative pdf to postscript inputs in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the authoritative request fields, accepted values, and response contract, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">pdfRest API Reference Guide\u003C\u002Fa>. The same request pattern can then be adapted to your Java application’s error handling, retention policy, and delivery workflow.\u003C\u002Fp>\n\n\u003Cp>For Java applications that already hold the source as a managed resource, the repository includes a JSON-payload PDF-to-PostScript example. It uploads the PDF separately and sends the returned ID with the PostScript options. \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPostscript.java\">View the JSON-payload sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-03T17:04:37.000+00:00","Convert PDF documents to PostScript with Java and configure page, scaling, annotation, and output settings.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-postscript-with-java\u002F#article\",\n      \"headline\": \"How to Convert PDF to PostScript with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-postscript-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-postscript-with-java\u002F\",\n      \"datePublished\": \"2026-09-03T17:04:37.000Z\",\n      \"dateModified\": \"2026-09-03T17:04:37.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert PDF documents to PostScript with Java and configure page, scaling, annotation, and output settings.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to PostScript API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-postscript\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpostscript API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fpdf-to-postscript\u002FPOST\u002Fpostscript\u002F\"\n        }\n      ],\n      \"keywords\": \"Conversion, Java, PostScript, PDF to PostScript\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PostScript with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-postscript-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6524,6525,6526,6527,6528,6529],{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2133,"name":2134,"slug":2135,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2185,"name":2186,"slug":2187,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-postscript-with-java\u002F","How to Convert PDF to PostScript with Java | pdfRest",{"id":6534,"uuid":6535,"title":6536,"slug":6537,"html":6538,"comment_id":6534,"feature_image":48,"featured":284,"visibility":1257,"created_at":6481,"updated_at":6482,"published_at":6520,"custom_excerpt":6539,"codeinjection_head":6540,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6541,"primary_tag":6548,"url":6549,"excerpt":6539,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6550,"meta_description":6539,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a989af0d1b70dd2e2978a34","3e4cdeee-e976-4406-946b-27a1fe18b000","How to Convert PDF to PostScript with JavaScript in NodeJS","how-to-convert-pdf-to-postscript-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This NodeJS walkthrough uses JavaScript, Axios, and multipart form data. It converts a PDF into PostScript with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-postscript\u002F\">pdfRest PDF to PostScript API Tool\u003C\u002Fa>, using visible output controls for a production workflow. The complete sample is included below so JavaScript in NodeJS developers can see the file handling, request construction, and response path together.\u003C\u002Fp>\n\n\u003Ch2>Why PDF to PostScript with JavaScript in NodeJS?\u003C\u002Fh2>\n\n\u003Cp>A NodeJS integration can treat PostScript as a generated output for the systems that still require it, while keeping PDF as the format handled by upstream users and web applications. The sample sends exactly one PDF input and returns a new PostScript resource.\u003C\u002Fp>\n\n\u003Cp>For a managed print queue, a worker can set page selection and output options before delivering the PostScript result to a specialized renderer. That avoids relying on browser print behavior or manually configured desktop clients.\u003C\u002Fp>\n\n\u003Cp>The response object is useful beyond display: its output ID is the durable handle for download, cleanup, or a following conversion step while the resource remains retained.\u003C\u002Fp>\n\n\u003Ch2>JavaScript in NodeJS Code Example for PDF to PostScript\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar fs = require(\"fs\");\nvar FormData = require(\"form-data\");\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n\u002F* This sample converts PDF to PostScript through multipart \u002Fpostscript.\n * Pairing this endpoint with \u002Fpdf creates a PDF -> PostScript -> PDF workflow commonly\n * called PDF refrying. Some print and prepress workflows use it to rebuild, flatten, or\n * normalize page content, but the lossy roundtrip can discard PDF-specific features.\n * These settings request Level 3, text-safe output, all pages at original scale,\n * shrink-to-fit without rotation, and printable annotations.\n *\u002F\nvar inputPath = \"\u002Fpath\u002Fto\u002Fsample.pdf\";\nvar form = new FormData();\nform.append(\"file\", fs.createReadStream(inputPath), { contentType: \"application\u002Fpdf\" });\nform.append(\"ps_level\", \"3\");\nform.append(\"page_range\", \"all\");\nform.append(\"binary_output\", \"false\");\nform.append(\"scale\", \"1\");\nform.append(\"rotate\", \"false\");\nform.append(\"shrink_to_fit\", \"true\");\nform.append(\"print_annotations\", \"true\");\nform.append(\"output\", \"postscript_from_pdf\");\n\naxios.post(apiUrl + \"\u002Fpostscript\", form, { headers: { \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", ...form.getHeaders() }, maxBodyLength: Infinity })\n.then((response) => { console.log(JSON.stringify(response.data, null, 2)); })\n.catch((error) => { console.error(error.response ? error.response.data : error.message); process.exitCode = 1; });\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpostscript.js\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Configure the service and input\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\u003C\u002Fpre>\n\n\u003Cp>For this PDF to PostScript example, JavaScript in NodeJS sends the multipart request to \u003Ccode>\u002Fpostscript\u003C\u002Fcode>. The NodeJS samples use \u003Ccode>axios\u003C\u002Fcode> for HTTP, \u003Ccode>form-data\u003C\u002Fcode> for multipart encoding, and Node’s file-system module for local inputs. Install the packages listed in the repository’s JavaScript package manifest when adapting the example. The sample’s placeholder path and API key make the moving pieces visible; replace them with a real local path and protected runtime credential before using the request.\u003C\u002Fp>\n\n\u003Ch3>Select PostScript Output Settings\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">var inputPath = \"\u002Fpath\u002Fto\u002Fsample.pdf\";\nvar form = new FormData();\nform.append(\"file\", fs.createReadStream(inputPath), { contentType: \"application\u002Fpdf\" });\nform.append(\"ps_level\", \"3\");\nform.append(\"page_range\", \"all\");\nform.append(\"binary_output\", \"false\");\nform.append(\"scale\", \"1\");\nform.append(\"rotate\", \"false\");\nform.append(\"shrink_to_fit\", \"true\");\nform.append(\"print_annotations\", \"true\");\nform.append(\"output\", \"postscript_from_pdf\");\u003C\u002Fpre>\n\n\u003Cp>The JavaScript in NodeJS sample explicitly requests \u003Ccode>ps_level=3\u003C\u002Fcode>, all pages, binary output, no rotation, unit scale, shrink-to-fit, and printable annotations. Those choices describe the new PostScript result; they do not edit or replace the uploaded PDF.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar fs = require(\"fs\");\nvar FormData = require(\"form-data\");\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\u003C\u002Fpre>\n\n\u003Cp>For the PDF to PostScript form, \u003Ccode>FormData\u003C\u002Fcode> appends a readable file stream and the text options. Its generated headers include the multipart boundary, so the request combines \u003Ccode>form.getHeaders()\u003C\u002Fcode> with the \u003Ccode>Api-Key\u003C\u002Fcode> header rather than setting a boundary by hand.\u003C\u002Fp>\n\n\u003Ch3>Read the output resource\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar fs = require(\"fs\");\nvar FormData = require(\"form-data\");\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\u003C\u002Fpre>\n\n\u003Cp>After the PDF to PostScript call, axios resolves successful responses to a JSON object and sends API failures to the catch block. The sample prints either the output-resource details or the returned error payload, which is a useful starting point for production logging.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This JavaScript in NodeJS example submitted a PDF to \u003Ccode>\u002Fpostscript\u003C\u002Fcode> and selected the controls that shape the resulting PostScript file. Retain the returned resource ID whenever the output needs to be downloaded, monitored, or used by a following workflow step.\u003C\u002Fp>\n\n\u003Cp>Try representative pdf to postscript inputs in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the authoritative request fields, accepted values, and response contract, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">pdfRest API Reference Guide\u003C\u002Fa>. The same request pattern can then be adapted to your JavaScript in NodeJS application’s error handling, retention policy, and delivery workflow.\u003C\u002Fp>\n\n\u003Cp>For JavaScript in NodeJS applications that already hold the source as a managed resource, the repository includes a JSON-payload PDF-to-PostScript example. It uploads the PDF separately and sends the returned ID with the PostScript options. \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpostscript.js\">View the JSON-payload sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Convert PDF documents to PostScript with JavaScript in NodeJS and configure page, scaling, annotation, and output settings.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-postscript-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert PDF to PostScript with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-postscript-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-postscript-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2026-09-03T17:04:37.000Z\",\n      \"dateModified\": \"2026-09-03T17:04:37.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert PDF documents to PostScript with JavaScript in NodeJS and configure page, scaling, annotation, and output settings.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to PostScript API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-postscript\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpostscript API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fpdf-to-postscript\u002FPOST\u002Fpostscript\u002F\"\n        }\n      ],\n      \"keywords\": \"Conversion, JavaScript, PostScript, PDF to PostScript\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PostScript with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-postscript-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6542,6543,6544,6545,6546,6547],{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2133,"name":2134,"slug":2135,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2185,"name":2186,"slug":2187,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-postscript-with-javascript-in-nodejs\u002F","How to Convert PDF to PostScript with JavaScript in NodeJS | pdfRest",{"id":6552,"uuid":6553,"title":6554,"slug":6555,"html":6556,"comment_id":6552,"feature_image":48,"featured":284,"visibility":1257,"created_at":6557,"updated_at":6482,"published_at":6520,"custom_excerpt":6558,"codeinjection_head":6559,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6560,"primary_tag":6567,"url":6568,"excerpt":6558,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6569,"meta_description":6558,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a989af1d1b70dd2e2978a44","0c39ccb5-c015-445f-b747-03b7c0734818","How to Convert PDF to PostScript with PHP","how-to-convert-pdf-to-postscript-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This PHP walkthrough uses Guzzle to send the file and conversion options. It converts a PDF into PostScript with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-postscript\u002F\">pdfRest PDF to PostScript API Tool\u003C\u002Fa>, using visible output controls for a production workflow. The complete sample is included below so PHP developers can see the file handling, request construction, and response path together.\u003C\u002Fp>\n\n\u003Ch2>Why PDF to PostScript with PHP?\u003C\u002Fh2>\n\n\u003Cp>PHP can generate PostScript from an uploaded PDF when a legacy publishing or device workflow is the next destination. The endpoint makes that format transformation available from the same server-side code that handles the rest of the request lifecycle.\u003C\u002Fp>\n\n\u003Cp>For example, a web order system could prepare a PDF proof for a print-production service, applying the chosen page range, scale, and annotation behavior before handing over the PostScript result. The conversion happens remotely instead of relying on a shared print server.\u003C\u002Fp>\n\n\u003Cp>Guzzle returns a response containing the output resource details, allowing the application to tie the generated PostScript file back to its originating order or request.\u003C\u002Fp>\n\n\u003Ch2>PHP Code Example for PDF to PostScript\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Utils;\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n\u002F* This sample converts PDF to PostScript through multipart \u002Fpostscript.\n * Pairing this endpoint with \u002Fpdf creates a PDF -> PostScript -> PDF workflow commonly\n * called PDF refrying. Some print and prepress workflows use it to rebuild, flatten, or\n * normalize page content, but the lossy roundtrip can discard PDF-specific features.\n * These settings request Level 3, text-safe output, all pages at original scale,\n * shrink-to-fit without rotation, and printable annotations.\n *\u002F\n$inputPath = '\u002Fpath\u002Fto\u002Fsample.pdf';\n$multipart = [\n  ['name' => 'file', 'contents' => Utils::tryFopen($inputPath, 'r'), 'filename' => basename($inputPath), 'headers' => ['Content-Type' => 'application\u002Fpdf']],\n  ['name' => 'ps_level', 'contents' => '3'],\n  ['name' => 'page_range', 'contents' => 'all'],\n  ['name' => 'binary_output', 'contents' => 'false'],\n  ['name' => 'scale', 'contents' => '1'],\n  ['name' => 'rotate', 'contents' => 'false'],\n  ['name' => 'shrink_to_fit', 'contents' => 'true'],\n  ['name' => 'print_annotations', 'contents' => 'true'],\n  ['name' => 'output', 'contents' => 'postscript_from_pdf'],\n];\n$response = (new Client())->post($apiUrl . '\u002Fpostscript', ['headers' => ['Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'Accept' => 'application\u002Fjson'], 'multipart' => $multipart]);\necho $response->getBody();\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpostscript.php\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Configure the service and input\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\u003C\u002Fpre>\n\n\u003Cp>For this PDF to PostScript example, PHP sends the multipart request to \u003Ccode>\u002Fpostscript\u003C\u002Fcode>. The PHP samples use Guzzle for HTTP and PSR-7 stream utilities for uploads. Install Guzzle with Composer when moving the code outside the repository, and provide the API key through protected runtime configuration. The sample’s placeholder path and API key make the moving pieces visible; replace them with a real local path and protected runtime credential before using the request.\u003C\u002Fp>\n\n\u003Ch3>Select PostScript Output Settings\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">$inputPath = '\u002Fpath\u002Fto\u002Fsample.pdf';\n$multipart = [\n  ['name' => 'file', 'contents' => Utils::tryFopen($inputPath, 'r'), 'filename' => basename($inputPath), 'headers' => ['Content-Type' => 'application\u002Fpdf']],\n  ['name' => 'ps_level', 'contents' => '3'],\n  ['name' => 'page_range', 'contents' => 'all'],\n  ['name' => 'binary_output', 'contents' => 'false'],\n  ['name' => 'scale', 'contents' => '1'],\n  ['name' => 'rotate', 'contents' => 'false'],\n  ['name' => 'shrink_to_fit', 'contents' => 'true'],\n  ['name' => 'print_annotations', 'contents' => 'true'],\n  ['name' => 'output', 'contents' => 'postscript_from_pdf'],\u003C\u002Fpre>\n\n\u003Cp>The PHP sample explicitly requests \u003Ccode>ps_level=3\u003C\u002Fcode>, all pages, binary output, no rotation, unit scale, shrink-to-fit, and printable annotations. Those choices describe the new PostScript result; they do not edit or replace the uploaded PDF.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">*\u002F\n$inputPath = '\u002Fpath\u002Fto\u002Fsample.pdf';\n$multipart = [\n  ['name' => 'file', 'contents' => Utils::tryFopen($inputPath, 'r'), 'filename' => basename($inputPath), 'headers' => ['Content-Type' => 'application\u002Fpdf']],\n  ['name' => 'ps_level', 'contents' => '3'],\n  ['name' => 'page_range', 'contents' => 'all'],\n  ['name' => 'binary_output', 'contents' => 'false'],\n  ['name' => 'scale', 'contents' => '1'],\n  ['name' => 'rotate', 'contents' => 'false'],\n  ['name' => 'shrink_to_fit', 'contents' => 'true'],\n  ['name' => 'print_annotations', 'contents' => 'true'],\u003C\u002Fpre>\n\n\u003Cp>For the PDF to PostScript form, guzzle accepts multipart fields as an array. Each entry names a field and supplies either stream content for a file or a simple string for an option, then Guzzle produces the correct multipart boundary.\u003C\u002Fp>\n\n\u003Ch3>Read the output resource\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">['name' => 'print_annotations', 'contents' => 'true'],\n  ['name' => 'output', 'contents' => 'postscript_from_pdf'],\n];\n$response = (new Client())->post($apiUrl . '\u002Fpostscript', ['headers' => ['Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'Accept' => 'application\u002Fjson'], 'multipart' => $multipart]);\necho $response->getBody();\u003C\u002Fpre>\n\n\u003Cp>After the PDF to PostScript call, the example prints Guzzle’s response body. A production caller can decode that JSON, retain \u003Ccode>outputId\u003C\u002Fcode>, and branch on an unsuccessful response instead of assuming every submitted conversion completed.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This PHP example submitted a PDF to \u003Ccode>\u002Fpostscript\u003C\u002Fcode> and selected the controls that shape the resulting PostScript file. Retain the returned resource ID whenever the output needs to be downloaded, monitored, or used by a following workflow step.\u003C\u002Fp>\n\n\u003Cp>Try representative pdf to postscript inputs in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the authoritative request fields, accepted values, and response contract, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">pdfRest API Reference Guide\u003C\u002Fa>. The same request pattern can then be adapted to your PHP application’s error handling, retention policy, and delivery workflow.\u003C\u002Fp>\n\n\u003Cp>For PHP applications that already hold the source as a managed resource, the repository includes a JSON-payload PDF-to-PostScript example. It uploads the PDF separately and sends the returned ID with the PostScript options. \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpostscript.php\">View the JSON-payload sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-02T21:53:53.000+00:00","Convert PDF documents to PostScript with PHP and configure page, scaling, annotation, and output settings.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-postscript-with-php\u002F#article\",\n      \"headline\": \"How to Convert PDF to PostScript with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-postscript-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-postscript-with-php\u002F\",\n      \"datePublished\": \"2026-09-03T17:04:37.000Z\",\n      \"dateModified\": \"2026-09-03T17:04:37.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert PDF documents to PostScript with PHP and configure page, scaling, annotation, and output settings.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to PostScript API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-postscript\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpostscript API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fpdf-to-postscript\u002FPOST\u002Fpostscript\u002F\"\n        }\n      ],\n      \"keywords\": \"Conversion, PHP, PostScript, PDF to PostScript\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PostScript with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-postscript-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6561,6562,6563,6564,6565,6566],{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2133,"name":2134,"slug":2135,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2185,"name":2186,"slug":2187,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-postscript-with-php\u002F","How to Convert PDF to PostScript with PHP | pdfRest",{"id":6571,"uuid":6572,"title":6573,"slug":6574,"html":6575,"comment_id":6571,"feature_image":48,"featured":284,"visibility":1257,"created_at":6557,"updated_at":6482,"published_at":6520,"custom_excerpt":6576,"codeinjection_head":6577,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6578,"primary_tag":6585,"url":6586,"excerpt":6576,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6587,"meta_description":6576,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a989af1d1b70dd2e2978a4c","e757448d-eca3-40b3-a106-c7c55e55b776","How to Convert PDF to PostScript with Python","how-to-convert-pdf-to-postscript-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This Python walkthrough uses \u003Ccode>requests\u003C\u002Fcode> and a multipart encoder. It converts a PDF into PostScript with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-postscript\u002F\">pdfRest PDF to PostScript API Tool\u003C\u002Fa>, using visible output controls for a production workflow. The complete sample is included below so Python developers can see the file handling, request construction, and response path together.\u003C\u002Fp>\n\n\u003Ch2>Why PDF to PostScript with Python?\u003C\u002Fh2>\n\n\u003Cp>Python services can generate PostScript when a specialized renderer or a legacy production stage expects that output even though the surrounding application manages PDF documents. The original PDF remains untouched while the API creates a new PostScript resource.\u003C\u002Fp>\n\n\u003Cp>A manufacturing-data pipeline could transform selected pages of an approved PDF into Level 3 PostScript with explicit scaling and annotation choices, then deliver the result to a system that does not consume PDF directly.\u003C\u002Fp>\n\n\u003Cp>The response gives Python a machine-readable output ID, allowing the pipeline to download the file, save it with job metadata, or carry it into another compatible API operation.\u003C\u002Fp>\n\n\u003Ch2>Python Code Example for PDF to PostScript\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">import json\nimport os\nimport requests\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# This sample converts PDF to PostScript through multipart \u002Fpostscript.\n# Pairing this endpoint with \u002Fpdf creates a PDF -> PostScript -> PDF workflow commonly\n# called PDF refrying. Some print and prepress workflows use it to rebuild, flatten, or\n# normalize page content, but the lossy roundtrip can discard PDF-specific features.\n# These settings request Level 3, text-safe output, all pages at original scale,\n# shrink-to-fit without rotation, and printable annotations.\ninput_path = \"\u002Fpath\u002Fto\u002Fsample.pdf\"\n\nfrom requests_toolbelt import MultipartEncoder\nwith open(input_path, \"rb\") as input_file:\n    fields = {\n        \"file\": (os.path.basename(input_path), input_file, \"application\u002Fpdf\"),\n        \"ps_level\": \"3\",\n        \"page_range\": \"all\",\n        \"binary_output\": \"false\",\n        \"scale\": \"1\",\n        \"rotate\": \"false\",\n        \"shrink_to_fit\": \"true\",\n        \"print_annotations\": \"true\",\n        \"output\": \"postscript_from_pdf\",\n    }\n    form = MultipartEncoder(fields=fields)\n    response = requests.post(api_url + \"\u002Fpostscript\", data=form, headers={\n        \"Accept\": \"application\u002Fjson\",\n        \"Content-Type\": form.content_type,\n        \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    })\n\nprint(\"Response status code: \" + str(response.status_code))\nif response.ok:\n    print(json.dumps(response.json(), indent=2))\nelse:\n    print(response.text)\n    raise SystemExit(1)\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpostscript.py\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Configure the service and input\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\"># By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>For this PDF to PostScript example, Python sends the multipart request to \u003Ccode>\u002Fpostscript\u003C\u002Fcode>. The Python samples use \u003Ccode>requests\u003C\u002Fcode> and \u003Ccode>MultipartEncoder\u003C\u002Fcode> from \u003Ccode>requests-toolbelt\u003C\u002Fcode>. Install both packages when using the file outside the samples project and keep the API key in environment configuration. The sample’s placeholder path and API key make the moving pieces visible; replace them with a real local path and protected runtime credential before using the request.\u003C\u002Fp>\n\n\u003Ch3>Select PostScript Output Settings\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\">with open(input_path, \"rb\") as input_file:\n    fields = {\n        \"file\": (os.path.basename(input_path), input_file, \"application\u002Fpdf\"),\n        \"ps_level\": \"3\",\n        \"page_range\": \"all\",\n        \"binary_output\": \"false\",\n        \"scale\": \"1\",\n        \"rotate\": \"false\",\n        \"shrink_to_fit\": \"true\",\n        \"print_annotations\": \"true\",\n        \"output\": \"postscript_from_pdf\",\u003C\u002Fpre>\n\n\u003Cp>The Python sample explicitly requests \u003Ccode>ps_level=3\u003C\u002Fcode>, all pages, binary output, no rotation, unit scale, shrink-to-fit, and printable annotations. Those choices describe the new PostScript result; they do not edit or replace the uploaded PDF.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\">input_path = \"\u002Fpath\u002Fto\u002Fsample.pdf\"\n\nfrom requests_toolbelt import MultipartEncoder\nwith open(input_path, \"rb\") as input_file:\n    fields = {\n        \"file\": (os.path.basename(input_path), input_file, \"application\u002Fpdf\"),\n        \"ps_level\": \"3\",\n        \"page_range\": \"all\",\n        \"binary_output\": \"false\",\n        \"scale\": \"1\",\n        \"rotate\": \"false\",\u003C\u002Fpre>\n\n\u003Cp>For the PDF to PostScript form, \u003Ccode>MultipartEncoder\u003C\u002Fcode> combines the file tuple and text fields, then exposes a \u003Ccode>content_type\u003C\u002Fcode> value that includes the generated boundary. That value must be used as the request header.\u003C\u002Fp>\n\n\u003Ch3>Read the output resource\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\">\"output\": \"postscript_from_pdf\",\n    }\n    form = MultipartEncoder(fields=fields)\n    response = requests.post(api_url + \"\u002Fpostscript\", data=form, headers={\n        \"Accept\": \"application\u002Fjson\",\n        \"Content-Type\": form.content_type,\n        \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    })\n\nprint(\"Response status code: \" + str(response.status_code))\nif response.ok:\n    print(json.dumps(response.json(), indent=2))\u003C\u002Fpre>\n\n\u003Cp>After the PDF to PostScript call, the sample prints formatted response JSON after a successful request and exits with an error after printing a failed response. Preserve the returned \u003Ccode>outputId\u003C\u002Fcode> when the next workflow step needs the generated resource.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This Python example submitted a PDF to \u003Ccode>\u002Fpostscript\u003C\u002Fcode> and selected the controls that shape the resulting PostScript file. Retain the returned resource ID whenever the output needs to be downloaded, monitored, or used by a following workflow step.\u003C\u002Fp>\n\n\u003Cp>Try representative pdf to postscript inputs in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the authoritative request fields, accepted values, and response contract, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">pdfRest API Reference Guide\u003C\u002Fa>. The same request pattern can then be adapted to your Python application’s error handling, retention policy, and delivery workflow.\u003C\u002Fp>\n\n\u003Cp>For Python applications that already hold the source as a managed resource, the repository includes a JSON-payload PDF-to-PostScript example. It uploads the PDF separately and sends the returned ID with the PostScript options. \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpostscript.py\">View the JSON-payload sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Convert PDF documents to PostScript with Python and configure page, scaling, annotation, and output settings.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-postscript-with-python\u002F#article\",\n      \"headline\": \"How to Convert PDF to PostScript with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-postscript-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-postscript-with-python\u002F\",\n      \"datePublished\": \"2026-09-03T17:04:37.000Z\",\n      \"dateModified\": \"2026-09-03T17:04:37.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert PDF documents to PostScript with Python and configure page, scaling, annotation, and output settings.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to PostScript API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-postscript\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpostscript API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fpdf-to-postscript\u002FPOST\u002Fpostscript\u002F\"\n        }\n      ],\n      \"keywords\": \"Conversion, PostScript, Python, PDF to PostScript\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PostScript with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-postscript-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6579,6580,6581,6582,6583,6584],{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2133,"name":2134,"slug":2135,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2185,"name":2186,"slug":2187,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-postscript-with-python\u002F","How to Convert PDF to PostScript with Python | pdfRest",{"id":6589,"uuid":6590,"title":6591,"slug":6592,"html":6593,"comment_id":6594,"feature_image":48,"featured":284,"visibility":1257,"created_at":6595,"updated_at":6461,"published_at":6595,"custom_excerpt":6596,"codeinjection_head":6597,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6598,"primary_tag":6605,"url":6606,"excerpt":6596,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6607,"meta_description":6608,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b136b","6ce42c79-2c60-499c-a0a5-619b44da01fd","How to Convert PDF to PowerPoint in .NET with C#","how-to-convert-pdf-to-powerpoint-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to PowerPoint with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-powerpoint\u002F'>PDF to PowerPoint API Tool\u003C\u002Fa> provides a simple way to convert PDF documents into PowerPoint presentations. This functionality is particularly useful for professionals who need to repurpose content from reports, brochures, or other PDF documents into a format suitable for presentations. For instance, a business analyst might want to quickly convert a PDF chart into a PowerPoint slide for an upcoming meeting.\u003C\u002Fp>\n\n\u003Cp>By using C# and the pdfRest API, this conversion can be automated, saving time and ensuring consistency across presentations. Read on to learn how.\u003C\u002Fp>\n\n\u003Ch2>PDF to PowerPoint with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"powerpoint\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpowerpoint.cs\">GitHub - pdfRest API Samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the C# Code\u003C\u002Fh2>\n\n\u003Cp>The code block above demonstrates how to make an API call to the pdfRest PDF to PowerPoint endpoint using C#. Let's break it down:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") };\n\u003C\u002Fpre>\n\n\u003Cp>This creates an instance of \u003Ccode>HttpClient\u003C\u002Fcode> and sets the base address for the API calls to the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var request = new HttpRequestMessage(HttpMethod.Post, \"powerpoint\");\n\u003C\u002Fpre>\n\n\u003Cp>A new \u003Ccode>HttpRequestMessage\u003C\u002Fcode> is created for making a POST request to the \"powerpoint\" endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>The API key is added to the request headers. Replace \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" with your actual API key provided by pdfRest.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n\u003C\u002Fpre>\n\n\u003Cp>A new \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> is created to hold the file content.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\u003C\u002Fpre>\n\n\u003Cp>The PDF file is read into a byte array, wrapped in a \u003Ccode>ByteArrayContent\u003C\u002Fcode> object, and added to the multipart content. The \"file_name\" should be replaced with the actual name of your PDF file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\n\u003C\u002Fpre>\n\n\u003Cp>The request is sent asynchronously, and the response is awaited.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>The content of the response is read as a string, which contains the result of the conversion.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you've learned how to call the pdfRest PDF to PowerPoint API using C#. This can be a powerful addition to your toolkit, automating the conversion of PDFs to PowerPoint format. You are encouraged to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for more details.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpowerpoint.cs\">GitHub - JSON Payload Examples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","658f2cc32d4014c9499b3c5c","2023-12-29T20:32:03.000+00:00","Learn how to use C# to call the PDF to PowerPoint API Tool from pdfRest and quickly turn your PDF formatted documents into PowerPoint files.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert PDF to PowerPoint in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-in-net-with-c\u002F\",\n      \"datePublished\": \"2023-12-29T20:32:03.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:56.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use C# to call the PDF to PowerPoint API Tool from pdfRest and quickly turn your PDF formatted documents into PowerPoint files.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to PowerPoint API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-powerpoint\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpowerpoint API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-microsoft-powerpoint\"\n        }\n      ],\n      \"keywords\": \".NET, Microsoft Office, PDF to PowerPoint, PowerPoint\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PowerPoint in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6599,6600,6601,6602,6603,6604],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1673,"name":1674,"slug":1675,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1657,"name":1658,"slug":1659,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-powerpoint-in-net-with-c\u002F","How to Convert PDF to PowerPoint in .NET with C#, Tutorial | pdfRest","Learn how to use C# to call the PDF to PointPoint API Tool from pdfRest and quickly turn your PDF formatted documents into PowerPoint files.",{"id":6610,"uuid":6611,"title":6612,"slug":6613,"html":6614,"comment_id":6610,"feature_image":48,"featured":284,"visibility":1257,"created_at":6615,"updated_at":6616,"published_at":6615,"custom_excerpt":6617,"codeinjection_head":6618,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6619,"primary_tag":6626,"url":6627,"excerpt":6617,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6628,"meta_description":6617,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65f08bd2533c9f26b9436a07","6d744374-da12-445a-bdf7-c41beff128a5","How to Convert PDF to PowerPoint with cURL","how-to-convert-pdf-to-powerpoint-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to PowerPoint with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-powerpoint\u002F'>PDF to PowerPoint API Tool\u003C\u002Fa> is a powerful service that allows users to convert PDF documents into editable PowerPoint presentations. This tool is particularly useful for professionals who need to repurpose content from PDFs into presentations for meetings, lectures, or other forms of sharing information. This tutorial will guide you through the process of sending an API call to the PDF to PowerPoint service using cURL, a versatile command-line tool used to transfer data with URLs.\u003C\u002Fp>\n\n\u003Cp>As an example, an educator might use PDF to PowerPoint to quickly convert their lecture notes from PDF into a PowerPoint presentation for an upcoming class. Similarly, a business professional might receive a PDF report and decide to convert it into a PowerPoint format to highlight key points during a meeting. The ability to automate this process through an API saves time and ensures consistency across documents.\u003C\u002Fp>\n\n\u003Ch2>PDF to PowerPoint with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpowerpoint\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>Reference to the code source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpowerpoint.sh\">pdfRest API Samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The above cURL command is used to send a POST request to the pdfRest API to convert a PDF document to a PowerPoint presentation. Let's break down the code snippet:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-X POST\n\u003C\u002Fpre>\n\n\u003Cp>This specifies the HTTP method for the request, which is POST in this case, indicating that data will be sent to the server.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">\"https:\u002F\u002Fapi.pdfrest.com\u002Fpowerpoint\"\n\u003C\u002Fpre>\n\n\u003Cp>This is the endpoint URL where the API call is made to perform the PDF to PowerPoint conversion.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\n\u003C\u002Fpre>\n\n\u003Cp>This header tells the server that the client expects a response in JSON format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\n\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the data being sent in the request is in multipart\u002Fform-data format, which is often used for file uploads.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>This header includes the API key provided by pdfRest, which is necessary for authentication and authorization.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\n\u003C\u002Fpre>\n\n\u003Cp>The -F flag is used to specify each field that will be sent as part of the multipart request. In this case, it's the file field, which contains the path to the PDF file that will be converted.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>This field specifies the desired output filename for the converted PowerPoint presentation.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you have learned how to make a multipart API call to convert a PDF document into a PowerPoint presentation using cURL. This can be a significant time-saver and can help streamline the process of content repurposing. To further explore the capabilities of pdfRest and to demo all of the API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information on the API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpowerpoint.sh\">pdfRest API Samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-12T17:07:30.000+00:00","2026-09-02T18:28:02.000+00:00","Learn how to use pdfRest PDF to PowerPoint API Tool to convert PDF files to PowerPoint presentations with cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-curl\u002F#article\",\n      \"headline\": \"How to Convert PDF to PowerPoint with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-curl\u002F\",\n      \"datePublished\": \"2024-03-12T17:07:30.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:39.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest PDF to PowerPoint API Tool to convert PDF files to PowerPoint presentations with cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to PowerPoint API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-powerpoint\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpowerpoint API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-microsoft-powerpoint\"\n        }\n      ],\n      \"keywords\": \"Microsoft Office, PDF to PowerPoint, PowerPoint, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PowerPoint with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6620,6621,6622,6623,6624,6625],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1673,"name":1674,"slug":1675,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1657,"name":1658,"slug":1659,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-powerpoint-with-curl\u002F","How to Convert PDF to PowerPoint with cURL, Tutorial | pdfRest",{"id":6630,"uuid":6631,"title":6632,"slug":6633,"html":6634,"comment_id":6630,"feature_image":48,"featured":284,"visibility":1257,"created_at":6635,"updated_at":6636,"published_at":6399,"custom_excerpt":6637,"codeinjection_head":6638,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6639,"primary_tag":6646,"url":6647,"excerpt":6637,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6648,"meta_description":6637,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c5b533c9f26b943b50d","1cf74a5b-95b1-4357-b2f1-78f6045a7bac","How to Convert PDF to PowerPoint with Java","how-to-convert-pdf-to-powerpoint-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>In this tutorial, we'll walk through how to convert PDF to PowerPoint with Java using the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-powerpoint\u002F\">PDF to PowerPoint API Tool\u003C\u002Fa>. The walkthrough posts a PDF to \u003Ccode>\u002Fpowerpoint\u003C\u002Fcode> and reads the editable presentation resource from the API response without local conversion software. You'll see how the request is assembled and how to work with the response returned when you convert PDF to PowerPoint.\u003C\u002Fp>\n\n\u003Ch2>Why Convert PDF to PowerPoint with Java?\u003C\u002Fh2>\n\n\u003Cp>A communications team may need to reuse material from an approved PDF in a new presentation. Automated conversion supplies a PowerPoint file that can be revised without rebuilding each slide manually.\u003C\u002Fp>\n\n\u003Cp>The Java client uploads the PDF to \u003Ccode>\u002Fpowerpoint\u003C\u002Fcode> and receives a presentation resource. Conversion quality depends on the structure and complexity of the source PDF.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONObject;\n\npublic class Powerpoint {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_powerpoint\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpowerpoint\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPowerpoint.java\">Java sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The import block combines OkHttp networking with dotenv configuration and \u003Ccode>org.json\u003C\u002Fcode> processing.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>The constants section separates file selection from authentication so either value can change without rewriting the request.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_powerpoint\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpowerpoint\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The Java client uploads the PDF to \u003Ccode>\u002Fpowerpoint\u003C\u002Fcode> and receives a presentation resource. Conversion quality depends on the structure and complexity of the source PDF. This payload builder uses the form multipart type required for combining uploaded content with operation parameters.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpowerpoint\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\u003C\u002Fpre>\n\n\u003Cp>The outbound call ties the body to its endpoint and applies the required \u003Ccode>Api-Key\u003C\u002Fcode> header before OkHttp sends it.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>The returned-data block uses both status and body to distinguish a successful resource from validation or processing failures.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we walked through how to convert PDF to PowerPoint with Java. With that foundation, you can apply this workflow when repurposing reports, handouts, and exported slide decks for new presentations.\u003C\u002Fp>\n\n\u003Cp>As you adapt this example for production, keep in mind that the generated presentation is an editable reconstruction, so complex diagrams, fonts, and page layouts may still need human review. Treat conversion as a starting point for reuse and compare important slides with the source before making further edits.\u003C\u002Fp>\n\n\u003Cp>To continue exploring the Convert PDF to PowerPoint operation, visit \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For complete request fields, defaults, and limitations, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-microsoft-powerpoint\u002F\">PDF to PowerPoint API Tool documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: The Convert PDF to PowerPoint example above uses multipart form data; when a prior API call returned the input ID, compare the multipart call with the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPowerpoint.java\">JSON payload example\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T17:33:15.000+00:00","2026-09-02T18:28:03.000+00:00","Convert a PDF into an editable PowerPoint presentation with Java.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-java\u002F#article\",\n      \"headline\": \"How to Convert PDF to PowerPoint with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:35.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:35.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert a PDF into an editable PowerPoint presentation with Java.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to PowerPoint API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-powerpoint\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpowerpoint API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-microsoft-powerpoint\"\n        }\n      ],\n      \"keywords\": \"Java, Microsoft Office, PDF to PowerPoint, PowerPoint\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PowerPoint with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6640,6641,6642,6643,6644,6645],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1673,"name":1674,"slug":1675,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1657,"name":1658,"slug":1659,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-powerpoint-with-java\u002F","Convert PDF to PowerPoint with Java | pdfRest",{"id":6650,"uuid":6651,"title":6652,"slug":6653,"html":6654,"comment_id":6655,"feature_image":48,"featured":284,"visibility":1257,"created_at":6656,"updated_at":6636,"published_at":6656,"custom_excerpt":6657,"codeinjection_head":6658,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6659,"primary_tag":6666,"url":6667,"excerpt":6657,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6668,"meta_description":6657,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b136c","d2d4d545-93f1-4d83-ae6d-ac60a009ecb1","How to Convert PDF to PowerPoint with JavaScript in NodeJS","how-to-convert-pdf-to-powerpoint-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to PowerPoint with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-powerpoint\u002F'>PDF to PowerPoint API Tool\u003C\u002Fa> provides a straightforward way to convert PDF documents into PowerPoint presentations. This functionality is particularly useful in scenarios where content originally in PDF format needs to be repurposed for presentations, lectures, or meetings. For instance, a user might have a report in PDF format that they want to present to their team, and converting it to a PowerPoint file would make it easier to showcase and discuss in a meeting.\u003C\u002Fp>\n\n\u003Cp>This tutorial will demonstrate how to send an API call to the PDF to PowerPoint tool using JavaScript, a popular programming language for web development.\u003C\u002Fp>\n\n\u003Ch2>PDF to PowerPoint with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to convert a PDF to a PowerPoint file.\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('output', 'pdfrest_powerpoint_pdf');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpowerpoint', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpowerpoint.js\">pdfRest API Samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the JavaScript Code\u003C\u002Fh2>\n\n\u003Cp>The code above is a complete example of how to make a multipart\u002Fform-data POST request to the pdfRest API to convert a PDF file to a PowerPoint presentation.\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Ccode>axios\u003C\u002Fcode> is a promise-based HTTP client for making HTTP requests.\u003C\u002Fli>\n\u003Cli>\u003Ccode>FormData\u003C\u002Fcode> is used to construct a set of key\u002Fvalue pairs representing form fields and their values, which are then sent with the HTTP request.\u003C\u002Fli>\n\u003Cli>\u003Ccode>fs\u003C\u002Fcode> (File System) is a Node.js module used to interact with the file system.\u003C\u002Fli>\n\u003Cli>The \u003Ccode>data.append()\u003C\u002Fcode> lines add the PDF file and output parameters to the form data.\u003C\u002Fli>\n\u003Cli>The \u003Ccode>config\u003C\u002Fcode> object contains the configuration for the axios request, including the API endpoint URL, headers, and the data payload.\u003C\u002Fli>\n\u003Cli>\u003Ccode>headers\u003C\u002Fcode> include the 'Api-Key' that should be replaced with your actual API key provided by pdfRest.\u003C\u002Fli>\n\u003Cli>The \u003Ccode>axios(config)\u003C\u002Fcode> line sends the POST request and handles the response or error.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>Each field and parameter in the API request is crucial:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Ccode>'file'\u003C\u002Fcode>: The PDF file you want to convert. The path should be replaced with the actual file path.\u003C\u002Fli>\n\u003Cli>\u003Ccode>'output'\u003C\u002Fcode>: The desired name for the output file.\u003C\u002Fli>\n\u003Cli>\u003Ccode>'Api-Key'\u003C\u002Fcode>: Your personal API key for authentication with the pdfRest service.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>Refer to the pdfRest Cloud API Reference Guide for further explanation of these parameters.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you have learned how to convert a PDF to a PowerPoint presentation using JavaScript and the pdfRest API. This can be a starting point to integrate PDF conversion features into your own applications.\u003C\u002Fp>\n\n\u003Cp>Feel free to demo all of the pdfRest API Tools in the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\u003C\u002Fa> and refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa> for more details.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpowerpoint.js\">pdfRest API Samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","658f2ce32d4014c9499b3c66","2023-12-29T20:32:35.000+00:00","Learn how to use JavaScript to call the PDF to PowerPoint API Tool from pdfRest and quickly turn your PDF formatted documents into PowerPoint files.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert PDF to PowerPoint with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2023-12-29T20:32:35.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:56.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use JavaScript to call the PDF to PowerPoint API Tool from pdfRest and quickly turn your PDF formatted documents into PowerPoint files.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to PowerPoint API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-powerpoint\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpowerpoint API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-microsoft-powerpoint\"\n        }\n      ],\n      \"keywords\": \"JavaScript, Microsoft Office, PDF to PowerPoint, PowerPoint\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PowerPoint with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6660,6661,6662,6663,6664,6665],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1673,"name":1674,"slug":1675,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1657,"name":1658,"slug":1659,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-powerpoint-with-javascript-in-nodejs\u002F","How to Convert PDF to PowerPoint with JavaScript in NodeJS, Tutorial | pdfRest",{"id":6670,"uuid":6671,"title":6672,"slug":6673,"html":6674,"comment_id":6675,"feature_image":48,"featured":284,"visibility":1257,"created_at":6676,"updated_at":6677,"published_at":6676,"custom_excerpt":6678,"codeinjection_head":6679,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6680,"primary_tag":6687,"url":6688,"excerpt":6678,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6689,"meta_description":6678,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b136a","a0083f9c-1587-400c-b454-b611a446e6cf","How to Convert PDF to PowerPoint with PHP","how-to-convert-pdf-to-powerpoint-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Cp>\n    The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-powerpoint\u002F'>PDF to PowerPoint API Tool\u003C\u002Fa> is a powerful service that allows developers to convert PDF documents into editable PowerPoint presentations. This is particularly useful in scenarios where you need to present data or reports that are originally in a PDF format in a more dynamic, editable format.\n\u003C\u002Fp>\n\n\u003Cp>\n    For instance, imagine you have a financial report in PDF that you want to discuss in a meeting. Using this API, you can quickly convert it to a PowerPoint presentation, allowing for easier navigation and the ability to highlight key points. This tutorial will guide you through the process of sending an API call to the PDF to PowerPoint endpoint using PHP.\n\u003C\u002Fp>\n\n\u003Ch2>PDF to PowerPoint with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">\nrequire 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => 'example.pdf',\n      'headers' => [\n        'Content-Type' => 'application\u002Fpdf'\n      ]\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_powerpoint'\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpowerpoint', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpowerpoint.php\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Understanding the Code\u003C\u002Fh2>\n\n\u003Cp>The PHP script above is a straightforward example of converting a PDF to a PowerPoint file using the pdfRest API. It is configured to send your PDF as a multipart request, specifying the desired output format.\u003C\u002Fp>\n\n\u003Cul>\n    \u003Cli>The \u003Ccode>'Api-Key'\u003C\u002Fcode> is required in the headers for authentication.\u003C\u002Fli>\n    \u003Cli>The \u003Ccode>'name' => 'file'\u003C\u002Fcode> part of the request handles the PDF document itself, with \u003Ccode>Utils::tryFopen\u003C\u002Fcode> opening the file from your server.\u003C\u002Fli>\n    \u003Cli>The crucial \u003Ccode>'name' => 'output'\u003C\u002Fcode> parameter is set to \u003Ccode>'pdfrest_powerpoint'\u003C\u002Fcode>, which explicitly tells the API to execute the PDF to PowerPoint conversion.\u003C\u002Fli>\n    \u003Cli>The request is sent to the \u003Ccode>https:\u002F\u002Fapi.pdfrest.com\u002Fpowerpoint\u003C\u002Fcode> endpoint, which is solely for this conversion task.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Frequently Asked Questions\u003C\u002Fh2>\n\n\u003Cp>Below are some common questions about converting PDFs to PowerPoint.\u003C\u002Fp>\n\n\u003Cdl>\n    \u003Cdt>Does the conversion maintain the original formatting and images?\u003C\u002Fdt>\n    \u003Cdd>The conversion strives to maintain the original layout as closely as possible, including text, fonts, and images. However, due to the different nature of PDF and PowerPoint formats, some minor adjustments may be needed to achieve a pixel-perfect result. \u003C\u002Fdd>\n\n    \u003Cdt>What happens to complex PDF elements like tables or charts?\u003C\u002Fdt>\n    \u003Cdd>The API will convert tables, charts, and other graphical elements from the PDF and place them as editable objects within the PowerPoint file. The goal is to provide a fully editable presentation rather than just a static image.\u003C\u002Fdd>\n\n    \u003Cdt>Can I convert a password-protected PDF?\u003C\u002Fdt>\n    \u003Cdd>The PDF to PowerPoint API Tool cannot directly process a password-protected document. To convert a protected PDF, you must first remove the password using the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\">Encrypt PDF API Tool\u003C\u002Fa>, which supports adding and removing passwords.\u003C\u002Fdd>\n\u003C\u002Fdl>\n\n\n\u003Ch2>What's Next?\u003C\u002Fh2>\n\n\u003Cp>You have now successfully converted a PDF to an editable PowerPoint presentation using PHP. This functionality can be a great asset in automating document workflows within your applications. You are encouraged to explore all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for more details on how to use the various features provided by the service.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","658f2c552d4014c9499b3c52","2023-12-29T20:30:13.000+00:00","2026-09-02T18:28:04.000+00:00","Learn how to use PHP to call the PDF to PowerPoint API Tool from pdfRest and quickly turn your PDF formatted documents into PowerPoint files.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-php\u002F#article\",\n      \"headline\": \"How to Convert PDF to PowerPoint with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-php\u002F\",\n      \"datePublished\": \"2023-12-29T20:30:13.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:56.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use PHP to call the PDF to PowerPoint API Tool from pdfRest and quickly turn your PDF formatted documents into PowerPoint files.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Encrypt PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fencrypted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fencrypt-pdf\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to PowerPoint API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-powerpoint\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpowerpoint API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-microsoft-powerpoint\"\n        }\n      ],\n      \"keywords\": \"Microsoft Office, PDF to PowerPoint, PHP, PowerPoint\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PowerPoint with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6681,6682,6683,6684,6685,6686],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1673,"name":1674,"slug":1675,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1657,"name":1658,"slug":1659,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-powerpoint-with-php\u002F","How to Convert PDF Files to Powerpoint with PHP, Tutorial | pdfRest",{"id":6691,"uuid":6692,"title":6693,"slug":6694,"html":6695,"comment_id":6696,"feature_image":48,"featured":284,"visibility":1257,"created_at":6697,"updated_at":6677,"published_at":6698,"custom_excerpt":6699,"codeinjection_head":6700,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6701,"primary_tag":6708,"url":6709,"excerpt":6699,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6710,"meta_description":6699,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1369","e1fafcfd-a6cf-4d3e-9a68-6b424dd07a31","How to Convert PDF to PowerPoint with Python","how-to-convert-pdf-to-powerpoint-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to PowerPoint with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-powerpoint\u002F'>PDF to PowerPoint API Tool\u003C\u002Fa> allows users to convert PDF documents into PowerPoint presentations programmatically. This is particularly useful for professionals who need to quickly turn reports, charts, or any other PDF content into slides for presentations. For instance, a financial analyst might convert a PDF report into a PowerPoint to present findings to stakeholders.\u003C\u002Fp>\n\n\u003Cp>This tutorial will guide you through the process of sending an API call to the PDF to PowerPoint API tool using Python, enabling you to automate document conversions within your applications or workflows.\u003C\u002Fp>\n\n\u003Ch2>PDF to PowerPoint with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\npowerpoint_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpowerpoint'\n\n# The \u002Fpowerpoint endpoint can take a single PDF file or id as input.\n# This sample demonstrates converting a PDF to a PowerPoint document.\nmp_encoder_powerpoint = MultipartEncoder(\n    fields={\n        'file': ('file_name', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_powerpoint_out',\n    }\n)\n\n# Let's set the headers that the PowerPoint endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_powerpoint.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to powerpoint endpoint...\")\nresponse = requests.post(powerpoint_endpoint_url, data=mp_encoder_powerpoint, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpowerpoint.py\">pdf-rest-api-samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Python Code\u003C\u002Fh2>\n\n\u003Cp>The provided code snippet demonstrates how to use the PDF to PowerPoint API tool with Python:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\u003C\u002Fpre>\n\n\u003Cp>These lines import the necessary Python libraries. \u003Ccode>MultipartEncoder\u003C\u002Fcode> is used for creating multipart\u002Fform-data payloads, \u003Ccode>requests\u003C\u002Fcode> for making HTTP requests, and \u003Ccode>json\u003C\u002Fcode> for handling JSON data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_powerpoint = MultipartEncoder(\n    fields={\n        'file': ('file_name', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_powerpoint_out',\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>This code initializes a \u003Ccode>MultipartEncoder\u003C\u002Fcode> with the PDF file to be converted and the desired output file name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_powerpoint.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\u003C\u002Fpre>\n\n\u003Cp>Headers are set for the HTTP request, including the API key for authentication (replace 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' with your actual API key).\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(powerpoint_endpoint_url, data=mp_encoder_powerpoint, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>requests.post\u003C\u002Fcode> function sends the POST request to the API endpoint with the prepared data and headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>The response is checked for success. If successful, the JSON response is printed; otherwise, the error text is displayed.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you've learned how to convert a PDF to a PowerPoint presentation using the pdfRest API with Python. By sending a multipart\u002Fform-data request, the API processes the PDF file and returns a JSON response with information about the converted PowerPoint file.\u003C\u002Fp>\n\n\u003Cp>To explore all of the pdfRest API Tools, you can demo them in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information and additional endpoints, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpowerpoint.py\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","658f2c402d4014c9499b3c48","2023-12-29T20:29:52.000+00:00","2023-12-29T20:29:53.000+00:00","Learn how to use Python to call the PDF to PowerPoint API Tool from pdfRest and quickly turn your PDF formatted documents into PowerPoint files.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-python\u002F#article\",\n      \"headline\": \"How to Convert PDF to PowerPoint with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-python\u002F\",\n      \"datePublished\": \"2023-12-29T20:29:53.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:56.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use Python to call the PDF to PowerPoint API Tool from pdfRest and quickly turn your PDF formatted documents into PowerPoint files.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to PowerPoint API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-powerpoint\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpowerpoint API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-microsoft-powerpoint\"\n        }\n      ],\n      \"keywords\": \"Microsoft Office, PDF to PowerPoint, PowerPoint, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to PowerPoint with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-powerpoint-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6702,6703,6704,6705,6706,6707],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1673,"name":1674,"slug":1675,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1657,"name":1658,"slug":1659,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-powerpoint-with-python\u002F","How to Convert a PDF to PowerPoint with Python, Tutorial | pdfRest",{"id":6712,"uuid":6713,"title":6714,"slug":6715,"html":6716,"comment_id":6712,"feature_image":48,"featured":284,"visibility":1257,"created_at":6717,"updated_at":6718,"published_at":6717,"custom_excerpt":6719,"codeinjection_head":6720,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6721,"primary_tag":6729,"url":6730,"excerpt":6719,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6731,"meta_description":6719,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"667f2b42533c9f26b9437d64","b2ae678e-b8fa-4de4-a505-70b6423a1ba2","How to Convert PDF to TIFF in .NET with C#","how-to-convert-pdf-to-tiff-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to TIFF with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest PDF to Images API Tool offers a seamless way to convert PDF documents into image formats such as TIFF. This tutorial will guide you through the process of sending an API call to the PDF to Images endpoint using C#. By following this tutorial, you will learn how to interact with the pdfRest API and convert your PDF files into images programmatically.\u003C\u002Fp>\n\n\u003Cp>Imagine you are working in a legal firm that needs to convert large volumes of PDF documents into TIFF images for archiving purposes. Using the PDF to Images API, you can automate this process, saving time and reducing the risk of errors associated with manual conversion. This can be particularly useful for ensuring that documents are stored in a consistent format that is suitable for long-term preservation.\u003C\u002Fp>\n\n\u003Ch2>PDF to TIFF with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"tif\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Ftif.cs\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>Let's break down the code to understand how it works:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>This line initializes a new instance of \u003Ccode>HttpClient\u003C\u002Fcode> with the base address set to the pdfRest API endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var request = new HttpRequestMessage(HttpMethod.Post, \"tif\"))\n\u003C\u002Fpre>\n\n\u003Cp>A new \u003Ccode>HttpRequestMessage\u003C\u002Fcode> is created with the HTTP method set to POST and the endpoint set to \"tif\". This specifies that we are making a POST request to the PDF to Images API endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\nrequest.Headers.Accept.Add(new(\"application\u002Fjson\"));\n\u003C\u002Fpre>\n\n\u003Cp>These lines add headers to the request. The \u003Ccode>Api-Key\u003C\u002Fcode> header is used for authentication, and the \u003Ccode>Accept\u003C\u002Fcode> header specifies that the client expects a JSON response.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n\u003C\u002Fpre>\n\n\u003Cp>A new instance of \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> is created to hold the multipart form data content of the request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\u003C\u002Fpre>\n\n\u003Cp>These lines read the PDF file into a byte array and create a \u003Ccode>ByteArrayContent\u003C\u002Fcode> object from it. The file content is then added to the \u003Ccode>multipartContent\u003C\u002Fcode> with the name \"file\" and the filename \"file_name\". The \u003Ccode>Content-Type\u003C\u002Fcode> header is set to \"application\u002Fpdf\".\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Content = multipartContent;\nvar response = await httpClient.SendAsync(request);\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>multipartContent\u003C\u002Fcode> is set as the content of the request, and the request is sent asynchronously using \u003Ccode>httpClient.SendAsync\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiResult = await response.Content.ReadAsStringAsync();\nConsole.WriteLine(\"API response received.\");\nConsole.WriteLine(apiResult);\n\u003C\u002Fpre>\n\n\u003Cp>The response content is read as a string and printed to the console.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to send an API call to the pdfRest PDF to Images endpoint using C#. This example demonstrated how to set up the request, add necessary headers, and handle the response.\u003C\u002Fp>\n\n\u003Cp>To explore more functionalities of the pdfRest API, you can try out different API tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on all available endpoints and parameters, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Ftif.cs\">here\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-06-28T21:29:38.000+00:00","2026-09-02T18:28:05.000+00:00","Learn how to use pdfRest PDF to Images to convert PDF pages to TIFF images with C#","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert PDF to TIFF in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-06-28T21:29:38.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:28.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest PDF to Images to convert PDF pages to TIFF images with C#\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Ftif API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\"\n        }\n      ],\n      \"keywords\": \".NET, Conversion, Convert, PDF to Images, TIFF\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to TIFF in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6722,6723,6724,6725,6726,6727,6728],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1538,"name":1539,"slug":1540,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1554,"name":1555,"slug":1556,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-tiff-in-net-with-c\u002F","How to Convert PDF to TIFF in .NET with C#, Tutorial | pdfRest",{"id":6733,"uuid":6734,"title":6735,"slug":6736,"html":6737,"comment_id":6733,"feature_image":48,"featured":284,"visibility":1257,"created_at":6738,"updated_at":6718,"published_at":6738,"custom_excerpt":6739,"codeinjection_head":6740,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6741,"primary_tag":6749,"url":6750,"excerpt":6739,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6751,"meta_description":6739,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"667f2b89533c9f26b9437d6e","a4d7ac33-06bb-482d-a56b-44a2157b5781","How to Convert PDF to TIFF with cURL","how-to-convert-pdf-to-tiff-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to TIFF with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest PDF to Images API Tool provides a simple and efficient way to convert PDF files into image formats. This tutorial will guide you through the process of sending an API call to the PDF to Images endpoint using cURL, a command-line tool for transferring data with URLs.\u003C\u002Fp>\n\n\u003Cp>Imagine you are a developer working on an application that needs to display PDF content as images, such as a document viewer or an e-book reader. Converting PDFs to images can make it easier to render and manipulate the content, especially on platforms that may not support PDF rendering natively. This is where the PDF to Images API tool comes in handy.\u003C\u002Fp>\n\n\u003Ch2>PDF to TIFF with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Ftif\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Ftif.sh\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>Let's break down the provided cURL command to understand how it works:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Ftif\"\u003C\u002Fpre>\n\n\u003Cp>This line specifies the HTTP method (POST) and the URL of the PDF to Images endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\u003C\u002Fpre>\n\n\u003Cp>This header tells the server that the client expects a JSON response.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the request body will contain multipart form data, which is necessary for file uploads.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\u003C\u002Fpre>\n\n\u003Cp>This header includes your API key, which is required for authentication. Replace \u003Ccode>xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\u003C\u002Fcode> with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\u003C\u002Fpre>\n\n\u003Cp>This option specifies the file to be uploaded. Replace \u003Ccode>\u002Fpath\u002Fto\u002Ffile\u003C\u002Fcode> with the actual path to your PDF file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\u003C\u002Fpre>\n\n\u003Cp>This option specifies the desired output format or filename. In this case, \u003Ccode>example_out\u003C\u002Fcode> is used as an example.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use cURL to send an API call to the pdfRest PDF to Images endpoint. This is a powerful tool for converting PDFs to images, which can be useful in various applications.\u003C\u002Fp>\n\n\u003Cp>To explore more features and tools provided by pdfRest, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on all available API endpoints and parameters, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Ftif.sh\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-06-28T21:30:49.000+00:00","Learn how to convert PDF pages to TIFF images with pdfRest PDF to Images API tool and cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-curl\u002F#article\",\n      \"headline\": \"How to Convert PDF to TIFF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-curl\u002F\",\n      \"datePublished\": \"2024-06-28T21:30:49.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:28.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert PDF pages to TIFF images with pdfRest PDF to Images API tool and cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Ftif API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert, PDF to Images, TIFF, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to TIFF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6742,6743,6744,6745,6746,6747,6748],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1538,"name":1539,"slug":1540,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1554,"name":1555,"slug":1556,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-tiff-with-curl\u002F","How to Convert PDF to TIFF with cURL, Tutorial | pdfRest",{"id":6753,"uuid":6754,"title":6755,"slug":6756,"html":6757,"comment_id":6753,"feature_image":48,"featured":284,"visibility":1257,"created_at":6635,"updated_at":6758,"published_at":6759,"custom_excerpt":6760,"codeinjection_head":6761,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6762,"primary_tag":6770,"url":6771,"excerpt":6760,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6772,"meta_description":6760,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c5b533c9f26b943b518","7146cc3e-c5ed-4550-8134-96d50fc4e2cf","How to Convert PDF to TIFF with Java","how-to-convert-pdf-to-tiff-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This tutorial shows you how to convert PDF to TIFF from a Java application with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\">PDF to Images API Tool\u003C\u002Fa>. The request applies page, resolution, and color choices while rendering the PDF through the \u003Ccode>\u002Ftif\u003C\u002Fcode> endpoint and returning each image resource. The walkthrough gives you a practical starting point that you can adapt when you need to convert PDF to TIFF in your own document workflow.\u003C\u002Fp>\n\n\u003Ch2>Why Convert PDF to TIFF with Java?\u003C\u002Fh2>\n\n\u003Cp>Many records, fax, and scanning systems use TIFF as their interchange format. Converting a PDF allows a Java service to feed those systems without requiring operators to rasterize pages manually.\u003C\u002Fp>\n\n\u003Cp>The sample calls \u003Ccode>\u002Ftif\u003C\u002Fcode> with the PDF and image options. Depending on the request, page output may be represented as separate images or a multi-page TIFF resource.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class Tif {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_tif\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Ftif\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FTif.java\">Java sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>This dependency set relies on OkHttp to send the call, dotenv to resolve credentials, and \u003Ccode>org.json\u003C\u002Fcode> to inspect or format JSON.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>The startup code supports quick local testing while allowing normal callers to provide their own path and \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_tif\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Ftif\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The sample calls \u003Ccode>\u002Ftif\u003C\u002Fcode> with the PDF and image options. Depending on the request, page output may be represented as separate images or a multi-page TIFF resource. The multipart section collects the named parts before OkHttp calculates the final multipart header and body encoding.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Ftif\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The request builder joins authentication, routing, and payload in one place while leaving regional service selection in the API URL constant.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>The response block makes success and failure information available to the caller, including any temporary resources that must be saved or reused before expiration.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You have now seen how to convert PDF to TIFF from a Java application. With that foundation, tIFF conversion supports scanning archives, fax integrations, records ingestion, and high-quality raster preservation.\u003C\u002Fp>\n\n\u003Cp>When you move beyond the sample, select resolution and color settings according to the imaging, records, or fax system that will consume the output. For long PDFs, confirm page order and output packaging with representative files before automating ingestion at scale.\u003C\u002Fp>\n\n\u003Cp>You can experiment with the Convert PDF to TIFF operation in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. The \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\u002F\">PDF to Images API Tool documentation\u003C\u002Fa> describes the full parameter and response contract.\u003C\u002Fp>\n\n\u003Cp>Note: The Convert PDF to TIFF example above uses multipart form data; to avoid transferring the same input again, review how the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FTif.java\">JSON payload example\u003C\u002Fa> constructs the request.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-02T18:28:06.000+00:00","2026-09-01T21:57:36.000+00:00","Render PDF pages as TIFF images with Java for document-imaging workflows.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-java\u002F#article\",\n      \"headline\": \"How to Convert PDF to TIFF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:36.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:36.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Render PDF pages as TIFF images with Java for document-imaging workflows.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Ftif API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert, Java, PDF to Images, TIFF\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to TIFF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6763,6764,6765,6766,6767,6768,6769],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1538,"name":1539,"slug":1540,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1554,"name":1555,"slug":1556,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-tiff-with-java\u002F","Convert PDF to TIFF with Java | pdfRest",{"id":6774,"uuid":6775,"title":6776,"slug":6777,"html":6778,"comment_id":6774,"feature_image":48,"featured":284,"visibility":1257,"created_at":6779,"updated_at":6758,"published_at":6779,"custom_excerpt":6780,"codeinjection_head":6781,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6782,"primary_tag":6790,"url":6791,"excerpt":6780,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6792,"meta_description":6780,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"667f2bdc533c9f26b9437d78","7aabf094-391d-4f68-9585-4db8e389bd1f","How to Convert PDF to TIFF with JavaScript in NodeJS","how-to-convert-pdf-to-tiff-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to TIFF with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest PDF to Images API Tool is a powerful resource that allows developers to convert PDF documents into image files, such as TIF, using JavaScript. This tutorial will guide you through the process of sending an API call to convert a PDF to images using JavaScript.\u003C\u002Fp>\n\n\u003Cp>Imagine you have a PDF document containing multiple pages of scanned text, and you need to extract each page as a separate image file for further processing or analysis. By using the PDF to Images API, you can automate this task, saving time and reducing the risk of manual errors.\u003C\u002Fp>\n\n\u003Ch2>PDF to TIFF with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to convert a PDF into TIF image files, one per PDF page.\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile')); \ndata.append('pages', '1-last');\ndata.append('resolution', '300');\ndata.append('color_model', 'rgb');\ndata.append('output', 'pdfrest_tif');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Ftif', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Ftif.js\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>Let's break down the provided code to understand how it works:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\u003C\u002Fpre>\n\n\u003Cp>This line imports the Axios library, which is used to make HTTP requests.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var FormData = require('form-data');\u003C\u002Fpre>\n\n\u003Cp>This line imports the FormData library, which is used to construct form data for the request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var fs = require('fs');\u003C\u002Fpre>\n\n\u003Cp>This line imports the fs (file system) module, which is used to read files from the local file system.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile')); \ndata.append('pages', '1-last');\ndata.append('resolution', '300');\ndata.append('color_model', 'rgb');\ndata.append('output', 'pdfrest_tif');\u003C\u002Fpre>\n\n\u003Cp>Here, a new FormData instance is created, and the required parameters are appended to it:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Ccode>file\u003C\u002Fcode>: The PDF file to be converted, read from the local file system.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>pages\u003C\u002Fcode>: Specifies the range of pages to convert. '1-last' means all pages from the first to the last.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>resolution\u003C\u002Fcode>: The resolution of the output images, set to 300 DPI.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>color_model\u003C\u002Fcode>: The color model of the output images, set to RGB.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>output\u003C\u002Fcode>: The prefix for the output file names.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity, \n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Ftif', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \n    ...data.getHeaders() \n  },\n  data : data \n};\u003C\u002Fpre>\n\n\u003Cp>This section defines the configuration for the Axios request:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Ccode>method\u003C\u002Fcode>: The HTTP method, set to 'post'.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>maxBodyLength\u003C\u002Fcode>: Sets the maximum length of the request body to Infinity.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>url\u003C\u002Fcode>: The API endpoint URL.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>headers\u003C\u002Fcode>: Includes the API key and headers from the FormData instance.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>data\u003C\u002Fcode>: The form data to be sent with the request.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\u003C\u002Fpre>\n\n\u003Cp>This section sends the request using Axios and handles the response or any errors. The response data is logged to the console in JSON format.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use JavaScript to send an API call to the pdfRest PDF to Images API Tool, converting a PDF document into TIF image files.\u003C\u002Fp>\n\n\u003Cp>To explore more pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information about each API endpoint, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Ftif.js\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-06-28T21:32:12.000+00:00","Learn how to convert PDF to TIFF using pdfRest PDF to Images API tool with JavaScript","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert PDF to TIFF with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-06-28T21:32:12.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:28.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert PDF to TIFF using pdfRest PDF to Images API tool with JavaScript\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Ftif API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert, JavaScript, PDF to Images, TIFF\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to TIFF with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6783,6784,6785,6786,6787,6788,6789],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1538,"name":1539,"slug":1540,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1554,"name":1555,"slug":1556,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-tiff-with-javascript-in-nodejs\u002F","How to Convert PDF to TIFF with JavaScript in NodeJS, Tutorial | pdfRest",{"id":6794,"uuid":6795,"title":6796,"slug":6797,"html":6798,"comment_id":6794,"feature_image":48,"featured":284,"visibility":1257,"created_at":6799,"updated_at":6758,"published_at":6799,"custom_excerpt":6800,"codeinjection_head":6801,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6802,"primary_tag":6810,"url":6811,"excerpt":6800,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6812,"meta_description":6800,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"667f2c44533c9f26b9437d82","93cae687-3a7c-4f0e-9743-59f55bda05c9","How to Convert PDF to TIFF with PHP","how-to-convert-pdf-to-tiff-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to TIFF with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest PDF to Images API Tool allows developers to convert PDF documents into image formats like TIF, PNG, or JPEG. This tutorial will show how to send an API call to PDF to Images with PHP, leveraging the Guzzle HTTP client to handle the request and response.\u003C\u002Fp>\n\n\u003Cp>Imagine you have a web application that processes PDF documents and needs to display individual pages as images for better user interaction. By converting PDF pages to images, you can easily integrate these images into your web pages, making them more accessible and user-friendly. This is particularly useful for applications like document management systems, online libraries, or any service that requires visual representation of PDF content.\u003C\u002Fp>\n\n\u003Ch2>PDF to TIFF with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">\nrequire 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\n$headers = [\n  'Api-Key' =--> 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile', \u002F\u002F Set the filename for the file to be converted, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'pages', \u002F\u002F Specify the field name for the pages option.\n      'contents' => '1-last' \u002F\u002F Set the value for the pages option (in this case, '1-last').\n    ],\n    [\n      'name' => 'resolution', \u002F\u002F Specify the field name for the resolution option.\n      'contents' => '300' \u002F\u002F Set the value for the resolution option (in this case, '300').\n    ],\n    [\n      'name' => 'color_model', \u002F\u002F Specify the field name for the color_model option.\n      'contents' => 'rgb' \u002F\u002F Set the value for the color_model option (in this case, 'rgb').\n    ],\n    [\n      'name' => 'output', \u002F\u002F Specify the field name for the output option.\n      'contents' => 'pdfrest_tif' \u002F\u002F Set the value for the output option (in this case, 'pdfrest_tif').\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Ftif', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the converted TIF image.\n\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Ftif.php\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>\u003C\u002Fp>\n\u003Cpre class=\"language-python\">require 'vendor\u002Fautoload.php';\u003C\u002Fpre>\n\n\u003Cp>\u003C\u002Fp>\n\n\u003Cp>\u003C\u002Fp>\n\u003Cpre class=\"language-python\">use GuzzleHttp\\Client;\u003C\u002Fpre>\n\n\u003Cp>\u003C\u002Fp>\n\n\u003Cp>\u003C\u002Fp>\n\u003Cpre class=\"language-python\">use GuzzleHttp\\Psr7\\Request;\u003C\u002Fpre>\n\n\u003Cp>\u003C\u002Fp>\n\n\u003Cp>\u003C\u002Fp>\n\u003Cpre class=\"language-python\">use GuzzleHttp\\Psr7\\Utils;\u003C\u002Fpre>\n\n\u003Cp>\u003C\u002Fp>\n\n\u003Cp>\u003C\u002Fp>\n\u003Cpre class=\"language-python\">$client = new Client();\u003C\u002Fpre>\n\n\u003Cp>\u003C\u002Fp>\n\n\u003Cp>\u003C\u002Fp>\n\u003Cpre class=\"language-python\">$headers = ['Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'];\u003C\u002Fpre>\n\n\u003Cp>\u003C\u002Fp>\n\n\u003Cp>\u003C\u002Fp>\n\u003Cpre class=\"language-python\">$options = ['multipart' => [...]];\u003C\u002Fpre>\n\n\u003Cp>\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Cpre class=\"language-python\">['name' => 'file', 'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), 'filename' => '\u002Fpath\u002Fto\u002Ffile', 'headers' => ['Content-Type' => '\u003Ccontent-type header=\"\">']]\u003C\u002Fcontent-type>\u003C\u002Fpre> This specifies the file to be uploaded. Replace '\u002Fpath\u002Fto\u002Ffile' with the actual file path and '\u003Ccontent-type header=\"\">' with the appropriate content type.\u003C\u002Fcontent-type>\u003C\u002Fli>\n  \u003Cli>\u003Cpre class=\"language-python\">['name' => 'pages', 'contents' => '1-last']\u003C\u002Fpre> This specifies the range of pages to convert. '1-last' means all pages.\u003C\u002Fli>\n  \u003Cli>\u003Cpre class=\"language-python\">['name' => 'resolution', 'contents' => '300']\u003C\u002Fpre> This sets the resolution of the output images to 300 DPI.\u003C\u002Fli>\n  \u003Cli>\u003Cpre class=\"language-python\">['name' => 'color_model', 'contents' => 'rgb']\u003C\u002Fpre> This sets the color model of the output images to RGB.\u003C\u002Fli>\n  \u003Cli>\u003Cpre class=\"language-python\">['name' => 'output', 'contents' => 'pdfrest_tif']\u003C\u002Fpre> This specifies the output format, which is TIF in this case.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>\u003C\u002Fp>\n\u003Cpre class=\"language-python\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Ftif', $headers);\u003C\u002Fpre>\n\n\u003Cp>\u003C\u002Fp>\n\n\u003Cp>\u003C\u002Fp>\n\u003Cpre class=\"language-python\">$res = $client->sendAsync($request, $options)->wait();\u003C\u002Fpre>\n\n\u003Cp>\u003C\u002Fp>\n\n\u003Cp>\u003C\u002Fp>\n\u003Cpre class=\"language-python\">echo $res->getBody();\u003C\u002Fpre>\n\n\u003Cp>\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we demonstrated how to use PHP and the Guzzle HTTP client to send a request to the pdfRest PDF to Images API Tool and convert a PDF document to TIF images. This process can be adapted to handle other image formats and additional options provided by the API.\u003C\u002Fp>\n\n\u003Cp>We encourage you to explore all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. Note that this example uses a multipart API call, and code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Ftif.php\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-06-28T21:33:56.000+00:00","Learn how to convert PDF pages to TIFF images using pdfRest PDF to Images API tool with PHP","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-php\u002F#article\",\n      \"headline\": \"How to Convert PDF to TIFF with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-php\u002F\",\n      \"datePublished\": \"2024-06-28T21:33:56.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:28.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert PDF pages to TIFF images using pdfRest PDF to Images API tool with PHP\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Ftif API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert, PDF to Images, PHP, TIFF\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to TIFF with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6803,6804,6805,6806,6807,6808,6809],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1538,"name":1539,"slug":1540,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1554,"name":1555,"slug":1556,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-tiff-with-php\u002F","How to Convert PDF to TIFF with PHP, Tutorial | pdfRest",{"id":6814,"uuid":6815,"title":6816,"slug":6817,"html":6818,"comment_id":6814,"feature_image":48,"featured":284,"visibility":1257,"created_at":6819,"updated_at":6820,"published_at":6819,"custom_excerpt":6821,"codeinjection_head":6822,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6823,"primary_tag":6831,"url":6832,"excerpt":6821,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6833,"meta_description":6821,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"667f2c8b533c9f26b9437d8c","70b0114c-c97f-44b8-96f8-5f0df8110618","How to Convert PDF to TIFF with Python","how-to-convert-pdf-to-tiff-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to TIFF with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest PDF to Images API Tool is a powerful resource that allows users to convert PDF files into image formats such as TIFF. This tutorial will show you how to send an API call to the PDF to Images endpoint using Python, enabling you to automate the conversion process easily.\u003C\u002Fp>\n\n\u003Cp>Imagine you are working in a document management system where you need to archive PDFs as images for better compatibility with various systems and devices. Converting PDFs to TIFF images can be particularly useful for creating high-quality, high-resolution images suitable for printing or archiving.\u003C\u002Fp>\n\n\u003Ch2>PDF to TIFF with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\ntif_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Ftif'\n\n# The \u002Ftif endpoint can take a single PDF file or id as input and turn them into TIFF image files.\n# This sample takes in a PDF and converts all pages into grayscale TIFF files.\nmp_encoder_tif = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'pages': '1-last',\n        'resolution': '600',\n        'color_model': 'gray',\n        'output' : 'example_tif_out',\n    }\n)\n\n# Let's set the headers that the tif endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_tif.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to tif endpoint...\")\nresponse = requests.post(tif_endpoint_url, data=mp_encoder_tif, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Ftif.py\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>Let's break down the code to understand how it works:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\u003C\u002Fpre>\n\n\u003Cp>We start by importing the necessary libraries. \u003Ccode>requests_toolbelt\u003C\u002Fcode> is used to handle multipart form data, \u003Ccode>requests\u003C\u002Fcode> is used to send HTTP requests, and \u003Ccode>json\u003C\u002Fcode> is used to handle JSON data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">tif_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Ftif'\n\u003C\u002Fpre>\n\n\u003Cp>This line sets the URL for the PDF to Images endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_tif = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'pages': '1-last',\n        'resolution': '600',\n        'color_model': 'gray',\n        'output' : 'example_tif_out',\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>Here, we create a \u003Ccode>MultipartEncoder\u003C\u002Fcode> instance to handle the multipart form data. The fields include:\u003C\u002Fp>\n\n\u003Cul>\n    \u003Cli>\u003Ccode>'file'\u003C\u002Fcode>: The PDF file to be converted.\u003C\u002Fli>\n    \u003Cli>\u003Ccode>'pages'\u003C\u002Fcode>: Specifies the range of pages to convert, from the first to the last page.\u003C\u002Fli>\n    \u003Cli>\u003Ccode>'resolution'\u003C\u002Fcode>: Sets the resolution of the output images to 600 DPI.\u003C\u002Fli>\n    \u003Cli>\u003Ccode>'color_model'\u003C\u002Fcode>: Converts the images to grayscale.\u003C\u002Fli>\n    \u003Cli>\u003Ccode>'output'\u003C\u002Fcode>: The name of the output file.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_tif.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\u003C\u002Fpre>\n\n\u003Cp>We set the headers for the request. The \u003Ccode>'Content-Type'\u003C\u002Fcode> is set to \u003Ccode>'multipart\u002Fform-data'\u003C\u002Fcode> using \u003Ccode>mp_encoder_tif.content_type\u003C\u002Fcode>, and the \u003Ccode>'Api-Key'\u003C\u002Fcode> is your unique API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(tif_endpoint_url, data=mp_encoder_tif, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This line sends a POST request to the PDF to Images endpoint with the multipart data and headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Finally, we check if the response is successful. If it is, we print the JSON response. Otherwise, we print the error message.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we demonstrated how to convert a PDF to TIFF images using the pdfRest API with Python. You can explore more features and tools offered by pdfRest by visiting the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. This example uses a multipart API call, but you can also find code samples using JSON payloads at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Ftif.py\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-06-28T21:35:07.000+00:00","2026-09-02T18:28:07.000+00:00","Learn how to convert PDF pages to TIFF images using Python with pdfRest PDF to Images API tool","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-python\u002F#article\",\n      \"headline\": \"How to Convert PDF to TIFF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-python\u002F\",\n      \"datePublished\": \"2024-06-28T21:35:07.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:28.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert PDF pages to TIFF images using Python with pdfRest PDF to Images API tool\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Ftif API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert, PDF to Images, Python, TIFF\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to TIFF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-tiff-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6824,6825,6826,6827,6828,6829,6830],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1538,"name":1539,"slug":1540,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1554,"name":1555,"slug":1556,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1390,"name":1391,"slug":1392,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-tiff-with-python\u002F","How to Convert PDF to TIFF with Python, Tutorial | pdfRest",{"id":6835,"uuid":6836,"title":6837,"slug":6838,"html":6839,"comment_id":6840,"feature_image":48,"featured":284,"visibility":1257,"created_at":6841,"updated_at":6820,"published_at":6841,"custom_excerpt":6842,"codeinjection_head":6843,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6844,"primary_tag":6851,"url":6852,"excerpt":6842,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6853,"meta_description":6842,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b134c","b3808017-f927-4a4a-a35b-4af95e0d38d2","How to Convert PDF to Word in .NET with C#","how-to-convert-pdf-to-word-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to Word with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-word\u002F'>PDF to Word API Tool\u003C\u002Fa> is a powerful service that allows users to convert PDF documents into editable Word files. This can be particularly useful in scenarios where you need to extract text from a PDF to edit, format, or repurpose the content without having to manually retype the entire document. For instance, a user might need to convert a PDF report into a Word document to apply company branding or to make substantial edits that are easier to perform in a word processor.\u003C\u002Fp>\n\n\u003Cp>In this tutorial, we will demonstrate how to send an API call to the PDF to Word endpoint using C#. This will involve setting up an HTTP client, creating a multipart form data request, and handling the response.\u003C\u002Fp>\n\n\u003Ch2>Convert PDF to Word C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"word\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"converted\"));\n        multipartContent.Add(byteArrayOption, \"output\");\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fword.cs\">pdf-rest-api-samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code snippet above demonstrates how to make a POST request to the \"word\" endpoint of the pdfRest API to convert a PDF to a Word document.\u003C\u002Fp>\n\n\u003Col>\n    \u003Cli>Firstly, an instance of \u003Ccode>HttpClient\u003C\u002Fcode> is created with the base address set to the pdfRest API.\u003C\u002Fli>\n    \u003Cli>An \u003Ccode>HttpRequestMessage\u003C\u002Fcode> is then initialized with the POST method and the \"word\" endpoint.\u003C\u002Fli>\n    \u003Cli>The API key is added to the request headers without validation. Replace \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" with your actual API key.\u003C\u002Fli>\n    \u003Cli>The request header is set to accept JSON responses.\u003C\u002Fli>\n    \u003Cli>A \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> object is created to hold the form data.\u003C\u002Fli>\n    \u003Cli>The PDF file is read into a byte array and added to the multipart content with the name \"file\" and the file name \"file_name.pdf\". The content type for this part is set to \"application\u002Fpdf\".\u003C\u002Fli>\n    \u003Cli>An additional part is added to the multipart content, which indicates the desired output format (\"converted\").\u003C\u002Fli>\n    \u003Cli>The multipart content is assigned to the request's content.\u003C\u002Fli>\n    \u003Cli>The request is sent asynchronously, and the response is awaited.\u003C\u002Fli>\n    \u003Cli>The response content is read as a string, which contains the API result.\u003C\u002Fli>\n    \u003Cli>Finally, the API response is printed to the console.\u003C\u002Fli>\n\u003C\u002Fol>\n\n\u003Cp>Each field or parameter in the API request is crucial:\u003C\u002Fp>\n\n\u003Cul>\n    \u003Cli>\u003Ccode>Api-Key\u003C\u002Fcode>: This is your unique API key provided by pdfRest for authentication.\u003C\u002Fli>\n    \u003Cli>\u003Ccode>file\u003C\u002Fcode>: This is the actual file content of the PDF you want to convert.\u003C\u002Fli>\n    \u003Cli>\u003Ccode>output\u003C\u002Fcode>: This field specifies the output format. In this case, \"converted\" indicates that the output should be a Word document.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial has walked you through the process of setting up and executing an API call to convert a PDF document to a Word file using the pdfRest API in C#. By following the steps outlined above, you can integrate PDF to Word conversion functionality into your applications.\u003C\u002Fp>\n\n\u003Cp>Feel free to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for further information.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads for the same endpoint can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fword.cs\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","657bc0352d4014c9499b3898","2023-12-15T02:55:49.000+00:00","Learn how to turn PDF documents into Microsoft Word documents in .NET by leveraging the PDF to Word API Pro Tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert PDF to Word in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-in-net-with-c\u002F\",\n      \"datePublished\": \"2023-12-15T02:55:49.000Z\",\n      \"dateModified\": \"2026-09-01T14:24:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to turn PDF documents into Microsoft Word documents in .NET by leveraging the PDF to Word API Pro Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Word API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-word\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fword API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-microsoft-word\"\n        }\n      ],\n      \"keywords\": \".NET, Microsoft Office, PDF to Word, Word\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to Word in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6845,6846,6847,6848,6849,6850],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1665,"name":1666,"slug":1667,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1661,"name":1662,"slug":1663,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-word-in-net-with-c\u002F","How to Convert PDF to Word in .NET with C#, Tutorial | pdfRest",{"id":6855,"uuid":6856,"title":6857,"slug":6858,"html":6859,"comment_id":6855,"feature_image":48,"featured":284,"visibility":1257,"created_at":6860,"updated_at":6861,"published_at":6860,"custom_excerpt":6862,"codeinjection_head":6863,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6864,"primary_tag":6869,"url":6870,"excerpt":6862,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6871,"meta_description":6862,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65d90a08533c9f26b94365ce","25f6ec0e-a66b-41df-9ecf-ec310fe3c849","How to Convert PDF to Word with cURL","how-to-convert-pdf-to-word-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to Word with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-word\u002F'>PDF to Word API Tool\u003C\u002Fa> is a powerful resource for developers looking to automate the conversion of PDF documents into editable Word files. This tool simplifies the process by providing a straightforward API that can be accessed using cURL, a command-line tool for making network requests. This tutorial will show how to send an API call to the PDF to Word endpoint using cURL, enabling you to integrate PDF to Word conversion into your applications seamlessly.\u003C\u002Fp>\n\n\u003Cp>In a business scenario, you might need to convert a batch of reports or contracts saved as PDFs into Word documents for further editing and review. Using the PDF to Word API, you can automate this process, saving time and reducing the risk of manual errors. This is particularly useful for organizations that handle a large volume of documents and need to maintain consistency and efficiency in their workflows.\u003C\u002Fp>\n\n\u003Ch2>Convert PDF to Word with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fword\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile.pdf\" \\\n  -F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>The provided code is sourced from the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fword.sh\">pdfRest API samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided cURL command is used to make a POST request to the PDF to Word conversion endpoint. Let's break down each part of the command:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fword\"\n\u003C\u002Fpre>\n\n\u003Cp>This specifies that you are making a POST request to the endpoint that handles PDF to Word conversions.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\n\u003C\u002Fpre>\n\n\u003Cp>This header tells the server that the client expects a response in JSON format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\n\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the request body will be sent as multipart\u002Fform-data, which is necessary for uploading files.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>Here you replace 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' with your actual API key provided by pdfRest. This key is used to authenticate your request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile.pdf\"\n\u003C\u002Fpre>\n\n\u003Cp>This is the form field where you specify the file path for the PDF you want to convert. The '@' symbol is used to upload a file from your filesystem.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>This form field specifies the desired output filename for the converted Word document.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've learned how to use cURL to make a POST request to the pdfRest PDF to Word API endpoint, including how to set headers for content type and authentication, and how to specify the input and output files for the conversion. This is a practical example of automating document conversion to streamline workflows.\u003C\u002Fp>\n\n\u003Cp>To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further details on how to use the API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fword.sh\">pdfRest API samples with JSON payload\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-23T21:11:36.000+00:00","2026-09-02T18:28:08.000+00:00","Learn how to convert a PDF to a Word document using cURL to call the PDF to Word API Pro Tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-curl\u002F#article\",\n      \"headline\": \"How to Convert PDF to Word with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-curl\u002F\",\n      \"datePublished\": \"2024-02-23T21:11:36.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:45.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert a PDF to a Word document using cURL to call the PDF to Word API Pro Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Word API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-word\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fword API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-microsoft-word\"\n        }\n      ],\n      \"keywords\": \"PDF to Word, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to Word with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6865,6866,6867,6868],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1665,"name":1666,"slug":1667,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-word-with-curl\u002F","How to Convert PDF to Word with cURL, Tutorial | pdfRest",{"id":6873,"uuid":6874,"title":6875,"slug":6876,"html":6877,"comment_id":6873,"feature_image":48,"featured":284,"visibility":1257,"created_at":6635,"updated_at":6861,"published_at":6759,"custom_excerpt":6878,"codeinjection_head":6879,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6880,"primary_tag":6885,"url":6886,"excerpt":6878,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6887,"meta_description":6878,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c5b533c9f26b943b524","dce858da-d5b6-4474-8a9f-ee8ccbfa1c60","How to Convert PDF to Word with Java","how-to-convert-pdf-to-word-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>Learn how to convert PDF to Word with Java and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-word\u002F\">PDF to Word API Tool\u003C\u002Fa>. The example uploads a PDF to \u003Ccode>\u002Fword\u003C\u002Fcode> and captures the generated DOCX resource for download or later processing. We'll move from input and authentication setup through the request and returned data involved when you convert PDF to Word.\u003C\u002Fp>\n\n\u003Ch2>Why Convert PDF to Word with Java?\u003C\u002Fh2>\n\n\u003Cp>A document-revision workflow may start with a PDF whose original Word source is unavailable. Conversion gives staff an editable document they can use as the basis for updates and corrections.\u003C\u002Fp>\n\n\u003Cp>The Java example uploads the PDF to \u003Ccode>\u002Fword\u003C\u002Fcode> and reads the generated DOCX resource information from the response. Complex page layouts may require review after conversion.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONObject;\n\npublic class Word {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_word\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fword\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FWord.java\">Java sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The Java setup brings together the HTTP client, environment-based API key loading, and JSON utilities used later in the example.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>The input setup shows where the input comes from and keeps the credential outside the request-building logic.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_word\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fword\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The Java example uploads the PDF to \u003Ccode>\u002Fword\u003C\u002Fcode> and reads the generated DOCX resource information from the response. Complex page layouts may require review after conversion. The OkHttp body sets \u003Ccode>MultipartBody.FORM\u003C\u002Fcode>, allowing OkHttp to generate the matching boundary automatically.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fword\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\u003C\u002Fpre>\n\n\u003Cp>This POST request reads the credential through dotenv and targets the endpoint shown in the source, with the EU hostname documented beside the default US value.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>This result handling checks the server result before treating the body as output and exposes diagnostic JSON when the operation cannot be completed.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>Together, we stepped through the Java request needed to convert PDF to Word. With that foundation, you can use this pattern for document recovery, content reuse, template recreation, and editing workflows.\u003C\u002Fp>\n\n\u003Cp>As you build this into a larger workflow, keep in mind that the DOCX recreates editable content from a fixed-layout PDF and may not reproduce the source authoring structure exactly. Review tables, columns, headers, fonts, and page breaks before using the result as a new master document.\u003C\u002Fp>\n\n\u003Cp>Try the Convert PDF to Word operation with representative files in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. Review the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-microsoft-word\u002F\">PDF to Word API Tool documentation\u003C\u002Fa> for supported values and production considerations.\u003C\u002Fp>\n\n\u003Cp>Note: The Convert PDF to Word example above uses multipart form data; for the resource-ID form of this operation, see the request shape in the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FWord.java\">JSON payload example\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Convert PDF documents into editable Microsoft Word files with Java.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-java\u002F#article\",\n      \"headline\": \"How to Convert PDF to Word with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:36.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:36.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert PDF documents into editable Microsoft Word files with Java.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Word API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-word\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fword API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-microsoft-word\"\n        }\n      ],\n      \"keywords\": \"Java, PDF to Word\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to Word with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6881,6882,6883,6884],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1665,"name":1666,"slug":1667,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-word-with-java\u002F","Convert PDF to Word with Java | pdfRest",{"id":6889,"uuid":6890,"title":6891,"slug":6892,"html":6893,"comment_id":6894,"feature_image":48,"featured":284,"visibility":1257,"created_at":6895,"updated_at":6861,"published_at":6895,"custom_excerpt":6896,"codeinjection_head":6897,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6898,"primary_tag":6905,"url":6906,"excerpt":6896,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6907,"meta_description":6896,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b134d","4c046a6f-87a6-4c83-8ebc-81546d13a826","How to Convert PDF to Word with JavaScript in NodeJS","how-to-convert-pdf-to-word-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to Word with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-word\u002F'>PDF to Word API Tool\u003C\u002Fa> is a powerful resource that allows users to convert PDF documents to Word format. This tutorial will guide you through the process of making an API call to the PDF to Word endpoint using JavaScript.\u003C\u002Fp>\n\u003Cp>This capability is particularly useful in scenarios where one needs to edit the contents of a PDF document in a word processor, or when extracting text from PDFs for data processing tasks.\u003C\u002Fp>\n\n\u003Ch2>Convert PDF to Word JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to convert a PDF to a Word file.\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('output', 'pdfrest_word_pdf');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fword', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fword.js\">pdf-rest-api-samples GitHub repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code starts by requiring necessary modules:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>axios\u003C\u002Fcode> is used for making HTTP requests, \u003Ccode>FormData\u003C\u002Fcode> is for building form data payloads, and \u003Ccode>fs\u003C\u002Fcode> is for file system operations.\u003C\u002Fp>\n\n\u003Cp>Next, a \u003Ccode>FormData\u003C\u002Fcode> object is created and the PDF file is appended to it along with the output parameter:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('output', 'pdfrest_word_pdf');\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>file\u003C\u002Fcode> field contains the file stream of the PDF, and \u003Ccode>output\u003C\u002Fcode> is the desired name for the converted Word file.\u003C\u002Fp>\n\n\u003Cp>The configuration object for the axios request is defined:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fword', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>method\u003C\u002Fcode> is set to POST, and \u003Ccode>maxBodyLength\u003C\u002Fcode> is set to Infinity to allow for large file sizes. The \u003Ccode>url\u003C\u002Fcode> points to the API endpoint. The \u003Ccode>headers\u003C\u002Fcode> include the API key and the headers from the form data. The \u003Ccode>data\u003C\u002Fcode> property holds the form data object.\u003C\u002Fp>\n\n\u003Cp>Finally, the request is sent, and the response or error is handled:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we have demonstrated how to make an API call to the pdfRest PDF to Word endpoint using JavaScript. By following the steps outlined, you can convert PDF documents to Word format programmatically. To explore more capabilities, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fword.js\">pdf-rest-api-samples GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","657bc0572d4014c9499b38a2","2023-12-15T02:56:23.000+00:00","Learn how to turn PDF documents into Microsoft Word documents with JavaScript by leveraging the PDF to Word API Pro Tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert PDF to Word with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2023-12-15T02:56:23.000Z\",\n      \"dateModified\": \"2026-09-01T14:24:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to turn PDF documents into Microsoft Word documents with JavaScript by leveraging the PDF to Word API Pro Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Word API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-word\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fword API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-microsoft-word\"\n        }\n      ],\n      \"keywords\": \"JavaScript, Microsoft Office, PDF to Word, Word\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to Word with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6899,6900,6901,6902,6903,6904],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1665,"name":1666,"slug":1667,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1661,"name":1662,"slug":1663,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-word-with-javascript-in-nodejs\u002F","How to Convert PDF to Word with JavaScript in NodeJS, Tutorial | pdfRest",{"id":6909,"uuid":6910,"title":6911,"slug":6912,"html":6913,"comment_id":6914,"feature_image":48,"featured":284,"visibility":1257,"created_at":6915,"updated_at":6916,"published_at":6915,"custom_excerpt":6917,"codeinjection_head":6918,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6919,"primary_tag":6926,"url":6927,"excerpt":6917,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6928,"meta_description":6917,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b134b","fd4b1615-2931-4446-b94a-753b08a8c577","How to Convert PDF to Word with PHP","how-to-convert-pdf-to-word-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to Word with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-word\u002F\">PDF to Word API Tool\u003C\u002Fa> is a powerful resource that allows users to convert PDF documents into editable Word files. This tutorial will guide you through the process of sending an API call to the PDF to Word API using PHP.\u003C\u002Fp>\n\n\u003Cp>A common example of using this API is for businesses that need to convert a batch of contract PDFs into Word documents for editing and review.\u003C\u002Fp>\n\n\u003Ch2>Convert PDF to Word PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_word'\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fword', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fword.php\">GitHub - datalogics\u002Fpdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code starts by including the necessary libraries for sending HTTP requests with the Guzzle HTTP client. It then sets up the API key in the headers for authentication with the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The options array is configured to send a multipart request, which includes the file to be converted and the desired output format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">'options' => [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_word'\n    ]\n  ]\n];\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>The 'file' part of the request contains the file stream opened for reading, the path to the file, and the content type of the file. The 'output' part specifies the output format, which is 'pdfrest_word' for a Word document.\u003C\u002Fp>\n\n\u003Cp>A new POST request is created with the specified endpoint and headers, and the request is sent asynchronously. The response is then retrieved and the body of the response, which contains the converted Word document, is outputted.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fword', $headers);\n$res = $client->sendAsync($request, $options)->wait();\necho $res->getBody();\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've walked through the process of setting up and making an API call to convert a PDF to a Word document using the pdfRest API and PHP. By following these steps, you can integrate PDF to Word conversion into your PHP applications.\u003C\u002Fp>\n\n\u003Cp>To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fword.php\">GitHub - JSON Payload Example\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","657bbff42d4014c9499b388e","2023-12-15T02:54:44.000+00:00","2026-09-10T20:19:15.000+00:00","Learn how to turn PDF documents into Microsoft Word documents with PHP by leveraging the PDF to Word API Pro Tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-php\u002F#article\",\n      \"headline\": \"How to Convert PDF to Word with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-php\u002F\",\n      \"datePublished\": \"2023-12-15T02:54:44.000Z\",\n      \"dateModified\": \"2026-09-01T14:24:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to turn PDF documents into Microsoft Word documents with PHP by leveraging the PDF to Word API Pro Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Word API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-word\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fword API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-microsoft-word\"\n        }\n      ],\n      \"keywords\": \"Microsoft Office, PDF to Word, PHP, Word\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to Word with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6920,6921,6922,6923,6924,6925],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1665,"name":1666,"slug":1667,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1661,"name":1662,"slug":1663,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-word-with-php\u002F","How to Convert PDF to Word with PHP, Tutorial | pdfRest",{"id":6930,"uuid":6931,"title":6932,"slug":6933,"html":6934,"comment_id":6935,"feature_image":48,"featured":284,"visibility":1257,"created_at":6936,"updated_at":6937,"published_at":6936,"custom_excerpt":6938,"codeinjection_head":6939,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6940,"primary_tag":6947,"url":6948,"excerpt":6938,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6949,"meta_description":6938,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b134a","a06f2cd3-066d-43a1-8fab-98cb551c0811","How to Convert PDF to Word with Python","how-to-convert-pdf-to-word-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PDF to Word with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-word\u002F'>PDF to Word API Tool\u003C\u002Fa> allows users to convert PDF documents into editable Word documents. This can be particularly useful in scenarios where a user needs to extract text from a PDF for editing, repurposing content, or when needing to make updates to a document that only exists in PDF format.\u003C\u002Fp>\n\u003Cp>In this tutorial, we will explore how to send an API call to the PDF to Word tool using Python.\u003C\u002Fp>\n\n\u003Ch2>Convert PDF to Word Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nword_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fword'\n\n# The \u002Fword endpoint can take a single PDF file or id as input.\n# This sample demonstrates converting a PDF to a Word document.\nmp_encoder_word = MultipartEncoder(\n    fields={\n        'file': ('file_name', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_word_out',\n    }\n)\n\n# Let's set the headers that the word endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_word.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to word endpoint...\")\nresponse = requests.post(word_endpoint_url, data=mp_encoder_word, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>The source of the provided code is available at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fword.py\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing the necessary libraries:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>MultipartEncoder\u003C\u002Fcode> is used for creating a multipart\u002Fform-data payload, which is required for file uploads. The \u003Ccode>requests\u003C\u002Fcode> library is used to make HTTP requests, and \u003Ccode>json\u003C\u002Fcode> is used for handling JSON data.\u003C\u002Fp>\n\n\u003Cp>The API endpoint URL is defined:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">word_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fword'\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>MultipartEncoder\u003C\u002Fcode> is configured with the file to be uploaded and the desired output filename:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_word = MultipartEncoder(\n    fields={\n        'file': ('file_name', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_word_out',\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>The 'file' field contains a tuple with the filename, file object, and content type. The 'output' field specifies the base name for the output file.\u003C\u002Fp>\n\n\u003Cp>Headers are set to accept JSON responses and to include the API key:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_word.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\u003C\u002Fpre>\n\n\u003Cp>The API key should be replaced with a valid key provided by pdfRest.\u003C\u002Fp>\n\n\u003Cp>The POST request is sent, and the response is handled:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(word_endpoint_url, data=mp_encoder_word, headers=headers)\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>If the request is successful, the JSON response is printed; otherwise, the error message is displayed.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we have learned how to make an API call to the pdfRest PDF to Word API tool using Python. This allows for the conversion of PDF documents to Word format programmatically.\u003C\u002Fp>\n\n\u003Cp>For further exploration and to demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fword.py\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","657bbf642d4014c9499b3884","2023-12-15T02:52:20.000+00:00","2026-09-02T18:28:09.000+00:00","Learn how to turn PDF documents into Microsoft Word documents with Python by leveraging the PDF to Word API Pro Tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-python\u002F#article\",\n      \"headline\": \"How to Convert PDF to Word with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-python\u002F\",\n      \"datePublished\": \"2023-12-15T02:52:20.000Z\",\n      \"dateModified\": \"2026-09-01T14:24:01.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to turn PDF documents into Microsoft Word documents with Python by leveraging the PDF to Word API Pro Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Word API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-word\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fword API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-microsoft-word\"\n        }\n      ],\n      \"keywords\": \"Microsoft Office, PDF to Word, Python, Word\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PDF to Word with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-pdf-to-word-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6941,6942,6943,6944,6945,6946],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1665,"name":1666,"slug":1667,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1661,"name":1662,"slug":1663,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1653,"name":1654,"slug":1655,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-pdf-to-word-with-python\u002F","How to Convert PDF to Word with Python, Tutorial | pdfRest",{"id":6951,"uuid":6952,"title":6953,"slug":6954,"html":6955,"comment_id":6951,"feature_image":48,"featured":284,"visibility":1257,"created_at":6956,"updated_at":6957,"published_at":6956,"custom_excerpt":6958,"codeinjection_head":6959,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6960,"primary_tag":6969,"url":6970,"excerpt":6958,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6971,"meta_description":6958,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a95f0ce533c9f26b943ace0","b74449ee-00ce-454c-84b0-119635d2a2c6","How to Convert Plain Text to PDF in .NET with C#","how-to-convert-plain-text-to-pdf-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This .NET walkthrough shows how C# can convert a plain text file with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. It sends the source with structured settings for preserved lines, tagged output, page geometry, and text appearance.\u003C\u002Fp>\n\n\u003Ch2>Why Convert Plain Text to PDF in .NET with C#?\u003C\u002Fh2>\n\n\u003Cp>Many .NET environments integrate with manufacturing, financial, or mainframe systems that still emit fixed-format text. Those reports may contain valuable operational history, but distributing them as loose text files makes printing, review, and records retention inconsistent.\u003C\u002Fp>\n\n\u003Cp>A manufacturing application, for example, may receive a production-run summary listing machine identifiers, quantities, exceptions, and operator messages. Converting the export to PDF gives supervisors a stable report for the run record. Preserved line handling keeps each entry in order, and choosing a monospaced font can maintain fixed-width alignment when the source depends on columns.\u003C\u002Fp>\n\n\u003Cp>C# applications can switch to reflow mode for notes and narrative summaries that should wrap naturally across the page. The same endpoint then handles two distinct text layouts while applying repeatable margins, metadata, typography, and document structure.\u003C\u002Fp>\n\n\u003Ch2>C# Code Example for Converting Plain Text to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">\u002F*\n * What this sample does:\n * - Converts plain text input to PDF through the \u002Fpdf endpoint.\n *\n * Setup (environment):\n * - Set PDFREST_API_KEY=your_api_key_here\n * - Optional: set PDFREST_URL to override the API region.\n *\n * Usage:\n *   dotnet run -- pdf-from-text-multipart \u003CinputFile>\n *\u002F\nusing Newtonsoft.Json.Linq;\nusing System.Net.Http.Headers;\nusing System.Text;\n\nnamespace Samples.EndpointExamples.MultipartPayload;\n\npublic static class PdfFromText\n{\n    public static async Task Execute(string[] args)\n    {\n        var inputPath = args.Length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.txt\";\n        var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\n        if (string.IsNullOrWhiteSpace(apiKey)) throw new InvalidOperationException(\"Missing PDFREST_API_KEY\");\n        var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n        using var client = new HttpClient { BaseAddress = new Uri(baseUrl) };\n        client.DefaultRequestHeaders.TryAddWithoutValidation(\"Api-Key\", apiKey);\n        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(\"application\u002Fjson\"));\n        var options = JObject.Parse(@\"{\"\"title\"\":\"\"Structured Content Sample\"\",\"\"language\"\":\"\"en-US\"\",\"\"enable_tagging\"\":true,\"\"page_setup\"\":{\"\"size\"\":\"\"Letter\"\",\"\"orientation\"\":\"\"portrait\"\",\"\"margin\"\":{\"\"top\"\":36,\"\"right\"\":42,\"\"bottom\"\":36,\"\"left\"\":42}},\"\"style\"\":{\"\"font\"\":\"\"Arial\"\",\"\"heading_font\"\":\"\"Arial\"\",\"\"code_font\"\":\"\"Courier\"\",\"\"text_size\"\":11,\"\"text_color_rgb\"\":[34,34,34],\"\"heading_scale\"\":1.35,\"\"table\"\":{\"\"column_width_weights\"\":[2,3,2],\"\"keep_header_with_first_row\"\":true,\"\"repeat_headers_on_overflow\"\":true,\"\"show_borders\"\":true,\"\"border_width\"\":0.75,\"\"border_color_rgb\"\":[180,188,200],\"\"header_fill_color_rgb\"\":[33,64,98],\"\"header_text_color_rgb\"\":[255,255,255],\"\"row_fill_color_rgb\"\":[250,250,252],\"\"alternate_row_fill_color_rgb\"\":[235,240,246],\"\"cell_padding\"\":{\"\"top\"\":6,\"\"right\"\":8,\"\"bottom\"\":6,\"\"left\"\":8}}},\"\"plain_text\"\":{\"\"line_handling\"\":\"\"preserve\"\"}}\");\n        using var form = new MultipartFormDataContent();\n        var inputContent = new ByteArrayContent(await File.ReadAllBytesAsync(inputPath));\n        inputContent.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Foctet-stream\");\n        form.Add(inputContent, \"file\", Path.GetFileName(inputPath));\n        form.Add(new StringContent(options.ToString()), \"structured_text_options\");\n        var response = await client.PostAsync(\"pdf\", form);\n        var result = await response.Content.ReadAsStringAsync();\n        Console.WriteLine(result);\n        if (!response.IsSuccessStatusCode) Environment.ExitCode = 1;\n    }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-text.cs\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The C# Plain Text sample uses the framework \u003Ccode>HttpClient\u003C\u002Fcode> APIs and Newtonsoft JSON types for \u003Ccode>structured_text_options\u003C\u002Fcode>. A project adopting this code must retain the Newtonsoft.Json package reference used by the samples repository.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using Newtonsoft.Json.Linq;\nusing System.Net.Http.Headers;\nusing System.Text;\n        using var client = new HttpClient { BaseAddress = new Uri(baseUrl) };\n        using var form = new MultipartFormDataContent();\u003C\u002Fpre>\n\n\u003Cp>The .NET endpoint block shows which regional service receives this Plain Text request:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">        if (string.IsNullOrWhiteSpace(apiKey)) throw new InvalidOperationException(\"Missing PDFREST_API_KEY\");\n        var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n        using var client = new HttpClient { BaseAddress = new Uri(baseUrl) };\n        client.DefaultRequestHeaders.TryAddWithoutValidation(\"Api-Key\", apiKey);\u003C\u002Fpre>\n\n\u003Cp>C# turns the .txt source into \u003Ccode>StreamContent\u003C\u002Fcode> and preserves its filename in the multipart part. That extension directs the shared \u003Ccode>\u002Fpdf\u003C\u002Fcode> endpoint to the Plain Text converter.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">    {\n        var inputPath = args.Length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.txt\";\n        var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\u003C\u002Fpre>\n\n\u003Cp>The Newtonsoft \u003Ccode>JObject\u003C\u002Fcode> represents pdfRest’s structured conversion settings. It defines the output title and language, explicitly enables tags, configures Letter portrait pages and margins, and carries the typography and Plain Text-related style properties used by the renderer.\u003C\u002Fp>\n\n\u003Ccode>plain_text\u003C\u002Fcode>\n\n\u003Cpre class=\"language-json\">{\n  \"plain_text\": {\n    \"line_handling\": \"preserve\"\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>preserve\u003C\u002Fcode> keeps every normalized source line and its spacing in a preformatted block. Windows and legacy carriage-return line endings are normalized consistently. The alternative \u003Ccode>reflow\u003C\u002Fcode> joins consecutive nonblank lines into paragraphs, using blank lines as paragraph boundaries; \u003Ccode>reflow\u003C\u002Fcode> is the default when the field is omitted. Only those two values are accepted. When horizontal alignment matters, select a monospaced body font because preserve mode retains characters and spacing but does not force a particular font.\u003C\u002Fp>\n\n\u003Cp>The sample also carries \u003Ccode>style.table\u003C\u002Fcode> because the repository uses one broad structured-text profile. Plain Text does not create a table, so those table colors, borders, widths, and padding have no effect and may be omitted from a text-only integration.\u003C\u002Fp>\n\n\u003Cp>For Plain Text, \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> owns the source stream, serialized settings, and output field. \u003Ccode>HttpClient\u003C\u002Fcode> generates the matching multipart boundary and content type when it sends the container.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">        var inputContent = new ByteArrayContent(await File.ReadAllBytesAsync(inputPath));\n        inputContent.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Foctet-stream\");\n        form.Add(inputContent, \"file\", Path.GetFileName(inputPath));\n        form.Add(new StringContent(options.ToString()), \"structured_text_options\");\n        var response = await client.PostAsync(\"pdf\", form);\n        var result = await response.Content.ReadAsStringAsync();\n        Console.WriteLine(result);\n        if (!response.IsSuccessStatusCode) Environment.ExitCode = 1;\n    }\n}\u003C\u002Fpre>\n\n\u003Cp>The C# client authenticates and posts the Plain Text form, then reads the response as text. Reporting both status and payload lets an integration distinguish a generated PDF resource from validation or processing errors.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">        var inputContent = new ByteArrayContent(await File.ReadAllBytesAsync(inputPath));\n        inputContent.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Foctet-stream\");\n        form.Add(inputContent, \"file\", Path.GetFileName(inputPath));\n        form.Add(new StringContent(options.ToString()), \"structured_text_options\");\n        var response = await client.PostAsync(\"pdf\", form);\n        var result = await response.Content.ReadAsStringAsync();\n        Console.WriteLine(result);\n        if (!response.IsSuccessStatusCode) Environment.ExitCode = 1;\n    }\n}\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>.NET workflows can use the same conversion for operational logs, policy text, or fixed-layout records that need consistent PDF delivery. Enabling tags exposes logical structure to compatible consumers but does not by itself demonstrate accessibility conformance.\u003C\u002Fp>\n\n\u003Cp>A text-only integration may keep just the metadata, page, typography, and line-handling settings it requires. Experiment in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and use the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF reference\u003C\u002Fa> as the authoritative option guide.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-08-31T21:23:26.000+00:00","2026-09-02T18:28:10.000+00:00","Generate styled, tagged PDFs from plain text in .NET with C# and choose preserved-line or reflowed layout.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert Plain Text to PDF in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-in-net-with-c\u002F\",\n      \"datePublished\": \"2026-08-31T21:23:26.000Z\",\n      \"dateModified\": \"2026-09-01T05:07:07.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Generate styled, tagged PDFs from plain text in .NET with C# and choose preserved-line or reflowed layout.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Conversion, Convert to PDF\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Plain Text to PDF in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6961,6962,6963,6964,6965,6966,6967,6968],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1430,"name":1431,"slug":1432,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-plain-text-to-pdf-in-net-with-c\u002F","How to Convert Plain Text to PDF in .NET with C#, Tutorial | pdfRest",{"id":6973,"uuid":6974,"title":6975,"slug":6976,"html":6977,"comment_id":6973,"feature_image":48,"featured":284,"visibility":1257,"created_at":6978,"updated_at":6957,"published_at":6978,"custom_excerpt":6979,"codeinjection_head":6980,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":6981,"primary_tag":6990,"url":6991,"excerpt":6979,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":6992,"meta_description":6979,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a95f126533c9f26b943acfe","bc54ea7f-fe78-49f9-8762-cb8aa7d11e80","How to Convert Plain Text to PDF with cURL","how-to-convert-plain-text-to-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This tutorial uses cURL and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa> to turn a plain text file into a styled, tagged PDF. The request preserves the source line breaks and applies page, margin, font, color, title, and language settings in one command.\u003C\u002Fp>\n\n\u003Ch2>Why Convert Plain Text to PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>Plain text is the common output of command-line tools, monitoring jobs, and legacy systems, but it lacks page boundaries and a consistent presentation for sharing. PDF makes that content easier to review, attach to a record, and open without depending on a particular text editor.\u003C\u002Fp>\n\n\u003Cp>An operations script might collect the relevant portion of a service log after an outage and add it to an incident-management case. By calling pdfRest with \u003Ccode>line_handling: \"preserve\"\u003C\u002Fcode>, the script can retain timestamps, line breaks, and intentional spacing in a paginated PDF. The response becomes a portable diagnostic artifact that support and engineering can reference together.\u003C\u002Fp>\n\n\u003Cp>For narrative notes rather than logs, the same workflow can use \u003Ccode>reflow\u003C\u002Fcode> so source lines combine into readable paragraphs. This choice allows a small cURL integration to serve both format-sensitive technical output and ordinary prose while applying consistent metadata and optional tagging.\u003C\u002Fp>\n\n\u003Ch2>cURL Code Example for Converting Plain Text to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">#!\u002Fbin\u002Fsh\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# This sample converts plain text input to a tagged PDF through multipart \u002Fpdf.\nINPUT_PATH=\"\u002Fpath\u002Fto\u002Fsample.txt\"\nOPTIONS='{\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"plain_text\":{\"line_handling\":\"preserve\"}}'\n\ncurl --location \"$API_URL\u002Fpdf\" \\\n  --header \"Accept: application\u002Fjson\" \\\n  --header \"Content-Type: multipart\u002Fform-data\" \\\n  --header \"Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  --form \"file=@$INPUT_PATH\" \\\n  --form \"structured_text_options=$OPTIONS\" \\\n  --form \"output=pdf_from_text\"\n\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-text.sh\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The Plain Text shell example calls cURL directly, so no language package is required. \u003Ccode>API_URL\u003C\u002Fcode> keeps regional routing visible: the active value uses the US service, and the commented alternative selects the EU service.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">#!\u002Fbin\u002Fsh\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# This sample converts plain text input to a tagged PDF through multipart \u002Fpdf.\nINPUT_PATH=\"\u002Fpath\u002Fto\u002Fsample.txt\"\u003C\u002Fpre>\n\n\u003Cp>For this Plain Text request, the endpoint excerpt makes the regional service choice explicit:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>INPUT_PATH\u003C\u002Fcode> identifies the local .txt source. The \u003Ccode>@\u003C\u002Fcode> prefix in the later \u003Ccode>--form\u003C\u002Fcode> argument instructs cURL to upload that file’s contents instead of sending its path as text.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\"># This sample converts plain text input to a tagged PDF through multipart \u002Fpdf.\nINPUT_PATH=\"\u002Fpath\u002Fto\u002Fsample.txt\"\nOPTIONS='{\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"plain_text\":{\"line_handling\":\"preserve\"}}'\u003C\u002Fpre>\n\n\u003Cp>The JSON assigned to \u003Ccode>OPTIONS\u003C\u002Fcode> is pdfRest-specific rather than shell syntax. \u003Ccode>title\u003C\u002Fcode> becomes document metadata, \u003Ccode>language\u003C\u002Fcode> identifies the document language, and \u003Ccode>enable_tagging\u003C\u002Fcode> explicitly requests logical structure. \u003Ccode>page_setup\u003C\u002Fcode> selects Letter portrait pages with 36-point margins, while \u003Ccode>style\u003C\u002Fcode> supplies fonts, text size, color, and format-specific presentation.\u003C\u002Fp>\n\n\u003Cpre class=\"language-json\">{\n  \"plain_text\": {\n    \"line_handling\": \"preserve\"\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>preserve\u003C\u002Fcode> keeps every normalized source line and its spacing in a preformatted block. Windows and legacy carriage-return line endings are normalized consistently. The alternative \u003Ccode>reflow\u003C\u002Fcode> joins consecutive nonblank lines into paragraphs, using blank lines as paragraph boundaries; \u003Ccode>reflow\u003C\u002Fcode> is the default when the field is omitted. Only those two values are accepted. When horizontal alignment matters, select a monospaced body font because preserve mode retains characters and spacing but does not force a particular font.\u003C\u002Fp>\n\n\u003Cp>The sample also carries \u003Ccode>style.table\u003C\u002Fcode> because the repository uses one broad structured-text profile. Plain Text does not create a table, so those table colors, borders, widths, and padding have no effect and may be omitted from a text-only integration.\u003C\u002Fp>\n\n\u003Cp>For Plain Text conversion, the \u003Ccode>--form\u003C\u002Fcode> arguments create the multipart fields: \u003Ccode>file\u003C\u002Fcode> carries the structured source, \u003Ccode>structured_text_options\u003C\u002Fcode> carries serialized settings, and \u003Ccode>output\u003C\u002Fcode> names the requested PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">  --header \"Content-Type: multipart\u002Fform-data\" \\\n  --header \"Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  --form \"file=@$INPUT_PATH\" \\\n  --form \"structured_text_options=$OPTIONS\" \\\n  --form \"output=pdf_from_text\"\u003C\u002Fpre>\n\n\u003Cp>The Plain Text request asks for JSON with \u003Ccode>Accept\u003C\u002Fcode>, declares multipart form data with \u003Ccode>Content-Type\u003C\u002Fcode>, and authenticates through \u003Ccode>Api-Key\u003C\u002Fcode>. Success returns the generated PDF resource and download URL; failure returns API error information.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\"># This sample converts plain text input to a tagged PDF through multipart \u002Fpdf.\nINPUT_PATH=\"\u002Fpath\u002Fto\u002Fsample.txt\"\nOPTIONS='{\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"plain_text\":{\"line_handling\":\"preserve\"}}'\n\ncurl --location \"$API_URL\u002Fpdf\" \\\n  --header \"Accept: application\u002Fjson\" \\\n  --header \"Content-Type: multipart\u002Fform-data\" \\\n  --header \"Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  --form \"file=@$INPUT_PATH\" \\\n  --form \"structured_text_options=$OPTIONS\" \\\n  --form \"output=pdf_from_text\"\u003C\u002Fpre>\n\n\u003Ch2 id=\"beyond-the-tutorial\">Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This example shows how to create a tagged PDF from plain text while retaining intentional line breaks and spacing from the source file. Tagged output adds logical document structure that can support accessibility and downstream processing, but it does not by itself guarantee conformance with a specific accessibility standard.\u003C\u002Fp>\n\n\u003Cp>For simpler workflows, you can submit a plain text file without every styling option. Explore the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> to test requests in your browser, and see the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF documentation\u003C\u002Fa> for the complete parameter reference.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-08-31T21:24:54.000+00:00","Use cURL to convert plain text into a styled, tagged PDF while preserving source lines or reflowing paragraphs.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Convert Plain Text to PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-curl\u002F\",\n      \"datePublished\": \"2026-08-31T21:24:54.000Z\",\n      \"dateModified\": \"2026-09-01T05:07:05.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Use cURL to convert plain text into a styled, tagged PDF while preserving source lines or reflowing paragraphs.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Plain Text to PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[6982,6983,6984,6985,6986,6987,6988,6989],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1430,"name":1431,"slug":1432,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-plain-text-to-pdf-with-curl\u002F","How to Convert Plain Text to PDF with cURL, Tutorial | pdfRest",{"id":6994,"uuid":6995,"title":6996,"slug":6997,"html":6998,"comment_id":6994,"feature_image":48,"featured":284,"visibility":1257,"created_at":6999,"updated_at":6957,"published_at":6999,"custom_excerpt":7000,"codeinjection_head":7001,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7002,"primary_tag":7011,"url":7012,"excerpt":7000,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7013,"meta_description":7000,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a95f109533c9f26b943acf4","ce305ff7-0ae7-41fa-87ca-b13ba0f35073","How to Convert Plain Text to PDF with Java","how-to-convert-plain-text-to-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This Java tutorial submits a plain text file to the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa> and creates a tagged PDF with controlled page setup and typography. The sample selects preserved line handling so the source layout remains visible.\u003C\u002Fp>\n\n\u003Ch2>Why Convert Plain Text to PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>Java batch applications and transaction systems still produce text summaries, spool-style reports, and reconciliation output. These files are efficient for systems to create, yet they can be awkward to distribute to reviewers who expect a paginated document with reliable rendering.\u003C\u002Fp>\n\n\u003Cp>A settlement service provides a useful example: after processing a nightly batch, it may write account totals, warnings, and control values to a text report. The Java application can convert that report to PDF and place it alongside the batch record for finance review. Preserved lines maintain the report’s sequence, and a monospaced body font can be selected when aligned text columns are significant.\u003C\u002Fp>\n\n\u003Cp>When the source contains prose instead of layout-sensitive rows, reflow mode produces more natural paragraphs. The conversion API lets the same Java service choose that behavior per request while setting document language, title, margins, fonts, and tags centrally.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example for Converting Plain Text to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class PdfFromText {\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) throws IOException {\n    File inputFile = new File(args.length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.txt\");\n    Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n    String apiKey = dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY);\n    JSONObject options =\n        new JSONObject(\n            \"{\\\"title\\\":\\\"Structured Content Sample\\\",\\\"language\\\":\\\"en-US\\\",\\\"enable_tagging\\\":true,\\\"page_setup\\\":{\\\"size\\\":\\\"Letter\\\",\\\"orientation\\\":\\\"portrait\\\",\\\"margin\\\":{\\\"top\\\":36,\\\"right\\\":42,\\\"bottom\\\":36,\\\"left\\\":42}},\\\"style\\\":{\\\"font\\\":\\\"Arial\\\",\\\"heading_font\\\":\\\"Arial\\\",\\\"code_font\\\":\\\"Courier\\\",\\\"text_size\\\":11,\\\"text_color_rgb\\\":[34,34,34],\\\"heading_scale\\\":1.35,\\\"table\\\":{\\\"column_width_weights\\\":[2,3,2],\\\"keep_header_with_first_row\\\":true,\\\"repeat_headers_on_overflow\\\":true,\\\"show_borders\\\":true,\\\"border_width\\\":0.75,\\\"border_color_rgb\\\":[180,188,200],\\\"header_fill_color_rgb\\\":[33,64,98],\\\"header_text_color_rgb\\\":[255,255,255],\\\"row_fill_color_rgb\\\":[250,250,252],\\\"alternate_row_fill_color_rgb\\\":[235,240,246],\\\"cell_padding\\\":{\\\"top\\\":6,\\\"right\\\":8,\\\"bottom\\\":6,\\\"left\\\":8}}},\\\"plain_text\\\":{\\\"line_handling\\\":\\\"preserve\\\"}}\");\n    MultipartBody.Builder form =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\n                \"file\",\n                inputFile.getName(),\n                RequestBody.create(inputFile, MediaType.parse(\"application\u002Foctet-stream\")))\n            .addFormDataPart(\"structured_text_options\", options.toString());\n    Request request =\n        new Request.Builder()\n            .url(API_URL + \"\u002Fpdf\")\n            .header(\"Api-Key\", apiKey)\n            .post(form.build())\n            .build();\n    send(request);\n  }\n\n  private static void send(Request request) throws IOException {\n    OkHttpClient client = new OkHttpClient.Builder().readTimeout(60, TimeUnit.SECONDS).build();\n    try (Response response = client.newCall(request).execute()) {\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) System.out.println(response.body().string());\n      if (!response.isSuccessful()) System.exit(1);\n    }\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPdfFromText.java\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This Java Plain Text example combines OkHttp for transport, \u003Ccode>org.json\u003C\u002Fcode> for conversion settings, and dotenv support for repository configuration. Those project dependencies must remain available when the class is moved into another application.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The Java endpoint excerpt exposes the regional service selection used for this Plain Text conversion:\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">public class PdfFromText {\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) throws IOException {\n    File inputFile = new File(args.length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.txt\");\n    Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n    String apiKey = dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY);\u003C\u002Fpre>\n\n\u003Cp>Java wraps the .txt path in an OkHttp request body and retains the filename in the multipart upload. The shared \u003Ccode>\u002Fpdf\u003C\u002Fcode> endpoint uses that extension to select Plain Text conversion.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">  public static void main(String[] args) throws IOException {\n    File inputFile = new File(args.length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.txt\");\n    Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>JSONObject\u003C\u002Fcode> is the pdfRest conversion profile. Its title and language describe the PDF, \u003Ccode>enable_tagging\u003C\u002Fcode> explicitly requests logical tags, and \u003Ccode>page_setup\u003C\u002Fcode> establishes Letter portrait pages with 36-point margins. The \u003Ccode>style\u003C\u002Fcode> member controls the fonts, text size, color, and any Plain Text-specific rendering choices.\u003C\u002Fp>\n\n\u003Cpre class=\"language-json\">{\n  \"plain_text\": {\n    \"line_handling\": \"preserve\"\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>preserve\u003C\u002Fcode> keeps every normalized source line and its spacing in a preformatted block. Windows and legacy carriage-return line endings are normalized consistently. The alternative \u003Ccode>reflow\u003C\u002Fcode> joins consecutive nonblank lines into paragraphs, using blank lines as paragraph boundaries; \u003Ccode>reflow\u003C\u002Fcode> is the default when the field is omitted. Only those two values are accepted. When horizontal alignment matters, select a monospaced body font because preserve mode retains characters and spacing but does not force a particular font.\u003C\u002Fp>\n\n\u003Cp>The sample also carries \u003Ccode>style.table\u003C\u002Fcode> because the repository uses one broad structured-text profile. Plain Text does not create a table, so those table colors, borders, widths, and padding have no effect and may be omitted from a text-only integration.\u003C\u002Fp>\n\n\u003Cp>For the Plain Text upload, \u003Ccode>MultipartBody.Builder\u003C\u002Fcode> combines the source file, serialized \u003Ccode>structured_text_options\u003C\u002Fcode>, and ordinary \u003Ccode>output\u003C\u002Fcode> text field in one request body.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">                \"file\",\n                inputFile.getName(),\n                RequestBody.create(inputFile, MediaType.parse(\"application\u002Foctet-stream\")))\n            .addFormDataPart(\"structured_text_options\", options.toString());\n    Request request =\n        new Request.Builder()\n            .url(API_URL + \"\u002Fpdf\")\n            .header(\"Api-Key\", apiKey)\n            .post(form.build())\n            .build();\n    send(request);\u003C\u002Fpre>\n\n\u003Cp>OkHttp submits the Plain Text conversion with the API key and checks the HTTP result. The printed body contains generated-resource JSON after success or API error details when processing fails.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">  }\n\n  private static void send(Request request) throws IOException {\n    OkHttpClient client = new OkHttpClient.Builder().readTimeout(60, TimeUnit.SECONDS).build();\n    try (Response response = client.newCall(request).execute()) {\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) System.out.println(response.body().string());\n      if (!response.isSuccessful()) System.exit(1);\n    }\n  }\n}\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>Java services can apply this approach to audit logs, generated notices, and text-based batch reports while choosing whether source line breaks remain fixed or reflow into paragraphs. The requested tags contribute document structure without certifying accessibility compliance.\u003C\u002Fp>\n\n\u003Cp>Production profiles only need the settings relevant to their text workflow. Use \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> to compare line-handling modes, then review the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF documentation\u003C\u002Fa> before finalizing request validation.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-08-31T21:24:25.000+00:00","Convert plain text reports into styled, tagged PDFs with Java and control whether lines are preserved or reflowed.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Convert Plain Text to PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-java\u002F\",\n      \"datePublished\": \"2026-08-31T21:24:25.000Z\",\n      \"dateModified\": \"2026-09-01T05:07:06.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert plain text reports into styled, tagged PDFs with Java and control whether lines are preserved or reflowed.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, Java\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Plain Text to PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7003,7004,7005,7006,7007,7008,7009,7010],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1430,"name":1431,"slug":1432,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-plain-text-to-pdf-with-java\u002F","How to Convert Plain Text to PDF with Java, Tutorial | pdfRest",{"id":7015,"uuid":7016,"title":7017,"slug":7018,"html":7019,"comment_id":7015,"feature_image":48,"featured":284,"visibility":1257,"created_at":7020,"updated_at":7021,"published_at":7022,"custom_excerpt":7023,"codeinjection_head":7024,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7025,"primary_tag":7034,"url":7035,"excerpt":7023,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7036,"meta_description":7023,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a95f0eb533c9f26b943acea","b389ea6e-be9d-4c11-8b0c-008d0fcb268d","How to Convert Plain Text to PDF with JavaScript in NodeJS","how-to-convert-plain-text-to-pdf-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This NodeJS example uses JavaScript to upload plain text to the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. Structured options preserve existing lines, establish the PDF’s page design, and request tagged output as part of the multipart call.\u003C\u002Fp>\n\n\u003Ch2>Why Convert Plain Text to PDF with JavaScript in NodeJS?\u003C\u002Fh2>\n\n\u003Cp>Web services often assemble transcripts, notifications, and generated summaries as plain text because it is simple and interoperable. Once that information needs to leave the application, a raw \u003Ccode>.txt\u003C\u002Fcode> download may feel unfinished and can be difficult to include in a broader document workflow.\u003C\u002Fp>\n\n\u003Cp>Consider a customer-support platform that exports a conversation transcript containing timestamps, agent names, and message boundaries. Its NodeJS backend can preserve those lines while converting the transcript into a PDF for escalation or customer delivery. The result opens consistently and can be retained with screenshots, forms, and other PDF case materials.\u003C\u002Fp>\n\n\u003Cp>For automatically generated status narratives, the application can select reflow mode and allow the text to wrap as paragraphs instead. JavaScript code can therefore support both transcript fidelity and reader-friendly prose without implementing pagination or font layout itself.\u003C\u002Fp>\n\n\u003Ch2>JavaScript Code Example for Converting Plain Text to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar fs = require(\"fs\");\nvar FormData = require(\"form-data\");\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n\u002F\u002F This sample converts plain text input to a tagged PDF through multipart \u002Fpdf.\n\u002F\u002F It demonstrates structured_text_options and the format-specific conversion options.\nvar inputPath = \"\u002Fpath\u002Fto\u002Fsample.txt\";\nvar form = new FormData();\nform.append(\"file\", fs.createReadStream(inputPath));\nform.append(\"structured_text_options\", JSON.stringify({\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"plain_text\":{\"line_handling\":\"preserve\"}}));\nform.append(\"output\", \"pdf_from_text\");\n\naxios.post(apiUrl + \"\u002Fpdf\", form, { headers: { \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", ...form.getHeaders() }, maxBodyLength: Infinity })\n.then((response) => { console.log(JSON.stringify(response.data, null, 2)); })\n.catch((error) => { console.error(error.response ? error.response.data : error.message); process.exitCode = 1; });\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-text.js\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The NodeJS Plain Text walkthrough uses \u003Ccode>axios\u003C\u002Fcode>, \u003Ccode>form-data\u003C\u002Fcode>, and Node’s file-system module. Outside the samples project, install its HTTP and multipart dependencies with \u003Ccode>npm install axios form-data\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar fs = require(\"fs\");\nvar FormData = require(\"form-data\");\u003C\u002Fpre>\n\n\u003Cp>This NodeJS excerpt keeps the regional endpoint visible for the Plain Text workflow:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\u003C\u002Fpre>\n\n\u003Cp>JavaScript streams the .txt source into the form while preserving its filename. pdfRest infers Plain Text conversion from that extension, so \u003Ccode>structured_text_options\u003C\u002Fcode> does not need an \u003Ccode>input_format\u003C\u002Fcode> property.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F It demonstrates structured_text_options and the format-specific conversion options.\nvar inputPath = \"\u002Fpath\u002Fto\u002Fsample.txt\";\nvar form = new FormData();\u003C\u002Fpre>\n\n\u003Cp>The object passed through \u003Ccode>JSON.stringify\u003C\u002Fcode> is interpreted by pdfRest as \u003Ccode>structured_text_options\u003C\u002Fcode>. It sets PDF metadata, explicitly enables tagging, defines Letter portrait geometry and margins, and supplies the font and color choices used when laying out the Plain Text content.\u003C\u002Fp>\n\n\u003Cpre class=\"language-json\">{\n  \"plain_text\": {\n    \"line_handling\": \"preserve\"\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>preserve\u003C\u002Fcode> keeps every normalized source line and its spacing in a preformatted block. Windows and legacy carriage-return line endings are normalized consistently. The alternative \u003Ccode>reflow\u003C\u002Fcode> joins consecutive nonblank lines into paragraphs, using blank lines as paragraph boundaries; \u003Ccode>reflow\u003C\u002Fcode> is the default when the field is omitted. Only those two values are accepted. When horizontal alignment matters, select a monospaced body font because preserve mode retains characters and spacing but does not force a particular font.\u003C\u002Fp>\n\n\u003Cp>The sample also carries \u003Ccode>style.table\u003C\u002Fcode> because the repository uses one broad structured-text profile. Plain Text does not create a table, so those table colors, borders, widths, and padding have no effect and may be omitted from a text-only integration.\u003C\u002Fp>\n\n\u003Cp>NodeJS uses \u003Ccode>FormData\u003C\u002Fcode> to append the Plain Text file, stringified \u003Ccode>structured_text_options\u003C\u002Fcode>, and output name. The generated form headers provide the multipart boundary for those fields.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var inputPath = \"\u002Fpath\u002Fto\u002Fsample.txt\";\nvar form = new FormData();\nform.append(\"file\", fs.createReadStream(inputPath));\nform.append(\"structured_text_options\", JSON.stringify({\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"plain_text\":{\"line_handling\":\"preserve\"}}));\nform.append(\"output\", \"pdf_from_text\");\n\naxios.post(apiUrl + \"\u002Fpdf\", form, { headers: { \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", ...form.getHeaders() }, maxBodyLength: Infinity })\n.then((response) => { console.log(JSON.stringify(response.data, null, 2)); })\n.catch((error) => { console.error(error.response ? error.response.data : error.message); process.exitCode = 1; });\u003C\u002Fpre>\n\n\u003Cp>Axios sends the Plain Text request to \u003Ccode>\u002Fpdf\u003C\u002Fcode> with the form headers and \u003Ccode>Api-Key\u003C\u002Fcode>. Its success path prints resource JSON, while the rejection path exposes either the API response or the client-side error.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">form.append(\"file\", fs.createReadStream(inputPath));\nform.append(\"structured_text_options\", JSON.stringify({\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"plain_text\":{\"line_handling\":\"preserve\"}}));\nform.append(\"output\", \"pdf_from_text\");\n\naxios.post(apiUrl + \"\u002Fpdf\", form, { headers: { \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", ...form.getHeaders() }, maxBodyLength: Infinity })\n.then((response) => { console.log(JSON.stringify(response.data, null, 2)); })\n.catch((error) => { console.error(error.response ? error.response.data : error.message); process.exitCode = 1; });\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>NodeJS applications can turn support transcripts, application output, or dynamically assembled text into PDFs without introducing a separate document renderer. Logical tags can assist navigation and later processing, although they are not a PDF\u002FUA or WCAG guarantee.\u003C\u002Fp>\n\n\u003Cp>Remove optional style controls when the service only needs a simple text conversion. \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> provides an interactive place to try the request, and the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF documentation\u003C\u002Fa> lists every accepted field.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-08-31T21:23:55.000+00:00","2026-09-02T18:28:11.000+00:00","2026-08-31T21:23:56.000+00:00","Create styled and tagged PDFs from plain text in NodeJS with configurable line preservation and paragraph reflow.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert Plain Text to PDF with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2026-08-31T21:23:56.000Z\",\n      \"dateModified\": \"2026-09-01T05:07:06.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Create styled and tagged PDFs from plain text in NodeJS with configurable line preservation and paragraph reflow.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, JavaScript\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Plain Text to PDF with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7026,7027,7028,7029,7030,7031,7032,7033],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1430,"name":1431,"slug":1432,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-plain-text-to-pdf-with-javascript-in-nodejs\u002F","How to Convert Plain Text to PDF with JavaScript in NodeJS, Tutorial | pdfRest",{"id":7038,"uuid":7039,"title":7040,"slug":7041,"html":7042,"comment_id":7038,"feature_image":48,"featured":284,"visibility":1257,"created_at":7043,"updated_at":7021,"published_at":7043,"custom_excerpt":7044,"codeinjection_head":7045,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7046,"primary_tag":7055,"url":7056,"excerpt":7044,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7057,"meta_description":7044,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a95f0a3533c9f26b943acd6","1e9f4e58-3b91-4ac9-9267-f3a4c6ee6031","How to Convert Plain Text to PDF with PHP","how-to-convert-plain-text-to-pdf-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This PHP tutorial converts a plain text upload through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. The sample retains source line breaks and supplies the page, font, language, and tagging options needed for consistent PDF output.\u003C\u002Fp>\n\n\u003Ch2>Why Convert Plain Text to PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>PHP applications frequently build case notes, order summaries, and form-derived records as simple text. Plain text is easy to generate, but users may need a formal download that can be emailed, annotated, printed, or stored with other customer documents.\u003C\u002Fp>\n\n\u003Cp>A case-management portal illustrates the need: after an agent completes an intake workflow, PHP can assemble the submitted answers and system notes into a text summary. Converting that file to PDF creates a durable case artifact with a title, controlled margins, and predictable pagination, avoiding a manually assembled document for every submission.\u003C\u002Fp>\n\n\u003Cp>Preserve mode is appropriate when each answer or label must remain on its own line. Reflow mode is available when the generated content should read as continuous prose, giving the portal control over readability without changing the underlying source format.\u003C\u002Fp>\n\n\u003Ch2>PHP Code Example for Converting Plain Text to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n$inputPath = '\u002Fpath\u002Fto\u002Fsample.txt';\n$options = json_decode('{\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"plain_text\":{\"line_handling\":\"preserve\"}}', true);\n\n\u002F\u002F This sample converts plain text input to a tagged PDF through multipart \u002Fpdf.\n\u002F\u002F It demonstrates structured_text_options and the format-specific conversion options.\n$multipart = [\n  ['name' => 'file', 'contents' => Utils::tryFopen($inputPath, 'r'), 'filename' => basename($inputPath)],\n  ['name' => 'structured_text_options', 'contents' => json_encode($options)],\n  ['name' => 'output', 'contents' => 'pdf_from_text'],\n];\n$response = (new Client())->post($apiUrl . '\u002Fpdf', ['headers' => ['Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'Accept' => 'application\u002Fjson'], 'multipart' => $multipart]);\necho $response->getBody();\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-text.php\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This PHP Plain Text example relies on Guzzle for HTTP and PSR-7 stream utilities for the upload. When using the code outside this repository, add the client with \u003Ccode>composer require guzzlehttp\u002Fguzzle\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\u003C\u002Fpre>\n\n\u003Cp>The PHP endpoint excerpt keeps regional routing explicit for this Plain Text operation:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\u003C\u002Fpre>\n\n\u003Cp>PHP opens the .txt source as a PSR-7 stream and includes its filename in the multipart part. The extension selects Plain Text processing without duplicating the format in the options JSON.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$inputPath = '\u002Fpath\u002Fto\u002Fsample.txt';\n$options = json_decode('{\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"plain_text\":{\"line_handling\":\"preserve\"}}', true);\u003C\u002Fpre>\n\n\u003Cp>The array decoded into \u003Ccode>$options\u003C\u002Fcode> is serialized as pdfRest’s \u003Ccode>structured_text_options\u003C\u002Fcode>. It describes the PDF title and language, explicitly turns on tagging, chooses Letter portrait pages with 36-point margins, and provides typography plus Plain Text-specific styling.\u003C\u002Fp>\n\n\u003Cpre class=\"language-json\">{\n  \"plain_text\": {\n    \"line_handling\": \"preserve\"\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>preserve\u003C\u002Fcode> keeps every normalized source line and its spacing in a preformatted block. Windows and legacy carriage-return line endings are normalized consistently. The alternative \u003Ccode>reflow\u003C\u002Fcode> joins consecutive nonblank lines into paragraphs, using blank lines as paragraph boundaries; \u003Ccode>reflow\u003C\u002Fcode> is the default when the field is omitted. Only those two values are accepted. When horizontal alignment matters, select a monospaced body font because preserve mode retains characters and spacing but does not force a particular font.\u003C\u002Fp>\n\n\u003Cp>The sample also carries \u003Ccode>style.table\u003C\u002Fcode> because the repository uses one broad structured-text profile. Plain Text does not create a table, so those table colors, borders, widths, and padding have no effect and may be omitted from a text-only integration.\u003C\u002Fp>\n\n\u003Cp>The PHP multipart array assigns \u003Ccode>name\u003C\u002Fcode> and \u003Ccode>contents\u003C\u002Fcode> values to the Plain Text stream, serialized \u003Ccode>structured_text_options\u003C\u002Fcode>, and requested output name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">\u002F\u002F It demonstrates structured_text_options and the format-specific conversion options.\n$multipart = [\n  ['name' => 'file', 'contents' => Utils::tryFopen($inputPath, 'r'), 'filename' => basename($inputPath)],\n  ['name' => 'structured_text_options', 'contents' => json_encode($options)],\n  ['name' => 'output', 'contents' => 'pdf_from_text'],\n];\n$response = (new Client())->post($apiUrl . '\u002Fpdf', ['headers' => ['Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'Accept' => 'application\u002Fjson'], 'multipart' => $multipart]);\necho $response->getBody();\u003C\u002Fpre>\n\n\u003Cp>Guzzle prepares and submits the Plain Text multipart body with the API key. The response body contains generated-resource information on success and service error details when the conversion cannot be completed.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">  ['name' => 'file', 'contents' => Utils::tryFopen($inputPath, 'r'), 'filename' => basename($inputPath)],\n  ['name' => 'structured_text_options', 'contents' => json_encode($options)],\n  ['name' => 'output', 'contents' => 'pdf_from_text'],\n];\n$response = (new Client())->post($apiUrl . '\u002Fpdf', ['headers' => ['Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'Accept' => 'application\u002Fjson'], 'multipart' => $multipart]);\necho $response->getBody();\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>PHP systems can generate PDFs from exported notes, server reports, and plain-text correspondence while preserving deliberate spacing where it matters. Tagged output supports structural interpretation, but further evaluation is required before making an accessibility claim.\u003C\u002Fp>\n\n\u003Cp>The conversion profile can be shortened for applications that do not need the full sample styling. Try a representative source in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, and verify available controls in the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API documentation\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-08-31T21:22:43.000+00:00","Use PHP to transform plain text into a styled, tagged PDF with preserved lines or reflowed paragraphs.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-php\u002F#article\",\n      \"headline\": \"How to Convert Plain Text to PDF with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-php\u002F\",\n      \"datePublished\": \"2026-08-31T21:22:43.000Z\",\n      \"dateModified\": \"2026-09-01T05:07:07.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Use PHP to transform plain text into a styled, tagged PDF with preserved lines or reflowed paragraphs.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Plain Text to PDF with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7047,7048,7049,7050,7051,7052,7053,7054],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1430,"name":1431,"slug":1432,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-plain-text-to-pdf-with-php\u002F","How to Convert Plain Text to PDF with PHP, Tutorial | pdfRest",{"id":7059,"uuid":7060,"title":7061,"slug":7062,"html":7063,"comment_id":7059,"feature_image":48,"featured":284,"visibility":1257,"created_at":7064,"updated_at":7065,"published_at":7064,"custom_excerpt":7066,"codeinjection_head":7067,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7068,"primary_tag":7077,"url":7078,"excerpt":7066,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7079,"meta_description":7066,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a95f093533c9f26b943accc","157418bb-6185-42f1-86a0-17075ed6b112","How to Convert Plain Text to PDF with Python","how-to-convert-plain-text-to-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This Python tutorial sends a plain text file and structured conversion settings to the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. It creates tagged output, preserves intentional source lines, and controls document metadata and visual presentation.\u003C\u002Fp>\n\n\u003Ch2>Why Convert Plain Text to PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>Data pipelines and automation scripts often record validation findings, processing manifests, and experiment summaries in plain text. That output is convenient for machines and developers, but a PDF is easier to deliver as evidence, circulate for approval, or combine with other project documentation.\u003C\u002Fp>\n\n\u003Cp>Suppose a Python data-quality job checks thousands of incoming records and writes a summary containing rule names, counts, and representative failures. After the run, the same workflow can convert the summary into a PDF for the data steward’s review packet. Preserved line handling keeps each finding distinct, while consistent page settings make recurring reports easier to compare.\u003C\u002Fp>\n\n\u003Cp>A script producing longer narrative observations can request reflow instead and let the service form readable paragraphs. This gives Python automation an intentional text-layout choice while retaining centralized control over fonts, margins, language metadata, and tagging.\u003C\u002Fp>\n\n\u003Ch2>Python Code Example for Converting Plain Text to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">import json\nimport os\nimport requests\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# This sample converts plain text input to a tagged PDF through multipart \u002Fpdf.\n# It demonstrates structured_text_options and the format-specific conversion options.\ninput_path = \"\u002Fpath\u002Fto\u002Fsample.txt\"\noptions = json.loads(r'''{\n  \"title\": \"Structured Content Sample\",\n  \"language\": \"en-US\",\n  \"enable_tagging\": true,\n  \"page_setup\": {\n    \"size\": \"Letter\",\n    \"orientation\": \"portrait\",\n    \"margin\": {\n      \"top\": 36,\n      \"right\": 42,\n      \"bottom\": 36,\n      \"left\": 42\n    }\n  },\n  \"style\": {\n    \"font\": \"Arial\",\n    \"heading_font\": \"Arial\",\n    \"code_font\": \"Courier\",\n    \"text_size\": 11,\n    \"text_color_rgb\": [\n      34,\n      34,\n      34\n    ],\n    \"heading_scale\": 1.35,\n    \"table\": {\n      \"column_width_weights\": [\n        2,\n        3,\n        2\n      ],\n      \"keep_header_with_first_row\": true,\n      \"repeat_headers_on_overflow\": true,\n      \"show_borders\": true,\n      \"border_width\": 0.75,\n      \"border_color_rgb\": [\n        180,\n        188,\n        200\n      ],\n      \"header_fill_color_rgb\": [\n        33,\n        64,\n        98\n      ],\n      \"header_text_color_rgb\": [\n        255,\n        255,\n        255\n      ],\n      \"row_fill_color_rgb\": [\n        250,\n        250,\n        252\n      ],\n      \"alternate_row_fill_color_rgb\": [\n        235,\n        240,\n        246\n      ],\n      \"cell_padding\": {\n        \"top\": 6,\n        \"right\": 8,\n        \"bottom\": 6,\n        \"left\": 8\n      }\n    }\n  },\n  \"plain_text\": {\n    \"line_handling\": \"preserve\"\n  }\n}''')\n\nfrom requests_toolbelt import MultipartEncoder\nwith open(input_path, \"rb\") as input_file:\n    fields = {\n        \"file\": (os.path.basename(input_path), input_file, \"text\u002Fplain\"),\n        \"structured_text_options\": json.dumps(options),\n    }\n    form = MultipartEncoder(fields=fields)\n    response = requests.post(api_url + \"\u002Fpdf\", data=form, headers={\n        \"Accept\": \"application\u002Fjson\",\n        \"Content-Type\": form.content_type,\n        \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    })\n\nprint(\"Response status code: \" + str(response.status_code))\nif response.ok:\n    print(json.dumps(response.json(), indent=2))\nelse:\n    print(response.text)\n    raise SystemExit(1)\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-text.py\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The Python Plain Text sample uses \u003Ccode>requests\u003C\u002Fcode> and \u003Ccode>MultipartEncoder\u003C\u002Fcode> from \u003Ccode>requests-toolbelt\u003C\u002Fcode>. Install both with \u003Ccode>python -m pip install requests requests-toolbelt\u003C\u002Fcode> when they are not already present.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">import json\nimport os\nimport requests\u003C\u002Fpre>\n\n\u003Cp>This Python endpoint excerpt identifies the regional service used for Plain Text conversion:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\"># By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>Python opens the .txt input in binary mode and sends its base filename with the stream. \u003Ccode>\u002Fpdf\u003C\u002Fcode> uses that filename extension to infer the Plain Text input type.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\"># It demonstrates structured_text_options and the format-specific conversion options.\ninput_path = \"\u002Fpath\u002Fto\u002Fsample.txt\"\noptions = json.loads(r'''{\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>options\u003C\u002Fcode> dictionary becomes pdfRest’s \u003Ccode>structured_text_options\u003C\u002Fcode> field. It supplies document metadata, explicitly requests tags, establishes Letter portrait pages and 36-point margins, and selects the fonts, text size, color, and Plain Text-specific presentation values.\u003C\u002Fp>\n\n\u003Cpre class=\"language-json\">{\n  \"plain_text\": {\n    \"line_handling\": \"preserve\"\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>preserve\u003C\u002Fcode> keeps every normalized source line and its spacing in a preformatted block. Windows and legacy carriage-return line endings are normalized consistently. The alternative \u003Ccode>reflow\u003C\u002Fcode> joins consecutive nonblank lines into paragraphs, using blank lines as paragraph boundaries; \u003Ccode>reflow\u003C\u002Fcode> is the default when the field is omitted. Only those two values are accepted. When horizontal alignment matters, select a monospaced body font because preserve mode retains characters and spacing but does not force a particular font.\u003C\u002Fp>\n\n\u003Cp>The sample also carries \u003Ccode>style.table\u003C\u002Fcode> because the repository uses one broad structured-text profile. Plain Text does not create a table, so those table colors, borders, widths, and padding have no effect and may be omitted from a text-only integration.\u003C\u002Fp>\n\n\u003Cp>For the Plain Text call, \u003Ccode>MultipartEncoder\u003C\u002Fcode> combines the file tuple with serialized \u003Ccode>structured_text_options\u003C\u002Fcode>. Its \u003Ccode>content_type\u003C\u002Fcode>, including the boundary, becomes the request’s \u003Ccode>Content-Type\u003C\u002Fcode> header.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">with open(input_path, \"rb\") as input_file:\n    fields = {\n        \"file\": (os.path.basename(input_path), input_file, \"text\u002Fplain\"),\n        \"structured_text_options\": json.dumps(options),\n    }\n    form = MultipartEncoder(fields=fields)\n    response = requests.post(api_url + \"\u002Fpdf\", data=form, headers={\n        \"Accept\": \"application\u002Fjson\",\n        \"Content-Type\": form.content_type,\n        \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    })\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>requests.post\u003C\u002Fcode> sends the encoded Plain Text form with the API key. The script pretty-prints resource JSON after success and otherwise displays the API message before exiting with a nonzero status.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">        \"file\": (os.path.basename(input_path), input_file, \"text\u002Fplain\"),\n        \"structured_text_options\": json.dumps(options),\n    }\n    form = MultipartEncoder(fields=fields)\n    response = requests.post(api_url + \"\u002Fpdf\", data=form, headers={\n        \"Accept\": \"application\u002Fjson\",\n        \"Content-Type\": form.content_type,\n        \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    })\n\nprint(\"Response status code: \" + str(response.status_code))\nif response.ok:\n    print(json.dumps(response.json(), indent=2))\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>Python automation can convert test output, research notes, and scheduled text exports into consistently paginated PDFs while selecting preserve or reflow behavior for each source. Document tags help expose structure but are not an accessibility certification.\u003C\u002Fp>\n\n\u003Cp>Keep only the structured options that serve the workflow’s layout requirements. Compare results through \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, then consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF documentation\u003C\u002Fa> for defaults, accepted values, and constraints.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-08-31T21:22:27.000+00:00","2026-09-02T18:28:12.000+00:00","Turn plain text output into styled, tagged PDF documents with Python using preserved-line or reflowed layout.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Convert Plain Text to PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-python\u002F\",\n      \"datePublished\": \"2026-08-31T21:22:27.000Z\",\n      \"dateModified\": \"2026-09-01T05:07:08.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Turn plain text output into styled, tagged PDF documents with Python using preserved-line or reflowed layout.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert Plain Text to PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-plain-text-to-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7069,7070,7071,7072,7073,7074,7075,7076],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1430,"name":1431,"slug":1432,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-plain-text-to-pdf-with-python\u002F","How to Convert Plain Text to PDF with Python, Tutorial | pdfRest",{"id":7081,"uuid":7082,"title":7083,"slug":7084,"html":7085,"comment_id":7081,"feature_image":48,"featured":284,"visibility":1257,"created_at":7086,"updated_at":7065,"published_at":7086,"custom_excerpt":7087,"codeinjection_head":7088,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7089,"primary_tag":7094,"url":7095,"excerpt":7087,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7096,"meta_description":7087,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65c556bf533c9f26b94361a3","859add05-1add-4810-a55c-5e1c6c3a5d6d","How to Convert PNG to PDF in .NET with C#","how-to-convert-png-to-pdf-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PNG to PDF with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to automate the conversion of images into PDF format. This tutorial will guide you through the process of sending an API call to Convert to PDF using C#.\u003C\u002Fp>\n  \n\u003Cp>A real-world example of using this API could be an application that generates images in various formats, like JPEG or PNG, and needs to convert them into PDFs for standardized distribution, viewer compatibility, or archival purposes.\u003C\u002Fp>\n\n\u003Ch2>Convert PNG to PDF with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.png\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file.png\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"image\u002Fpng\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"output.pdf\"));\n        multipartContent.Add(byteArrayOption, \"output\");\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.cs\">pdfRest API C# code sample\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code block above demonstrates how to make a multipart\u002Fform-data POST request to the pdfRest API to convert a document to PDF.\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Ccode>HttpClient\u003C\u002Fcode> is initialized with the base address of the pdfRest API.\u003C\u002Fli>\n\u003Cli>An \u003Ccode>HttpRequestMessage\u003C\u002Fcode> is configured for a POST request to the \"pdf\" endpoint.\u003C\u002Fli>\n\u003Cli>The API key is added to the request headers, replacing \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" with your actual API key.\u003C\u002Fli>\n\u003Cli>The content-type is set to accept JSON responses.\u003C\u002Fli>\n\u003Cli>A \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> object is created to hold the file and options.\u003C\u002Fli>\n\u003Cli>The file to be converted is read into a byte array and added to the multipart content with the name \"file\" and a specified \"file_name\".\u003C\u002Fli>\n\u003Cli>The content-type for the file is set to \"text\u002Fhtml\", indicating the type of the input file.\u003C\u002Fli>\n\u003Cli>Additional options, such as \"page_size\" and \"output\" (the desired output file name), are added to the multipart content.\u003C\u002Fli>\n\u003Cli>The multipart content is set as the request content, and the request is sent asynchronously.\u003C\u002Fli>\n\u003Cli>The API response is read as a string and printed to the console.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>Each parameter in the request is essential for the API to understand what is being sent and how to process it. The \"page_size\" and \"output\" are part of the conversion options you can specify. Refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">pdfRest Cloud API Reference Guide\u003C\u002Fa> for more details on the available options.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you've learned how to use C# to call the pdfRest Convert to PDF API. This allows you to integrate PDF conversion functionality into your applications seamlessly. You are encouraged to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for further exploration of the API's capabilities.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.cs\">JSON payload examples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-08T22:33:35.000+00:00","Learn how to convert PNG images to PDF documents by calling the Convert to PDF API Tool in .NET.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert PNG to PDF in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-02-08T22:33:35.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:50.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert PNG images to PDF documents by calling the Convert to PDF API Tool in .NET.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Convert to PDF\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PNG to PDF in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7090,7091,7092,7093],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-png-to-pdf-in-net-with-c\u002F","How to Convert PNG to PDF in .NET with C#, Tutorial | pdfRest",{"id":7098,"uuid":7099,"title":7100,"slug":7101,"html":7102,"comment_id":7098,"feature_image":48,"featured":284,"visibility":1257,"created_at":7103,"updated_at":7104,"published_at":7103,"custom_excerpt":7105,"codeinjection_head":7106,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7107,"primary_tag":7112,"url":7113,"excerpt":7105,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7114,"meta_description":7105,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65c55522533c9f26b943618e","6768e845-a44e-4b2c-9891-0f1b559a328e","How to Convert PNG to PDF in PHP","how-to-convert-png-to-pdf-in-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PNG to PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool\u003C\u002Fa> is a powerful resource that allows developers to convert various file formats into PDFs programmatically. By integrating this API, PHP developers can automate the process of converting documents to PDF, which is a widely accepted format for sharing and archiving files.\u003C\u002Fp>\n\n\u003Cp>For instance, a user might need to convert a batch of PNG images into PDFs for a presentation or ensure that invoices generated by their application are in a format that is both print-ready and universally accessible.\u003C\u002Fp>\n\n\u003Ch2>Convert PNG to PDF with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_pdf'\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source of the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.php\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by loading the required Guzzle HTTP client library and setting up the necessary namespaces. A new client instance is created, and the API key is set in the headers for authentication:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The options array is constructed with multipart form data, specifying the file to be converted and various conversion options:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">'options' => [\n  'multipart' => [\n    \u002F\u002F ...multipart form data...\n  ]\n];\n\u003C\u002Fpre>\n\n\u003Cp>Each multipart entry includes a 'name' and 'contents' key. The 'file' entry also includes a 'filename' and 'headers' key to specify the file's content type. The other entries set conversion options like 'compression', 'downsample', 'tagged_pdf', and 'output'.\u003C\u002Fp>\n\n\u003Cp>A new POST request is created with the API endpoint and headers, and the request is sent asynchronously. The response body is then echoed, which contains the processed PDF content.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial demonstrated how to make an API call to the pdfRest Convert to PDF API using PHP. By sending a multipart request, we've instructed the API to convert a file to PDF with specific options such as compression and downsampling settings.\u003C\u002Fp>\n\n\u003Cp>To explore and demo all of the pdfRest API Tools, visit the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\u003C\u002Fa>. For more detailed information on the API and its capabilities, refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.php\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-08T22:26:42.000+00:00","2026-09-10T20:19:10.000+00:00","Learn how to convert PNG images into PDF documents in PHP by calling the Convert to PDF API Tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-in-php\u002F#article\",\n      \"headline\": \"How to Convert PNG to PDF in PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-in-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-in-php\u002F\",\n      \"datePublished\": \"2024-02-08T22:26:42.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:50.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert PNG images into PDF documents in PHP by calling the Convert to PDF API Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PNG to PDF in PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-in-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7108,7109,7110,7111],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-png-to-pdf-in-php\u002F","How to Convert PNG to PDF in PHP, Tutorial | pdfRest",{"id":7116,"uuid":7117,"title":7118,"slug":7119,"html":7120,"comment_id":7116,"feature_image":48,"featured":284,"visibility":1257,"created_at":7121,"updated_at":7122,"published_at":7121,"custom_excerpt":7123,"codeinjection_head":7124,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7125,"primary_tag":7130,"url":7131,"excerpt":7123,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7132,"meta_description":7123,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65c55577533c9f26b9436198","8686756e-4a59-4f63-b61b-e80f8a368f43","How to Convert PNG to PDF in Python","how-to-convert-png-to-pdf-in-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PNG to PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> offers a convenient way to convert various file types to PDF. This tutorial will guide you through the process of sending an API call to Convert to PDF using Python.\u003C\u002Fp>\n  \n\u003Cp>This can be particularly useful in scenarios where you need to standardize document formats, such as converting invoices, reports, or images to PDF for archival, sharing, or printing purposes. The below example will show how to convert a PNG file to a PDF document.\u003C\u002Fp>\n\n\u003Ch2>Convert PNG to PDF with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\npdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf'\n\nmp_encoder_pdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.png', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'image\u002Fpng'),\n        'output' : 'example_pdf_out',\n    }\n)\n\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\n\nprint(\"Sending POST request to pdf endpoint...\")\nresponse = requests.post(pdf_endpoint_url, data=mp_encoder_pdf, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.py\">pdfRest API Python samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>Let's break down each part of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\u003C\u002Fpre>\n\n\u003Cp>This imports the necessary libraries. \u003Ccode>MultipartEncoder\u003C\u002Fcode> is used for creating multipart\u002Fform-data payloads for the request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf'\n\u003C\u002Fpre>\n\n\u003Cp>This sets the API endpoint URL for the Convert to PDF service.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_pdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.png', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'image\u002Fpng'),\n        'output' : 'example_pdf_out',\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>This creates a \u003Ccode>MultipartEncoder\u003C\u002Fcode> object with the file to convert and the desired output filename.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\n\u003C\u002Fpre>\n\n\u003Cp>Headers include the API key for authentication and content type for the request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(pdf_endpoint_url, data=mp_encoder_pdf, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This sends the POST request to the pdfRest API with the file data and headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the script checks the response status and prints out the JSON response or error message.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you've learned how to use Python to convert files to PDF using the pdfRest API. To explore and demo all of the pdfRest API Tools, visit the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\u003C\u002Fa>. For comprehensive documentation, refer to the API Reference at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.py\">https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.py\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-08T22:28:07.000+00:00","2026-09-02T18:28:13.000+00:00","Learn how to use Python to convert PNG images into PDF documents by calling the Convert to PDF API Tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-in-python\u002F#article\",\n      \"headline\": \"How to Convert PNG to PDF in Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-in-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-in-python\u002F\",\n      \"datePublished\": \"2024-02-08T22:28:07.000Z\",\n      \"dateModified\": \"2026-09-01T14:52:12.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use Python to convert PNG images into PDF documents by calling the Convert to PDF API Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PNG to PDF in Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-in-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7126,7127,7128,7129],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-png-to-pdf-in-python\u002F","How to Convert PNG to PDF in Python, Tutorial | pdfRest",{"id":7134,"uuid":7135,"title":7136,"slug":7137,"html":7138,"comment_id":7134,"feature_image":48,"featured":284,"visibility":1257,"created_at":3992,"updated_at":6520,"published_at":6520,"custom_excerpt":7139,"codeinjection_head":7140,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7141,"primary_tag":7148,"url":7149,"excerpt":7139,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7150,"meta_description":7139,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a9750cb533c9f26b943b755","26e3a437-4b42-4390-bb28-29faefd7d7ee","How to Convert PNG to PDF with cURL","how-to-convert-png-to-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Cp>Learn how to convert PNG to PDF with cURL and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool\u003C\u002Fa>. We'll move from the local input and service URL through the multipart request, then explain how the returned resource supports later processing after you convert PNG to PDF.\u003C\u002Fp>\n\n\u003Ch2>Why Convert PNG to PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>Screenshots, diagrams, and lossless scans are commonly stored as PNG files, while formal reports and case packets are usually assembled as PDFs. Conversion makes the image easier to combine with pages from other document sources.\u003C\u002Fp>\n\n\u003Cp>A support system might capture a troubleshooting screenshot and later include it in an incident report. Converting the PNG first produces a managed PDF resource that can be merged, protected, downloaded, or passed to another pdfRest operation.\u003C\u002Fp>\n\n\u003Cp>The example sends one PNG through the shared \u003Ccode>\u002Fpdf\u003C\u002Fcode> endpoint. If several images belong in one document, convert each separately and merge the resulting PDF resource IDs in the desired page order.\u003C\u002Fp>\n\n\u003Ch2>cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\ncurl -X POST \"$API_URL\u002Fpdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Finput.png\" \\\n  -F \"output=pdfrest_png_to_pdf\"\u003C\u002Fpre>\n\n\u003Cp>Source for Convert PNG to PDF: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.sh\">View the cURL sample on GitHub\u003C\u002Fa>. The repository's generic Convert to PDF scaffold is configured here with a \u003Ccode>.png\u003C\u002Fcode> input for this tutorial.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Choose the pdfRest service region\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>This PNG workflow uses the US service unless the commented EU hostname is selected. A resource created in one environment cannot be handed to a later call in the other, so keep the conversion chain regional.\u003C\u002Fp>\n\n\u003Ch3>Build the authenticated multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"$API_URL\u002Fpdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\u003C\u002Fpre>\n\n\u003Cp>The command combines the PNG file and output name in one multipart POST to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. \u003Ccode>Accept\u003C\u002Fcode> selects a JSON response, and the API key header authenticates the shell request.\u003C\u002Fp>\n\n\u003Ch3>Upload the input file data\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Finput.png\" \\\u003C\u002Fpre>\n\n\u003Cp>The Convert PNG to PDF request reads the local source from the path after \u003Ccode>@\u003C\u002Fcode> and sends its bytes in the multipart \u003Ccode>file\u003C\u002Fcode> field. For Convert PNG to PDF, cURL treats the path as an upload rather than ordinary form text.\u003C\u002Fp>\n\n\u003Ch3>Set the operation-specific fields\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">-F \"output=pdfrest_png_to_pdf\"\u003C\u002Fpre>\n\n\u003Cp>Here, \u003Ccode>output\u003C\u002Fcode> gives the generated PDF a useful requested name. No separate format parameter is needed because the uploaded \u003Ccode>.png\u003C\u002Fcode> filename already identifies the input.\u003C\u002Fp>\n\n\u003Ch3>Read the generated resource response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"$API_URL\u002Fpdf\" \\\u003C\u002Fpre>\n\n\u003Cp>The PNG request produces a managed PDF resource rather than returning PDF bytes inside JSON. Read its output ID or download URL promptly so the converted screenshot or diagram can move to the next workflow stage.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>After following the example, you can convert a PNG into a PDF without adding local image or PDF rendering software to the shell environment.\u003C\u002Fp>\n\n\u003Cp>Pixel dimensions and embedded resolution affect how an image occupies the generated PDF page. Check screenshots and scans from several sources so orientation, scale, and readability remain predictable.\u003C\u002Fp>\n\n\u003Cp>Continue exploring the Convert PNG to PDF workflow in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the complete Convert PNG to PDF request contract, accepted values, defaults, and limitations, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: The Convert PNG to PDF example above uploads a file with multipart form data. For source content already stored in pdfRest, the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.sh\">Convert PNG to PDF JSON payload example\u003C\u002Fa> shows the resource-ID request shape.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","See how to convert a PNG screenshot, scan, or diagram into a PDF resource with cURL and the pdfRest API.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Convert PNG to PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-with-curl\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"See how to convert a PNG screenshot, scan, or diagram into a PDF resource with cURL and the pdfRest API.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, PNG, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PNG to PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7142,7143,7144,7145,7146,7147],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1546,"name":1547,"slug":1548,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-png-to-pdf-with-curl\u002F","How to Convert PNG to PDF with cURL, Tutorial | pdfRest",{"id":7152,"uuid":7153,"title":7154,"slug":7155,"html":7156,"comment_id":7152,"feature_image":48,"featured":284,"visibility":1257,"created_at":7157,"updated_at":7122,"published_at":7158,"custom_excerpt":7159,"codeinjection_head":7160,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7161,"primary_tag":7166,"url":7167,"excerpt":7159,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7168,"meta_description":7159,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c5c533c9f26b943b52d","1eb7dc1d-4efa-45c6-8d99-8c1075abbca5","How to Convert PNG to PDF with Java","how-to-convert-png-to-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>Follow this Java walkthrough to convert PNG to PDF with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool\u003C\u002Fa>. The sample adapts \u003Ccode>\u002Fpdf\u003C\u002Fcode> for a PNG source by preserving the image filename and sending the correct media type. Along the way, you'll see which fields are needed to convert PNG to PDF and how the response fits into later processing.\u003C\u002Fp>\n\n\u003Ch2>Why Convert PNG to PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>Support and QA systems frequently capture PNG screenshots that later need to become part of a formal report. PDF conversion creates a document resource that can be merged, protected, or archived with related material.\u003C\u002Fp>\n\n\u003Cp>The adapted Java sample sends the \u003Ccode>.png\u003C\u002Fcode> file to \u003Ccode>\u002Fpdf\u003C\u002Fcode> with the \u003Ccode>image\u002Fpng\u003C\u002Fcode> media type. The output PDF is returned as a managed resource.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class ConvertPNGToPDF {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.png\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"image\u002Fpng\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_png_to_pdf\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPDF.java\">Java sample on GitHub\u003C\u002Fa>. The walkthrough specializes the reusable repository sample for Convert PNG to PDF.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The library group assigns a clear role to each library: HTTP communication, credential lookup, or JSON handling.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.png\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>This initialization step keeps a visible default path, accepts an override from the command line, and reads the API key through dotenv.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"image\u002Fpng\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_png_to_pdf\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The adapted Java sample sends the \u003Ccode>.png\u003C\u002Fcode> file to \u003Ccode>\u002Fpdf\u003C\u002Fcode> with the \u003Ccode>image\u002Fpng\u003C\u002Fcode> media type. The output PDF is returned as a managed resource. The multipart builder leaves boundary construction to OkHttp so the header remains synchronized with the serialized content.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The authenticated call posts the multipart content to pdfRest and keeps deployment-region changes independent of the rest of the Java code.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>The final section prints the HTTP status and JSON body so generated resource IDs or API error details are visible.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial showed how a Java application can convert PNG to PDF. With that foundation, this workflow fits screenshots, diagrams, web captures, and lossless scanned images.\u003C\u002Fp>\n\n\u003Cp>For production use, keep in mind that pixel dimensions and embedded resolution affect how the image occupies the PDF page, so verify screenshots and scans from several sources. Convert multiple PNG files separately and merge their PDF outputs when the final document requires a controlled page order.\u003C\u002Fp>\n\n\u003Cp>Use \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> to inspect the request and output from the Convert PNG to PDF operation. For the complete set of options supported by Convert PNG to PDF, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: The Convert PNG to PDF example above uses multipart form data; for an existing resource rather than a new upload, use the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPDF.java\">JSON payload example\u003C\u002Fa> as a guide.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T17:33:16.000+00:00","2026-09-01T21:57:37.000+00:00","Convert PNG screenshots, diagrams, or scanned pages into PDFs with Java.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Convert PNG to PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:37.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:37.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert PNG screenshots, diagrams, or scanned pages into PDFs with Java.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF, Java\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PNG to PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7162,7163,7164,7165],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-png-to-pdf-with-java\u002F","Convert PNG to PDF with Java | pdfRest",{"id":7170,"uuid":7171,"title":7172,"slug":7173,"html":7174,"comment_id":7170,"feature_image":48,"featured":284,"visibility":1257,"created_at":7175,"updated_at":7176,"published_at":7175,"custom_excerpt":7177,"codeinjection_head":7178,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7179,"primary_tag":7184,"url":7185,"excerpt":7177,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7186,"meta_description":7177,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65c554a0533c9f26b9436184","4ff6c918-a805-439b-a710-bc0c377d24b8","How to Convert PNG to PDF with JavaScript in NodeJS","how-to-convert-png-to-pdf-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert PNG to PDF with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to automate the conversion of various file formats into PDFs. This API allows for seamless integration into applications, enabling users to convert documents without the need for complex software.\u003C\u002Fp>\n\n\u003Cp>A real-world example of why a user might use Convert to PDF is to convert user-uploaded images into a standardized PDF format for easier distribution, archiving, viewing, or printing.\u003C\u002Fp>\n\n\u003Ch2>Convert PNG to PDF with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('compression', 'lossy'); \ndata.append('downsample', '300'); \ndata.append('tagged_pdf', 'off'); \ndata.append('output', 'pdfrest_pdf');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source code reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.js\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This code snippet demonstrates how to use the pdfRest Convert to PDF API with JavaScript:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\u003C\u002Fpre>\n\n\u003Cp>These lines import the required modules: \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests, \u003Ccode>FormData\u003C\u002Fcode> for constructing form data payloads, and \u003Ccode>fs\u003C\u002Fcode> for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\n\u003C\u002Fpre>\n\n\u003Cp>Here, a new \u003Ccode>FormData\u003C\u002Fcode> instance is created, and the file to be converted is appended to it. Replace \u003Ccode>'\u002Fpath\u002Fto\u002Ffile'\u003C\u002Fcode> with the actual file path.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">data.append('compression', 'lossy'); \ndata.append('downsample', '300'); \ndata.append('tagged_pdf', 'off'); \ndata.append('output', 'pdfrest_pdf');\n\u003C\u002Fpre>\n\n\u003Cp>Additional parameters are appended to the form data. These include compression settings, downsampling resolution, whether to create a tagged PDF, and the output format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\n\u003C\u002Fpre>\n\n\u003Cp>This config object includes the HTTP method, URL, headers (including the API key), and the data payload. Replace \u003Ccode>'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\u003C\u002Fcode> with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>axios\u003C\u002Fcode> library is used to send the request. The response is logged to the console, or an error is logged if the request fails.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following this tutorial, you have learned how to send an API call to the pdfRest Convert to PDF API using JavaScript. This enables you to integrate PDF conversion capabilities into your applications. To explore and demo all of the pdfRest API Tools, visit the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\u003C\u002Fa>, and for more detailed information, refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.js\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-08T22:24:32.000+00:00","2026-09-02T18:28:14.000+00:00","Learn how to turn PNG images into PDF documents by calling the Convert to PDF API Tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert PNG to PDF with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-02-08T22:24:32.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:51.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to turn PNG images into PDF documents by calling the Convert to PDF API Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF, JavaScript\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PNG to PDF with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-png-to-pdf-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7180,7181,7182,7183],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-png-to-pdf-with-javascript-in-nodejs\u002F","How to Convert PNG to PDF with JavaScript in NodeJS, Tutorial | pdfRest",{"id":7188,"uuid":7189,"title":7190,"slug":7191,"html":7192,"comment_id":7188,"feature_image":48,"featured":284,"visibility":1257,"created_at":7193,"updated_at":7194,"published_at":6520,"custom_excerpt":7195,"codeinjection_head":7196,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7197,"primary_tag":7204,"url":7205,"excerpt":7195,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7206,"meta_description":7195,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a989aefd1b70dd2e2978a09","7bbf29c4-e66e-4860-9f78-9bdb6e22e7df","How to Convert PostScript to PDF in .NET with C#","how-to-convert-postscript-to-pdf-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This .NET walkthrough uses C# and \u003Ccode>HttpClient\u003C\u002Fcode> to submit the request. It converts a PostScript (\u003Ccode>.ps\u003C\u002Fcode>) file into PDF through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa> and includes a custom \u003Ccode>.joboptions\u003C\u002Fcode> profile. The complete sample is included below so .NET with C# developers can see the file handling, request construction, and response path together.\u003C\u002Fp>\n\n\u003Ch2>Why PostScript to PDF in .NET with C#?\u003C\u002Fh2>\n\n\u003Cp>C# can sit between a PostScript-producing system and a PDF-centric line-of-business application. Converting the \u003Ccode>.ps\u003C\u002Fcode> file at that boundary allows the surrounding .NET workflow to use its usual PDF review, storage, and distribution paths.\u003C\u002Fp>\n\n\u003Cp>A document-assembly service might receive PostScript from a longstanding report engine and apply a team-owned \u003Ccode>.joboptions\u003C\u002Fcode> profile before returning a PDF to an approval portal. The profile is uploaded with the request, so its selection is explicit and auditable.\u003C\u002Fp>\n\n\u003Cp>When the profile is not supplied, the converter uses default settings. The sample’s optional argument is therefore a configuration choice, not a separate conversion feature that requires another endpoint.\u003C\u002Fp>\n\n\u003Ch2>C# Code Example for PostScript to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">\u002F*\n * What this sample does:\n * - Converts PostScript to PDF with a custom .joboptions profile.\n * - A .joboptions file contains Adobe Distiller-compatible conversion settings.\n *   The profile is optional; omit job_options to use default settings.\n * - pdfRest applies a supplied profile with Datalogics PDF Converter SDK.\n *   Datalogics maintains the SDK in partnership with Adobe, using the same\n *   Adobe technology that powers Distiller.\n * - Pair with \u002Fpostscript for PDF refrying: PDF -> PostScript -> PDF. Some print and\n *   prepress workflows use this lossy roundtrip to rebuild or normalize page content.\n *\n * Setup (environment):\n * - Set PDFREST_API_KEY=your_api_key_here\n * - Optional: set PDFREST_URL to override the API region.\n *\n * Usage:\n *   dotnet run -- pdf-from-postscript-multipart \u003CpostscriptFile> \u003CjobOptionsFile>\n *\u002F\nusing System.Net.Http.Headers;\n\nnamespace Samples.EndpointExamples.MultipartPayload;\n\npublic static class PdfFromPostscript\n{\n    public static async Task Execute(string[] args)\n    {\n        var inputPath = args.Length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.ps\";\n        var jobOptionsPath = args.Length > 1 ? args[1] : \"\u002Fpath\u002Fto\u002Fcustom.joboptions\";\n        var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\n        if (string.IsNullOrWhiteSpace(apiKey)) throw new InvalidOperationException(\"Missing PDFREST_API_KEY\");\n        var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n        using var client = new HttpClient { BaseAddress = new Uri(baseUrl) };\n        client.DefaultRequestHeaders.TryAddWithoutValidation(\"Api-Key\", apiKey);\n        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(\"application\u002Fjson\"));\n        using var form = new MultipartFormDataContent();\n        var inputContent = new ByteArrayContent(await File.ReadAllBytesAsync(inputPath));\n        inputContent.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Fpostscript\");\n        form.Add(inputContent, \"file\", Path.GetFileName(inputPath));\n        var jobOptionsContent = new ByteArrayContent(await File.ReadAllBytesAsync(jobOptionsPath));\n        jobOptionsContent.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Foctet-stream\");\n        form.Add(jobOptionsContent, \"job_options\", Path.GetFileName(jobOptionsPath));\n        form.Add(new StringContent(\"pdf_from_postscript\"), \"output\");\n        var response = await client.PostAsync(\"pdf\", form);\n        var result = await response.Content.ReadAsStringAsync();\n        Console.WriteLine(result);\n        if (!response.IsSuccessStatusCode) Environment.ExitCode = 1;\n    }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-postscript.cs\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Configure the service and input\u003C\u002Fh3>\n\n\u003Cpre class=\"language-csharp\">var jobOptionsPath = args.Length > 1 ? args[1] : \"\u002Fpath\u002Fto\u002Fcustom.joboptions\";\n        var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\n        if (string.IsNullOrWhiteSpace(apiKey)) throw new InvalidOperationException(\"Missing PDFREST_API_KEY\");\n        var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n        using var client = new HttpClient { BaseAddress = new Uri(baseUrl) };\n        client.DefaultRequestHeaders.TryAddWithoutValidation(\"Api-Key\", apiKey);\n        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(\"application\u002Fjson\"));\u003C\u002Fpre>\n\n\u003Cp>For this PostScript to PDF example, .NET with C# sends the multipart request to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. The C# samples use framework \u003Ccode>HttpClient\u003C\u002Fcode> APIs and disposable content objects. API credentials come from \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode>, keeping the secret out of the source file and request body. The sample’s placeholder path and API key make the moving pieces visible; replace them with a real local path and protected runtime credential before using the request.\u003C\u002Fp>\n\n\u003Ch3>Apply the PostScript Conversion Profile\u003C\u002Fh3>\n\n\u003Cpre class=\"language-csharp\">form.Add(inputContent, \"file\", Path.GetFileName(inputPath));\n        var jobOptionsContent = new ByteArrayContent(await File.ReadAllBytesAsync(jobOptionsPath));\n        jobOptionsContent.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Foctet-stream\");\n        form.Add(jobOptionsContent, \"job_options\", Path.GetFileName(jobOptionsPath));\n        form.Add(new StringContent(\"pdf_from_postscript\"), \"output\");\n        var response = await client.PostAsync(\"pdf\", form);\n        var result = await response.Content.ReadAsStringAsync();\n        Console.WriteLine(result);\n        if (!response.IsSuccessStatusCode) Environment.ExitCode = 1;\n    }\n}\u003C\u002Fpre>\n\n\u003Cp>Here, .NET with C# sends the PostScript source and the optional profile as separate files. A \u003Ccode>.joboptions\u003C\u002Fcode> file contains Adobe Distiller-compatible conversion settings; pdfRest applies a supplied profile with Datalogics PDF Converter SDK, maintained in partnership with Adobe and using the same Adobe technology that powers Distiller. Omitting \u003Ccode>job_options\u003C\u002Fcode> uses default settings.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-csharp\">client.DefaultRequestHeaders.TryAddWithoutValidation(\"Api-Key\", apiKey);\n        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(\"application\u002Fjson\"));\n        using var form = new MultipartFormDataContent();\n        var inputContent = new ByteArrayContent(await File.ReadAllBytesAsync(inputPath));\n        inputContent.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Fpostscript\");\n        form.Add(inputContent, \"file\", Path.GetFileName(inputPath));\n        var jobOptionsContent = new ByteArrayContent(await File.ReadAllBytesAsync(jobOptionsPath));\n        jobOptionsContent.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Foctet-stream\");\n        form.Add(jobOptionsContent, \"job_options\", Path.GetFileName(jobOptionsPath));\n        form.Add(new StringContent(\"pdf_from_postscript\"), \"output\");\n        var response = await client.PostAsync(\"pdf\", form);\u003C\u002Fpre>\n\n\u003Cp>For the PostScript to PDF form, \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> owns the uploaded streams and text values. The .NET runtime calculates the multipart boundary and content type when \u003Ccode>HttpClient\u003C\u002Fcode> sends the container.\u003C\u002Fp>\n\n\u003Ch3>Read the output resource\u003C\u002Fh3>\n\n\u003Cpre class=\"language-csharp\">jobOptionsContent.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Foctet-stream\");\n        form.Add(jobOptionsContent, \"job_options\", Path.GetFileName(jobOptionsPath));\n        form.Add(new StringContent(\"pdf_from_postscript\"), \"output\");\n        var response = await client.PostAsync(\"pdf\", form);\n        var result = await response.Content.ReadAsStringAsync();\n        Console.WriteLine(result);\n        if (!response.IsSuccessStatusCode) Environment.ExitCode = 1;\n    }\n}\u003C\u002Fpre>\n\n\u003Cp>After the PostScript to PDF call, the client reads the response text and reports non-success status through the process exit code. A successful JSON body identifies the managed output resource, while an unsuccessful body should be surfaced to the calling application.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You have now used .NET with C# to turn a PostScript source into a managed PDF and make its conversion profile explicit. That gives the surrounding application a deliberate choice between a team-maintained \u003Ccode>.joboptions\u003C\u002Fcode> file and the service defaults.\u003C\u002Fp>\n\n\u003Cp>Try representative postscript to pdf inputs in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the authoritative request fields, accepted values, and response contract, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool documentation\u003C\u002Fa>. The same request pattern can then be adapted to your .NET with C# application’s error handling, retention policy, and delivery workflow.\u003C\u002Fp>\n\n\u003Cp>A JSON-payload PostScript-to-PDF example is available for .NET with C# as well. That form uploads the \u003Ccode>.ps\u003C\u002Fcode> and optional \u003Ccode>.joboptions\u003C\u002Fcode> files first, then passes their resource IDs to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-from-postscript.cs\">View the JSON-payload sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-02T21:53:51.000+00:00","2026-09-03T20:36:35.000+00:00","Convert PostScript (.ps) files to PDF with .NET with C# and an optional Distiller-compatible .joboptions profile.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-postscript-to-pdf-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert PostScript to PDF in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-postscript-to-pdf-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-postscript-to-pdf-in-net-with-c\u002F\",\n      \"datePublished\": \"2026-09-03T17:04:37.000Z\",\n      \"dateModified\": \"2026-09-03T17:04:37.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert PostScript (.ps) files to PDF with .NET with C# and an optional Distiller-compatible .joboptions profile.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Conversion, Convert to PDF, PostScript\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PostScript to PDF in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-postscript-to-pdf-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7198,7199,7200,7201,7202,7203],{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2133,"name":2134,"slug":2135,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-postscript-to-pdf-in-net-with-c\u002F","How to Convert PostScript to PDF in .NET with C# | pdfRest",{"id":7208,"uuid":7209,"title":7210,"slug":7211,"html":7212,"comment_id":7208,"feature_image":48,"featured":284,"visibility":1257,"created_at":4313,"updated_at":7213,"published_at":7214,"custom_excerpt":7215,"codeinjection_head":7216,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7217,"primary_tag":7224,"url":7225,"excerpt":7215,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7226,"meta_description":7215,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a989aeed1b70dd2e29789ee","aac2519d-e234-40d7-9c45-64d09bf69975","How to Convert PostScript to PDF with cURL","how-to-convert-postscript-to-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This cURL walkthrough uses the public pdfRest API directly from a shell script. It converts a PostScript (\u003Ccode>.ps\u003C\u002Fcode>) file into PDF through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa> and includes a custom \u003Ccode>.joboptions\u003C\u002Fcode> profile. The complete sample is included below so cURL developers can see the file handling, request construction, and response path together.\u003C\u002Fp>\n\n\u003Ch2>Why PostScript to PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>Build scripts and print-production jobs often produce a \u003Ccode>.ps\u003C\u002Fcode> file even when the next recipient expects PDF. A compact cURL request can bridge that boundary without adding desktop conversion software to the build host.\u003C\u002Fp>\n\n\u003Cp>A packaging pipeline might render a PostScript proof, apply its established \u003Ccode>.joboptions\u003C\u002Fcode> profile, and store the returned PDF where an approval system can retrieve it. The profile stays versionable alongside the pipeline configuration.\u003C\u002Fp>\n\n\u003Cp>The shell form makes the source and optional profile explicit, so operators can switch between the default conversion settings and a known project profile without changing the API endpoint.\u003C\u002Fp>\n\n\u003Ch2>cURL Code Example for PostScript to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">#!\u002Fbin\u002Fsh\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# This sample converts a PostScript (.ps) file to PDF with a custom .joboptions profile.\n# A .joboptions file contains Adobe Distiller-compatible conversion settings. The\n# profile is optional; omit job_options to use default settings. pdfRest applies a\n# supplied profile with Datalogics PDF Converter SDK. Datalogics maintains the SDK\n# in partnership with Adobe, using the same Adobe technology that powers Distiller.\n# Pairing this \u002Fpdf call with \u002Fpostscript creates a PDF -> PostScript -> PDF workflow\n# commonly called PDF refrying. Some print and prepress workflows use it to rebuild or\n# normalize page content, but the lossy roundtrip can discard PDF-specific features.\nINPUT_PATH=\"\u002Fpath\u002Fto\u002Fsample.ps\"\nJOB_OPTIONS_PATH=\"\u002Fpath\u002Fto\u002Fcustom.joboptions\"\n\ncurl --location \"$API_URL\u002Fpdf\" \\\n  --header \"Accept: application\u002Fjson\" \\\n  --header \"Content-Type: multipart\u002Fform-data\" \\\n  --header \"Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  --form \"file=@$INPUT_PATH;type=application\u002Fpostscript\" \\\n  --form \"job_options=@$JOB_OPTIONS_PATH;type=application\u002Foctet-stream\" \\\n  --form \"output=pdf_from_postscript\"\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-postscript.sh\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Configure the service and input\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>For this PostScript to PDF example, cURL sends the multipart request to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. cURL needs no language package installation. The sample keeps the service URL, API key, input path, and output name together near the top of the shell script so those values can be replaced before the request is sent. The sample’s placeholder path and API key make the moving pieces visible; replace them with a real local path and protected runtime credential before using the request.\u003C\u002Fp>\n\n\u003Ch3>Apply the PostScript Conversion Profile\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">--header \"Content-Type: multipart\u002Fform-data\" \\\n  --header \"Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  --form \"file=@$INPUT_PATH;type=application\u002Fpostscript\" \\\n  --form \"job_options=@$JOB_OPTIONS_PATH;type=application\u002Foctet-stream\" \\\n  --form \"output=pdf_from_postscript\"\u003C\u002Fpre>\n\n\u003Cp>Here, cURL sends the PostScript source and the optional profile as separate files. A \u003Ccode>.joboptions\u003C\u002Fcode> file contains Adobe Distiller-compatible conversion settings; pdfRest applies a supplied profile with Datalogics PDF Converter SDK, maintained in partnership with Adobe and using the same Adobe technology that powers Distiller. Omitting \u003Ccode>job_options\u003C\u002Fcode> uses default settings.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">--header \"Content-Type: multipart\u002Fform-data\" \\\n  --header \"Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  --form \"file=@$INPUT_PATH;type=application\u002Fpostscript\" \\\n  --form \"job_options=@$JOB_OPTIONS_PATH;type=application\u002Foctet-stream\" \\\n  --form \"output=pdf_from_postscript\"\u003C\u002Fpre>\n\n\u003Cp>For the PostScript to PDF form, each \u003Ccode>--form\u003C\u002Fcode> option creates one multipart field. cURL reads file fields from disk when their value begins with \u003Ccode>@\u003C\u002Fcode>, while ordinary quoted values become text fields.\u003C\u002Fp>\n\n\u003Ch3>Read the output resource\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">INPUT_PATH=\"\u002Fpath\u002Fto\u002Fsample.ps\"\nJOB_OPTIONS_PATH=\"\u002Fpath\u002Fto\u002Fcustom.joboptions\"\n\ncurl --location \"$API_URL\u002Fpdf\" \\\n  --header \"Accept: application\u002Fjson\" \\\n  --header \"Content-Type: multipart\u002Fform-data\" \\\n  --header \"Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  --form \"file=@$INPUT_PATH;type=application\u002Fpostscript\" \\\n  --form \"job_options=@$JOB_OPTIONS_PATH;type=application\u002Foctet-stream\" \\\n  --form \"output=pdf_from_postscript\"\u003C\u002Fpre>\n\n\u003Cp>After the PostScript to PDF call, the command prints the JSON response. Read \u003Ccode>outputId\u003C\u002Fcode> to retain the generated resource for a later call or download it from the returned URL before the service retention period ends.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You have now used cURL to turn a PostScript source into a managed PDF and make its conversion profile explicit. That gives the surrounding application a deliberate choice between a team-maintained \u003Ccode>.joboptions\u003C\u002Fcode> file and the service defaults.\u003C\u002Fp>\n\n\u003Cp>Try representative postscript to pdf inputs in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the authoritative request fields, accepted values, and response contract, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool documentation\u003C\u002Fa>. The same request pattern can then be adapted to your cURL application’s error handling, retention policy, and delivery workflow.\u003C\u002Fp>\n\n\u003Cp>A JSON-payload PostScript-to-PDF example is available for cURL as well. That form uploads the \u003Ccode>.ps\u003C\u002Fcode> and optional \u003Ccode>.joboptions\u003C\u002Fcode> files first, then passes their resource IDs to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-from-postscript.sh\">View the JSON-payload sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-03T20:36:36.000+00:00","2026-09-03T17:04:38.000+00:00","Convert PostScript (.ps) files to PDF with cURL and an optional Distiller-compatible .joboptions profile.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-postscript-to-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Convert PostScript to PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-postscript-to-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-postscript-to-pdf-with-curl\u002F\",\n      \"datePublished\": \"2026-09-03T17:04:38.000Z\",\n      \"dateModified\": \"2026-09-03T17:04:38.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert PostScript (.ps) files to PDF with cURL and an optional Distiller-compatible .joboptions profile.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, PostScript, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PostScript to PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-postscript-to-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7218,7219,7220,7221,7222,7223],{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2133,"name":2134,"slug":2135,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-postscript-to-pdf-with-curl\u002F","How to Convert PostScript to PDF with cURL | pdfRest",{"id":7228,"uuid":7229,"title":7230,"slug":7231,"html":7232,"comment_id":7228,"feature_image":48,"featured":284,"visibility":1257,"created_at":4313,"updated_at":7213,"published_at":7214,"custom_excerpt":7233,"codeinjection_head":7234,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7235,"primary_tag":7242,"url":7243,"excerpt":7233,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7244,"meta_description":7233,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a989aeed1b70dd2e29789f7","b1976432-7ca1-4db8-85e5-e4cb1882cde8","How to Convert PostScript to PDF with Java","how-to-convert-postscript-to-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This Java walkthrough uses an OkHttp multipart request from a JVM application. It converts a PostScript (\u003Ccode>.ps\u003C\u002Fcode>) file into PDF through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa> and includes a custom \u003Ccode>.joboptions\u003C\u002Fcode> profile. The complete sample is included below so Java developers can see the file handling, request construction, and response path together.\u003C\u002Fp>\n\n\u003Ch2>Why PostScript to PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>Java is often the orchestration layer around established composition, publishing, or enterprise print systems that still emit PostScript. This conversion creates a PDF result that a portal, archive, or later document service can consume.\u003C\u002Fp>\n\n\u003Cp>A publishing application might receive a \u003Ccode>.ps\u003C\u002Fcode> proof from its composition engine and apply a profile approved by the production team before exposing the converted PDF to editors. The profile file travels as an ordinary multipart input rather than as hard-coded Java settings.\u003C\u002Fp>\n\n\u003Cp>The API also works without that profile, using default settings. Keeping the optional file handling visible makes the decision clear to maintainers who need a reproducible conversion configuration.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example for PostScript to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\n\npublic class PdfFromPostscript {\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, replace the URL above\n  \u002F\u002F with https:\u002F\u002Feu-api.pdfrest.com. For more information, visit\n  \u002F\u002F https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  \u002F* This sample converts PostScript to PDF with a custom .joboptions profile.\n   * A .joboptions file contains Adobe Distiller-compatible conversion settings. The\n   * profile is optional; omit job_options to use default settings. pdfRest applies a\n   * supplied profile with Datalogics PDF Converter SDK. Datalogics maintains the SDK\n   * in partnership with Adobe, using the same Adobe technology that powers Distiller.\n   * Pair with \u002Fpostscript for PDF\n   * refrying: PDF -> PostScript -> PDF. Some print and prepress workflows use this lossy\n   * roundtrip to rebuild or normalize page content.\n   *\u002F\n  public static void main(String[] args) throws IOException {\n    File inputFile = new File(args.length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.ps\");\n    File jobOptionsFile = new File(args.length > 1 ? args[1] : \"\u002Fpath\u002Fto\u002Fcustom.joboptions\");\n    Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n    String apiKey = dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY);\n    MultipartBody.Builder form =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\n                \"file\",\n                inputFile.getName(),\n                RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpostscript\")))\n            .addFormDataPart(\n                \"job_options\",\n                jobOptionsFile.getName(),\n                RequestBody.create(jobOptionsFile, MediaType.parse(\"application\u002Foctet-stream\")))\n            .addFormDataPart(\"output\", \"pdf_from_postscript\");\n    Request request =\n        new Request.Builder()\n            .url(API_URL + \"\u002Fpdf\")\n            .header(\"Api-Key\", apiKey)\n            .post(form.build())\n            .build();\n    send(request);\n  }\n\n  private static void send(Request request) throws IOException {\n    OkHttpClient client = new OkHttpClient.Builder().readTimeout(60, TimeUnit.SECONDS).build();\n    try (Response response = client.newCall(request).execute()) {\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) System.out.println(response.body().string());\n      if (!response.isSuccessful()) System.exit(1);\n    }\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPdfFromPostscript.java\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Configure the service and input\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, replace the URL above\n  \u002F\u002F with https:\u002F\u002Feu-api.pdfrest.com. For more information, visit\n  \u002F\u002F https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\u003C\u002Fpre>\n\n\u003Cp>For this PostScript to PDF example, Java sends the multipart request to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. The Java samples use OkHttp for multipart HTTP requests and dotenv support for repository configuration. The sample project supplies those dependencies; applications that copy the class elsewhere need equivalent dependencies and secure runtime configuration. The sample’s placeholder path and API key make the moving pieces visible; replace them with a real local path and protected runtime credential before using the request.\u003C\u002Fp>\n\n\u003Ch3>Apply the PostScript Conversion Profile\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">inputFile.getName(),\n                RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpostscript\")))\n            .addFormDataPart(\n                \"job_options\",\n                jobOptionsFile.getName(),\n                RequestBody.create(jobOptionsFile, MediaType.parse(\"application\u002Foctet-stream\")))\n            .addFormDataPart(\"output\", \"pdf_from_postscript\");\n    Request request =\n        new Request.Builder()\n            .url(API_URL + \"\u002Fpdf\")\n            .header(\"Api-Key\", apiKey)\u003C\u002Fpre>\n\n\u003Cp>Here, Java sends the PostScript source and the optional profile as separate files. A \u003Ccode>.joboptions\u003C\u002Fcode> file contains Adobe Distiller-compatible conversion settings; pdfRest applies a supplied profile with Datalogics PDF Converter SDK, maintained in partnership with Adobe and using the same Adobe technology that powers Distiller. Omitting \u003Ccode>job_options\u003C\u002Fcode> uses default settings.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n    String apiKey = dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY);\n    MultipartBody.Builder form =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\n                \"file\",\n                inputFile.getName(),\n                RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpostscript\")))\n            .addFormDataPart(\n                \"job_options\",\u003C\u002Fpre>\n\n\u003Cp>For the PostScript to PDF form, okHttp’s \u003Ccode>MultipartBody.Builder\u003C\u002Fcode> constructs the form and assigns its boundary. Each file part carries a filename and media type, while conversion options are ordinary text parts.\u003C\u002Fp>\n\n\u003Ch3>Read the output resource\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">private static void send(Request request) throws IOException {\n    OkHttpClient client = new OkHttpClient.Builder().readTimeout(60, TimeUnit.SECONDS).build();\n    try (Response response = client.newCall(request).execute()) {\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) System.out.println(response.body().string());\n      if (!response.isSuccessful()) System.exit(1);\n    }\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>After the PostScript to PDF call, the response block checks the HTTP status before printing its body. On success, the JSON contains the output resource ID and URL; on failure, the printed body gives the API error detail needed for diagnosis.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You have now used Java to turn a PostScript source into a managed PDF and make its conversion profile explicit. That gives the surrounding application a deliberate choice between a team-maintained \u003Ccode>.joboptions\u003C\u002Fcode> file and the service defaults.\u003C\u002Fp>\n\n\u003Cp>Try representative postscript to pdf inputs in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the authoritative request fields, accepted values, and response contract, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool documentation\u003C\u002Fa>. The same request pattern can then be adapted to your Java application’s error handling, retention policy, and delivery workflow.\u003C\u002Fp>\n\n\u003Cp>A JSON-payload PostScript-to-PDF example is available for Java as well. That form uploads the \u003Ccode>.ps\u003C\u002Fcode> and optional \u003Ccode>.joboptions\u003C\u002Fcode> files first, then passes their resource IDs to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPdfFromPostscript.java\">View the JSON-payload sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Convert PostScript (.ps) files to PDF with Java and an optional Distiller-compatible .joboptions profile.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-postscript-to-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Convert PostScript to PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-postscript-to-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-postscript-to-pdf-with-java\u002F\",\n      \"datePublished\": \"2026-09-03T17:04:38.000Z\",\n      \"dateModified\": \"2026-09-03T17:04:38.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert PostScript (.ps) files to PDF with Java and an optional Distiller-compatible .joboptions profile.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, Java, PostScript\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PostScript to PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-postscript-to-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7236,7237,7238,7239,7240,7241],{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2133,"name":2134,"slug":2135,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-postscript-to-pdf-with-java\u002F","How to Convert PostScript to PDF with Java | pdfRest",{"id":7246,"uuid":7247,"title":7248,"slug":7249,"html":7250,"comment_id":7246,"feature_image":48,"featured":284,"visibility":1257,"created_at":7193,"updated_at":7251,"published_at":7214,"custom_excerpt":7252,"codeinjection_head":7253,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7254,"primary_tag":7261,"url":7262,"excerpt":7252,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7263,"meta_description":7252,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a989aefd1b70dd2e2978a00","97a2987c-2ef6-4409-8bad-99216112175b","How to Convert PostScript to PDF with JavaScript in NodeJS","how-to-convert-postscript-to-pdf-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This NodeJS walkthrough uses JavaScript, Axios, and multipart form data. It converts a PostScript (\u003Ccode>.ps\u003C\u002Fcode>) file into PDF through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa> and includes a custom \u003Ccode>.joboptions\u003C\u002Fcode> profile. The complete sample is included below so JavaScript in NodeJS developers can see the file handling, request construction, and response path together.\u003C\u002Fp>\n\n\u003Ch2>Why PostScript to PDF with JavaScript in NodeJS?\u003C\u002Fh2>\n\n\u003Cp>Node-based publishing and web-to-print services often need to turn a PostScript artifact into a PDF that browsers and document portals can readily handle. The multipart form keeps that conversion close to the rest of the service’s HTTP work.\u003C\u002Fp>\n\n\u003Cp>A browser-facing proof service might accept a \u003Ccode>.ps\u003C\u002Fcode> export from a legacy renderer, send an approved \u003Ccode>.joboptions\u003C\u002Fcode> profile with it, and return a PDF resource to the front end for controlled download. The profile can be selected per workflow rather than embedded in the service.\u003C\u002Fp>\n\n\u003Cp>When no specialized settings are needed, the same endpoint can be called without the profile part. The input file and optional profile remain separate, which makes that choice visible in code review.\u003C\u002Fp>\n\n\u003Ch2>JavaScript in NodeJS Code Example for PostScript to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar fs = require(\"fs\");\nvar FormData = require(\"form-data\");\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n\u002F* This sample converts a PostScript (.ps) file to PDF with a custom .joboptions profile.\n * A .joboptions file contains Adobe Distiller-compatible conversion settings. The\n * profile is optional; omit job_options to use default settings. pdfRest applies a\n * supplied profile with Datalogics PDF Converter SDK. Datalogics maintains the SDK\n * in partnership with Adobe, using the same Adobe technology that powers Distiller.\n * Pairing this \u002Fpdf call with \u002Fpostscript creates a PDF -> PostScript -> PDF workflow\n * commonly called PDF refrying. Some print and prepress workflows use it to rebuild or\n * normalize page content, but the lossy roundtrip can discard PDF-specific features.\n *\u002F\nvar inputPath = \"\u002Fpath\u002Fto\u002Fsample.ps\";\nvar jobOptionsPath = \"\u002Fpath\u002Fto\u002Fcustom.joboptions\";\nvar form = new FormData();\nform.append(\"file\", fs.createReadStream(inputPath), { contentType: \"application\u002Fpostscript\" });\nform.append(\"job_options\", fs.createReadStream(jobOptionsPath), { contentType: \"application\u002Foctet-stream\" });\nform.append(\"output\", \"pdf_from_postscript\");\n\naxios.post(apiUrl + \"\u002Fpdf\", form, { headers: { \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", ...form.getHeaders() }, maxBodyLength: Infinity })\n.then((response) => { console.log(JSON.stringify(response.data, null, 2)); })\n.catch((error) => { console.error(error.response ? error.response.data : error.message); process.exitCode = 1; });\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-postscript.js\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Configure the service and input\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\u003C\u002Fpre>\n\n\u003Cp>For this PostScript to PDF example, JavaScript in NodeJS sends the multipart request to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. The NodeJS samples use \u003Ccode>axios\u003C\u002Fcode> for HTTP, \u003Ccode>form-data\u003C\u002Fcode> for multipart encoding, and Node’s file-system module for local inputs. Install the packages listed in the repository’s JavaScript package manifest when adapting the example. The sample’s placeholder path and API key make the moving pieces visible; replace them with a real local path and protected runtime credential before using the request.\u003C\u002Fp>\n\n\u003Ch3>Apply the PostScript Conversion Profile\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">var jobOptionsPath = \"\u002Fpath\u002Fto\u002Fcustom.joboptions\";\nvar form = new FormData();\nform.append(\"file\", fs.createReadStream(inputPath), { contentType: \"application\u002Fpostscript\" });\nform.append(\"job_options\", fs.createReadStream(jobOptionsPath), { contentType: \"application\u002Foctet-stream\" });\nform.append(\"output\", \"pdf_from_postscript\");\n\naxios.post(apiUrl + \"\u002Fpdf\", form, { headers: { \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", ...form.getHeaders() }, maxBodyLength: Infinity })\n.then((response) => { console.log(JSON.stringify(response.data, null, 2)); })\n.catch((error) => { console.error(error.response ? error.response.data : error.message); process.exitCode = 1; });\u003C\u002Fpre>\n\n\u003Cp>Here, JavaScript in NodeJS sends the PostScript source and the optional profile as separate files. A \u003Ccode>.joboptions\u003C\u002Fcode> file contains Adobe Distiller-compatible conversion settings; pdfRest applies a supplied profile with Datalogics PDF Converter SDK, maintained in partnership with Adobe and using the same Adobe technology that powers Distiller. Omitting \u003Ccode>job_options\u003C\u002Fcode> uses default settings.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar fs = require(\"fs\");\nvar FormData = require(\"form-data\");\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\u003C\u002Fpre>\n\n\u003Cp>For the PostScript to PDF form, \u003Ccode>FormData\u003C\u002Fcode> appends a readable file stream and the text options. Its generated headers include the multipart boundary, so the request combines \u003Ccode>form.getHeaders()\u003C\u002Fcode> with the \u003Ccode>Api-Key\u003C\u002Fcode> header rather than setting a boundary by hand.\u003C\u002Fp>\n\n\u003Ch3>Read the output resource\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar fs = require(\"fs\");\nvar FormData = require(\"form-data\");\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\u003C\u002Fpre>\n\n\u003Cp>After the PostScript to PDF call, axios resolves successful responses to a JSON object and sends API failures to the catch block. The sample prints either the output-resource details or the returned error payload, which is a useful starting point for production logging.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You have now used JavaScript in NodeJS to turn a PostScript source into a managed PDF and make its conversion profile explicit. That gives the surrounding application a deliberate choice between a team-maintained \u003Ccode>.joboptions\u003C\u002Fcode> file and the service defaults.\u003C\u002Fp>\n\n\u003Cp>Try representative postscript to pdf inputs in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the authoritative request fields, accepted values, and response contract, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool documentation\u003C\u002Fa>. The same request pattern can then be adapted to your JavaScript in NodeJS application’s error handling, retention policy, and delivery workflow.\u003C\u002Fp>\n\n\u003Cp>A JSON-payload PostScript-to-PDF example is available for JavaScript in NodeJS as well. That form uploads the \u003Ccode>.ps\u003C\u002Fcode> and optional \u003Ccode>.joboptions\u003C\u002Fcode> files first, then passes their resource IDs to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-from-postscript.js\">View the JSON-payload sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-03T20:36:37.000+00:00","Convert PostScript (.ps) files to PDF with JavaScript in NodeJS and an optional Distiller-compatible .joboptions profile.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-postscript-to-pdf-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert PostScript to PDF with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-postscript-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-postscript-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2026-09-03T17:04:38.000Z\",\n      \"dateModified\": \"2026-09-03T17:04:38.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert PostScript (.ps) files to PDF with JavaScript in NodeJS and an optional Distiller-compatible .joboptions profile.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, JavaScript, PostScript\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PostScript to PDF with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-postscript-to-pdf-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7255,7256,7257,7258,7259,7260],{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2133,"name":2134,"slug":2135,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-postscript-to-pdf-with-javascript-in-nodejs\u002F","How to Convert PostScript to PDF with JavaScript in NodeJS | pdfRest",{"id":7265,"uuid":7266,"title":7267,"slug":7268,"html":7269,"comment_id":7265,"feature_image":48,"featured":284,"visibility":1257,"created_at":7193,"updated_at":7270,"published_at":7214,"custom_excerpt":7271,"codeinjection_head":7272,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7273,"primary_tag":7280,"url":7281,"excerpt":7271,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7282,"meta_description":7271,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a989aefd1b70dd2e2978a12","93abc9bf-7f23-451b-8585-df17dfc689ad","How to Convert PostScript to PDF with PHP","how-to-convert-postscript-to-pdf-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This PHP walkthrough uses Guzzle to send the file and conversion options. It converts a PostScript (\u003Ccode>.ps\u003C\u002Fcode>) file into PDF through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa> and includes a custom \u003Ccode>.joboptions\u003C\u002Fcode> profile. The complete sample is included below so PHP developers can see the file handling, request construction, and response path together.\u003C\u002Fp>\n\n\u003Ch2>Why PostScript to PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>PHP applications can provide a simple API boundary between legacy PostScript generation and modern web delivery. A converted PDF is easier to expose in a customer portal or attach to an internal workflow than a raw \u003Ccode>.ps\u003C\u002Fcode> file.\u003C\u002Fp>\n\n\u003Cp>A content-management service might receive a PostScript report from a back-office system, send its production \u003Ccode>.joboptions\u003C\u002Fcode> profile alongside the report, and make the returned PDF available to an approver. The profile can be maintained as a file rather than reimplemented in PHP.\u003C\u002Fp>\n\n\u003Cp>If the application does not need specialized conversion settings, it can omit the optional profile. That leaves the rest of the multipart request unchanged and uses the service defaults.\u003C\u002Fp>\n\n\u003Ch2>PHP Code Example for PostScript to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Utils;\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n\u002F* This sample converts a PostScript (.ps) file to PDF with a custom .joboptions profile.\n * A .joboptions file contains Adobe Distiller-compatible conversion settings. The\n * profile is optional; omit job_options to use default settings. pdfRest applies a\n * supplied profile with Datalogics PDF Converter SDK. Datalogics maintains the SDK\n * in partnership with Adobe, using the same Adobe technology that powers Distiller.\n * Pairing this \u002Fpdf call with \u002Fpostscript creates a PDF -> PostScript -> PDF workflow\n * commonly called PDF refrying. Some print and prepress workflows use it to rebuild or\n * normalize page content, but the lossy roundtrip can discard PDF-specific features.\n *\u002F\n$inputPath = '\u002Fpath\u002Fto\u002Fsample.ps';\n$jobOptionsPath = '\u002Fpath\u002Fto\u002Fcustom.joboptions';\n$multipart = [\n  ['name' => 'file', 'contents' => Utils::tryFopen($inputPath, 'r'), 'filename' => basename($inputPath), 'headers' => ['Content-Type' => 'application\u002Fpostscript']],\n  ['name' => 'job_options', 'contents' => Utils::tryFopen($jobOptionsPath, 'r'), 'filename' => basename($jobOptionsPath), 'headers' => ['Content-Type' => 'application\u002Foctet-stream']],\n  ['name' => 'output', 'contents' => 'pdf_from_postscript'],\n];\n$response = (new Client())->post($apiUrl . '\u002Fpdf', ['headers' => ['Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'Accept' => 'application\u002Fjson'], 'multipart' => $multipart]);\necho $response->getBody();\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-postscript.php\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Configure the service and input\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\u003C\u002Fpre>\n\n\u003Cp>For this PostScript to PDF example, PHP sends the multipart request to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. The PHP samples use Guzzle for HTTP and PSR-7 stream utilities for uploads. Install Guzzle with Composer when moving the code outside the repository, and provide the API key through protected runtime configuration. The sample’s placeholder path and API key make the moving pieces visible; replace them with a real local path and protected runtime credential before using the request.\u003C\u002Fp>\n\n\u003Ch3>Apply the PostScript Conversion Profile\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">$jobOptionsPath = '\u002Fpath\u002Fto\u002Fcustom.joboptions';\n$multipart = [\n  ['name' => 'file', 'contents' => Utils::tryFopen($inputPath, 'r'), 'filename' => basename($inputPath), 'headers' => ['Content-Type' => 'application\u002Fpostscript']],\n  ['name' => 'job_options', 'contents' => Utils::tryFopen($jobOptionsPath, 'r'), 'filename' => basename($jobOptionsPath), 'headers' => ['Content-Type' => 'application\u002Foctet-stream']],\n  ['name' => 'output', 'contents' => 'pdf_from_postscript'],\n];\n$response = (new Client())->post($apiUrl . '\u002Fpdf', ['headers' => ['Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'Accept' => 'application\u002Fjson'], 'multipart' => $multipart]);\necho $response->getBody();\u003C\u002Fpre>\n\n\u003Cp>Here, PHP sends the PostScript source and the optional profile as separate files. A \u003Ccode>.joboptions\u003C\u002Fcode> file contains Adobe Distiller-compatible conversion settings; pdfRest applies a supplied profile with Datalogics PDF Converter SDK, maintained in partnership with Adobe and using the same Adobe technology that powers Distiller. Omitting \u003Ccode>job_options\u003C\u002Fcode> uses default settings.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">$inputPath = '\u002Fpath\u002Fto\u002Fsample.ps';\n$jobOptionsPath = '\u002Fpath\u002Fto\u002Fcustom.joboptions';\n$multipart = [\n  ['name' => 'file', 'contents' => Utils::tryFopen($inputPath, 'r'), 'filename' => basename($inputPath), 'headers' => ['Content-Type' => 'application\u002Fpostscript']],\n  ['name' => 'job_options', 'contents' => Utils::tryFopen($jobOptionsPath, 'r'), 'filename' => basename($jobOptionsPath), 'headers' => ['Content-Type' => 'application\u002Foctet-stream']],\n  ['name' => 'output', 'contents' => 'pdf_from_postscript'],\n];\n$response = (new Client())->post($apiUrl . '\u002Fpdf', ['headers' => ['Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'Accept' => 'application\u002Fjson'], 'multipart' => $multipart]);\necho $response->getBody();\u003C\u002Fpre>\n\n\u003Cp>For the PostScript to PDF form, guzzle accepts multipart fields as an array. Each entry names a field and supplies either stream content for a file or a simple string for an option, then Guzzle produces the correct multipart boundary.\u003C\u002Fp>\n\n\u003Ch3>Read the output resource\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">['name' => 'job_options', 'contents' => Utils::tryFopen($jobOptionsPath, 'r'), 'filename' => basename($jobOptionsPath), 'headers' => ['Content-Type' => 'application\u002Foctet-stream']],\n  ['name' => 'output', 'contents' => 'pdf_from_postscript'],\n];\n$response = (new Client())->post($apiUrl . '\u002Fpdf', ['headers' => ['Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'Accept' => 'application\u002Fjson'], 'multipart' => $multipart]);\necho $response->getBody();\u003C\u002Fpre>\n\n\u003Cp>After the PostScript to PDF call, the example prints Guzzle’s response body. A production caller can decode that JSON, retain \u003Ccode>outputId\u003C\u002Fcode>, and branch on an unsuccessful response instead of assuming every submitted conversion completed.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You have now used PHP to turn a PostScript source into a managed PDF and make its conversion profile explicit. That gives the surrounding application a deliberate choice between a team-maintained \u003Ccode>.joboptions\u003C\u002Fcode> file and the service defaults.\u003C\u002Fp>\n\n\u003Cp>Try representative postscript to pdf inputs in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the authoritative request fields, accepted values, and response contract, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool documentation\u003C\u002Fa>. The same request pattern can then be adapted to your PHP application’s error handling, retention policy, and delivery workflow.\u003C\u002Fp>\n\n\u003Cp>A JSON-payload PostScript-to-PDF example is available for PHP as well. That form uploads the \u003Ccode>.ps\u003C\u002Fcode> and optional \u003Ccode>.joboptions\u003C\u002Fcode> files first, then passes their resource IDs to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-from-postscript.php\">View the JSON-payload sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-03T20:36:38.000+00:00","Convert PostScript (.ps) files to PDF with PHP and an optional Distiller-compatible .joboptions profile.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-postscript-to-pdf-with-php\u002F#article\",\n      \"headline\": \"How to Convert PostScript to PDF with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-postscript-to-pdf-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-postscript-to-pdf-with-php\u002F\",\n      \"datePublished\": \"2026-09-03T17:04:38.000Z\",\n      \"dateModified\": \"2026-09-03T17:04:38.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert PostScript (.ps) files to PDF with PHP and an optional Distiller-compatible .joboptions profile.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, PHP, PostScript\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PostScript to PDF with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-postscript-to-pdf-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7274,7275,7276,7277,7278,7279],{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2133,"name":2134,"slug":2135,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-postscript-to-pdf-with-php\u002F","How to Convert PostScript to PDF with PHP | pdfRest",{"id":7284,"uuid":7285,"title":7286,"slug":7287,"html":7288,"comment_id":7284,"feature_image":48,"featured":284,"visibility":1257,"created_at":7193,"updated_at":7270,"published_at":7214,"custom_excerpt":7289,"codeinjection_head":7290,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7291,"primary_tag":7298,"url":7299,"excerpt":7289,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7300,"meta_description":7289,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a989aefd1b70dd2e2978a1b","9cbd7c6d-1973-48d0-8e7e-38caf7f99980","How to Convert PostScript to PDF with Python","how-to-convert-postscript-to-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This Python walkthrough uses \u003Ccode>requests\u003C\u002Fcode> and a multipart encoder. It converts a PostScript (\u003Ccode>.ps\u003C\u002Fcode>) file into PDF through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa> and includes a custom \u003Ccode>.joboptions\u003C\u002Fcode> profile. The complete sample is included below so Python developers can see the file handling, request construction, and response path together.\u003C\u002Fp>\n\n\u003Ch2>Why PostScript to PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>Python automation can convert the PostScript outputs of established reporting or scientific workflows into PDFs that are easier to archive, inspect, and share. The request fits naturally into a pipeline that already works with files and HTTP responses.\u003C\u002Fp>\n\n\u003Cp>A research publishing process might produce a \u003Ccode>.ps\u003C\u002Fcode> figure package, apply a maintained \u003Ccode>.joboptions\u003C\u002Fcode> profile, and send the resulting PDF to an approval or distribution stage. The conversion settings live in the profile rather than in ad hoc rendering code.\u003C\u002Fp>\n\n\u003Cp>The profile is optional, so a simpler pipeline can submit only the PostScript source and rely on default conversion settings when there is no named production configuration to apply.\u003C\u002Fp>\n\n\u003Ch2>Python Code Example for PostScript to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">import json\nimport os\nimport requests\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# This sample converts a PostScript (.ps) file to PDF with a custom .joboptions profile.\n# A .joboptions file contains Adobe Distiller-compatible conversion settings. The\n# profile is optional; omit job_options to use default settings. pdfRest applies a\n# supplied profile with Datalogics PDF Converter SDK. Datalogics maintains the SDK\n# in partnership with Adobe, using the same Adobe technology that powers Distiller.\n# Pairing this \u002Fpdf call with \u002Fpostscript creates a PDF -> PostScript -> PDF workflow\n# commonly called PDF refrying. Some print and prepress workflows use it to rebuild or\n# normalize page content, but the lossy roundtrip can discard PDF-specific features.\ninput_path = \"\u002Fpath\u002Fto\u002Fsample.ps\"\njob_options_path = \"\u002Fpath\u002Fto\u002Fcustom.joboptions\"\n\nfrom requests_toolbelt import MultipartEncoder\nwith open(input_path, \"rb\") as input_file, open(job_options_path, \"rb\") as job_options_file:\n    fields = {\n        \"file\": (os.path.basename(input_path), input_file, \"application\u002Fpostscript\"),\n        \"job_options\": (\n            os.path.basename(job_options_path),\n            job_options_file,\n            \"application\u002Foctet-stream\",\n        ),\n        \"output\": \"pdf_from_postscript\",\n    }\n    form = MultipartEncoder(fields=fields)\n    response = requests.post(api_url + \"\u002Fpdf\", data=form, headers={\n        \"Accept\": \"application\u002Fjson\",\n        \"Content-Type\": form.content_type,\n        \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    })\n\nprint(\"Response status code: \" + str(response.status_code))\nif response.ok:\n    print(json.dumps(response.json(), indent=2))\nelse:\n    print(response.text)\n    raise SystemExit(1)\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-postscript.py\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Configure the service and input\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\"># By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>For this PostScript to PDF example, Python sends the multipart request to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. The Python samples use \u003Ccode>requests\u003C\u002Fcode> and \u003Ccode>MultipartEncoder\u003C\u002Fcode> from \u003Ccode>requests-toolbelt\u003C\u002Fcode>. Install both packages when using the file outside the samples project and keep the API key in environment configuration. The sample’s placeholder path and API key make the moving pieces visible; replace them with a real local path and protected runtime credential before using the request.\u003C\u002Fp>\n\n\u003Ch3>Apply the PostScript Conversion Profile\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\">with open(input_path, \"rb\") as input_file, open(job_options_path, \"rb\") as job_options_file:\n    fields = {\n        \"file\": (os.path.basename(input_path), input_file, \"application\u002Fpostscript\"),\n        \"job_options\": (\n            os.path.basename(job_options_path),\n            job_options_file,\n            \"application\u002Foctet-stream\",\n        ),\n        \"output\": \"pdf_from_postscript\",\n    }\n    form = MultipartEncoder(fields=fields)\u003C\u002Fpre>\n\n\u003Cp>Here, Python sends the PostScript source and the optional profile as separate files. A \u003Ccode>.joboptions\u003C\u002Fcode> file contains Adobe Distiller-compatible conversion settings; pdfRest applies a supplied profile with Datalogics PDF Converter SDK, maintained in partnership with Adobe and using the same Adobe technology that powers Distiller. Omitting \u003Ccode>job_options\u003C\u002Fcode> uses default settings.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\">job_options_path = \"\u002Fpath\u002Fto\u002Fcustom.joboptions\"\n\nfrom requests_toolbelt import MultipartEncoder\nwith open(input_path, \"rb\") as input_file, open(job_options_path, \"rb\") as job_options_file:\n    fields = {\n        \"file\": (os.path.basename(input_path), input_file, \"application\u002Fpostscript\"),\n        \"job_options\": (\n            os.path.basename(job_options_path),\n            job_options_file,\n            \"application\u002Foctet-stream\",\n        ),\u003C\u002Fpre>\n\n\u003Cp>For the PostScript to PDF form, \u003Ccode>MultipartEncoder\u003C\u002Fcode> combines the file tuple and text fields, then exposes a \u003Ccode>content_type\u003C\u002Fcode> value that includes the generated boundary. That value must be used as the request header.\u003C\u002Fp>\n\n\u003Ch3>Read the output resource\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\">\"output\": \"pdf_from_postscript\",\n    }\n    form = MultipartEncoder(fields=fields)\n    response = requests.post(api_url + \"\u002Fpdf\", data=form, headers={\n        \"Accept\": \"application\u002Fjson\",\n        \"Content-Type\": form.content_type,\n        \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    })\n\nprint(\"Response status code: \" + str(response.status_code))\nif response.ok:\n    print(json.dumps(response.json(), indent=2))\u003C\u002Fpre>\n\n\u003Cp>After the PostScript to PDF call, the sample prints formatted response JSON after a successful request and exits with an error after printing a failed response. Preserve the returned \u003Ccode>outputId\u003C\u002Fcode> when the next workflow step needs the generated resource.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You have now used Python to turn a PostScript source into a managed PDF and make its conversion profile explicit. That gives the surrounding application a deliberate choice between a team-maintained \u003Ccode>.joboptions\u003C\u002Fcode> file and the service defaults.\u003C\u002Fp>\n\n\u003Cp>Try representative postscript to pdf inputs in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the authoritative request fields, accepted values, and response contract, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool documentation\u003C\u002Fa>. The same request pattern can then be adapted to your Python application’s error handling, retention policy, and delivery workflow.\u003C\u002Fp>\n\n\u003Cp>A JSON-payload PostScript-to-PDF example is available for Python as well. That form uploads the \u003Ccode>.ps\u003C\u002Fcode> and optional \u003Ccode>.joboptions\u003C\u002Fcode> files first, then passes their resource IDs to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-from-postscript.py\">View the JSON-payload sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Convert PostScript (.ps) files to PDF with Python and an optional Distiller-compatible .joboptions profile.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-postscript-to-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Convert PostScript to PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-postscript-to-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-postscript-to-pdf-with-python\u002F\",\n      \"datePublished\": \"2026-09-03T17:04:38.000Z\",\n      \"dateModified\": \"2026-09-03T17:04:38.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert PostScript (.ps) files to PDF with Python and an optional Distiller-compatible .joboptions profile.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, PostScript, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert PostScript to PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-postscript-to-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7292,7293,7294,7295,7296,7297],{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2133,"name":2134,"slug":2135,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-postscript-to-pdf-with-python\u002F","How to Convert PostScript to PDF with Python | pdfRest",{"id":7302,"uuid":7303,"title":7304,"slug":7305,"html":7306,"comment_id":7302,"feature_image":48,"featured":284,"visibility":1257,"created_at":7307,"updated_at":7176,"published_at":7307,"custom_excerpt":7308,"codeinjection_head":7309,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7310,"primary_tag":7316,"url":7317,"excerpt":7308,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7318,"meta_description":7308,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65c54bae533c9f26b9436138","b32a779f-7257-493b-b66f-694d79a587d4","How to Convert TIFF to PDF in .NET with C#","how-to-convert-tiff-to-pdf-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert TIFF to PDF with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> is a powerful resource that allows developers to programmatically convert various file formats into PDFs. This tutorial will guide you through the process of sending an API call to convert a TIFF file to PDF using C#.\u003C\u002Fp>\n\n\u003Cp>Imagine you have an application that generates images in TIFF format, and you need to distribute these images as PDFs for ease of printing and sharing. Using the Convert to PDF API, you can automate this conversion process within your application, enhancing the user experience and streamlining image and document management.\u003C\u002Fp>\n\n\u003Ch2>Convert TIFF to PDF with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"image\u002Ftiff\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"output.pdf\"));\n        multipartContent.Add(byteArrayOption, \"output\");\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.cs\">pdfRest API Samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>In this code snippet, we create an HTTP client and send a multipart\u002Fform-data request to the Convert to PDF API endpoint:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    \u002F\u002F ... other code ...\n}\n\u003C\u002Fpre>\n\n\u003Cp>We set the API key in the request headers to authenticate the request:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>The file to be converted is read as a byte array and added to the multipart content, along with the content type of the original file:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"image\u002Ftiff\");\n\u003C\u002Fpre>\n\n\u003Cp>Additional conversion options, such as page size and output file name, are also included in the request:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"A4\"));\nmultipartContent.Add(byteArrayOption, \"page_size\");\n\nvar byteArrayOption2 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"output.pdf\"));\nmultipartContent.Add(byteArrayOption2, \"output\");\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the request is sent, and the response is read:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\nvar apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you have successfully called the Convert to PDF API using C#. This enables you to integrate PDF conversion functionality directly into your applications, providing a seamless experience for your users.\u003C\u002Fp>\n\n\u003Cp>To explore all of the pdfRest API Tools, visit the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\u003C\u002Fa>, and for more detailed information, refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.cs\">pdfRest API Samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-08T21:46:22.000+00:00","Learn how to convert TIFF images into PDF documents for your .NET projects by calling the pdfRest Convert to PDF API Tool.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert TIFF to PDF in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-02-08T21:46:22.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:51.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert TIFF images into PDF documents for your .NET projects by calling the pdfRest Convert to PDF API Tool.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Convert to PDF, TIFF\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert TIFF to PDF in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7311,7312,7313,7314,7315],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1554,"name":1555,"slug":1556,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-tiff-to-pdf-in-net-with-c\u002F","How to Convert TIFF to PDF in .NET with C#, Tutorial | pdfRest",{"id":7320,"uuid":7321,"title":7322,"slug":7323,"html":7324,"comment_id":7320,"feature_image":48,"featured":284,"visibility":1257,"created_at":7325,"updated_at":7326,"published_at":7326,"custom_excerpt":7327,"codeinjection_head":7328,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7329,"primary_tag":7336,"url":7337,"excerpt":7327,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7338,"meta_description":7327,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a9750cc533c9f26b943b75e","d933759a-3849-4f49-a67c-e745446f680c","How to Convert TIFF to PDF with cURL","how-to-convert-tiff-to-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Cp>Follow this cURL walkthrough to convert TIFF to PDF with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool\u003C\u002Fa>. Along the way, you'll learn which parts are ordinary cURL syntax, which fields are needed to convert TIFF to PDF, and what to expect from the API response.\u003C\u002Fp>\n\n\u003Ch2>Why Convert TIFF to PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>Scanning, fax, medical-record, and document-imaging systems often produce TIFF files even when collaboration and case-management systems expect PDF. Converting at intake creates a consistent document type for the rest of the workflow.\u003C\u002Fp>\n\n\u003Cp>For example, a records service can receive a multi-page TIFF from a scanner, submit it with cURL, and store the resulting PDF beside documents received from office applications. Later steps can apply OCR, merge pages, or add security without maintaining a TIFF-specific branch.\u003C\u002Fp>\n\n\u003Cp>TIFF files may contain one image or many pages. The conversion preserves the source sequence in the generated PDF, while OCR remains a separate operation when the scanned text also needs to become searchable.\u003C\u002Fp>\n\n\u003Ch2>cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\ncurl -X POST \"$API_URL\u002Fpdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Finput.tif\" \\\n  -F \"output=pdfrest_tiff_to_pdf\"\u003C\u002Fpre>\n\n\u003Cp>Source for Convert TIFF to PDF: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.sh\">View the cURL sample on GitHub\u003C\u002Fa>. The repository's generic Convert to PDF scaffold is configured here with a \u003Ccode>.tif\u003C\u002Fcode> input for this tutorial.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Choose the pdfRest service region\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>The TIFF example centralizes regional routing in \u003Ccode>API_URL\u003C\u002Fcode>, with the global US service active and the EU service documented below it. Use the chosen hostname for the entire scan-processing sequence.\u003C\u002Fp>\n\n\u003Ch3>Build the authenticated multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"$API_URL\u002Fpdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\u003C\u002Fpre>\n\n\u003Cp>The POST sends TIFF content to the common Convert to PDF endpoint as multipart form data. The response-format and authentication headers remain separate from the uploaded scan, making each part of the call visible.\u003C\u002Fp>\n\n\u003Ch3>Upload the input file data\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Finput.tif\" \\\u003C\u002Fpre>\n\n\u003Cp>The Convert TIFF to PDF request reads the local source from the path after \u003Ccode>@\u003C\u002Fcode> and sends its bytes in the multipart \u003Ccode>file\u003C\u002Fcode> field. For Convert TIFF to PDF, cURL treats the path as an upload rather than ordinary form text.\u003C\u002Fp>\n\n\u003Ch3>Set the operation-specific fields\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">-F \"output=pdfrest_tiff_to_pdf\"\u003C\u002Fpre>\n\n\u003Cp>The requested \u003Ccode>output\u003C\u002Fcode> name helps identify the PDF created from the TIFF scan. The \u003Ccode>.tif\u003C\u002Fcode> upload name supplies the input-format signal and can represent either a single image or a multi-page source.\u003C\u002Fp>\n\n\u003Ch3>Read the generated resource response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"$API_URL\u002Fpdf\" \\\u003C\u002Fpre>\n\n\u003Cp>When TIFF processing succeeds, pdfRest reports the generated PDF resource in JSON. Preserve its identifier and download details so page review, OCR, or document assembly can continue before retention expires.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You have now seen how a compact cURL command can normalize TIFF input into a PDF resource for downstream document workflows.\u003C\u002Fp>\n\n\u003Cp>Validate page count, order, orientation, and readability with realistic TIFF files because scanner settings can vary widely in resolution, compression, and color model.\u003C\u002Fp>\n\n\u003Cp>Continue exploring the Convert TIFF to PDF workflow in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the complete Convert TIFF to PDF request contract, accepted values, defaults, and limitations, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: The Convert TIFF to PDF example above uploads a file with multipart form data. For source content already stored in pdfRest, the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.sh\">Convert TIFF to PDF JSON payload example\u003C\u002Fa> shows the resource-ID request shape.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T22:25:16.000+00:00","2026-09-03T17:04:39.000+00:00","Learn how to convert TIFF scans into PDF documents with cURL for document intake, sharing, and later PDF processing.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Convert TIFF to PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-curl\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert TIFF scans into PDF documents with cURL for document intake, sharing, and later PDF processing.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, TIFF, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert TIFF to PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7330,7331,7332,7333,7334,7335],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1554,"name":1555,"slug":1556,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-tiff-to-pdf-with-curl\u002F","How to Convert TIFF to PDF with cURL, Tutorial | pdfRest",{"id":7340,"uuid":7341,"title":7342,"slug":7343,"html":7344,"comment_id":7340,"feature_image":48,"featured":284,"visibility":1257,"created_at":7157,"updated_at":7345,"published_at":7158,"custom_excerpt":7346,"codeinjection_head":7347,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7348,"primary_tag":7353,"url":7354,"excerpt":7346,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7355,"meta_description":7346,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c5c533c9f26b943b536","dd8f8ef0-4959-4f8f-ac48-ecfb846af69c","How to Convert TIFF to PDF with Java","how-to-convert-tiff-to-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>In the following tutorial, you'll use Java and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool\u003C\u002Fa> to convert TIFF to PDF. The Java request submits a TIFF image to the shared conversion endpoint and reads the resulting PDF resource information for downstream document workflows. The example is designed to clarify both the API-specific fields and the surrounding HTTP request used to convert TIFF to PDF.\u003C\u002Fp>\n\n\u003Ch2>Why Convert TIFF to PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>Document-imaging systems often deliver TIFF files while case-management and collaboration systems expect PDFs. Conversion normalizes incoming scans before OCR, merging, or distribution.\u003C\u002Fp>\n\n\u003Cp>The adapted request uploads a \u003Ccode>.tif\u003C\u002Fcode> or \u003Ccode>.tiff\u003C\u002Fcode> file with the \u003Ccode>image\u002Ftiff\u003C\u002Fcode> media type. Convert to PDF returns a new PDF resource and leaves the source resource unchanged.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class ConvertTIFFToPDF {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.tif\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"image\u002Ftiff\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_tiff_to_pdf\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPDF.java\">Java sample on GitHub\u003C\u002Fa>. This version adjusts the general Java example to make Convert TIFF to PDF explicit.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>This client uses OkHttp for transport, dotenv for loading \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode>, and \u003Ccode>org.json\u003C\u002Fcode> for structured request or response data.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.tif\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>The sample configuration uses runtime arguments when supplied and otherwise falls back to the documented input path and environment-based credential.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"image\u002Ftiff\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_tiff_to_pdf\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The adapted request uploads a \u003Ccode>.tif\u003C\u002Fcode> or \u003Ccode>.tiff\u003C\u002Fcode> file with the \u003Ccode>image\u002Ftiff\u003C\u002Fcode> media type. Convert to PDF returns a new PDF resource and leaves the source resource unchanged. This request body uses the form multipart type required for combining uploaded content with operation parameters.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The HTTP request ties the body to its endpoint and applies the required \u003Ccode>Api-Key\u003C\u002Fcode> header before OkHttp sends it.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>The example output logic uses both status and body to distinguish a successful resource from validation or processing failures.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>We have now covered the request and response flow for using Java to convert TIFF to PDF. With that foundation, you can use TIFF-to-PDF conversion for scan intake, fax archives, medical records, and legacy imaging migrations.\u003C\u002Fp>\n\n\u003Cp>Before relying on the result in an automated workflow, keep in mind that tIFF inputs may contain one or several pages and can vary widely in resolution and color model. Confirm the resulting page count, order, orientation, and readability, then apply OCR separately when scanned pages also need searchable text.\u003C\u002Fp>\n\n\u003Cp>Continue testing representative documents with the Convert TIFF to PDF operation in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. The \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool documentation\u003C\u002Fa> provides authoritative defaults, accepted fields, and limitations for the Convert TIFF to PDF operation.\u003C\u002Fp>\n\n\u003Cp>Note: The Convert TIFF to PDF example above uses multipart form data; when the input is already stored in pdfRest, compare the multipart call with the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPDF.java\">JSON payload example\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-02T18:28:15.000+00:00","Convert TIFF scans into PDF documents with Java.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Convert TIFF to PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:37.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:37.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert TIFF scans into PDF documents with Java.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF, Java\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert TIFF to PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7349,7350,7351,7352],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-tiff-to-pdf-with-java\u002F","Convert TIFF to PDF with Java | pdfRest",{"id":7357,"uuid":7358,"title":7359,"slug":7360,"html":7361,"comment_id":7357,"feature_image":48,"featured":284,"visibility":1257,"created_at":7362,"updated_at":7363,"published_at":7362,"custom_excerpt":7364,"codeinjection_head":7365,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7366,"primary_tag":7371,"url":7372,"excerpt":7364,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7373,"meta_description":7364,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65c54e1a533c9f26b943614b","6ee70cc3-31b2-46a0-9a1e-afaa53880d62","How to Convert TIFF to PDF with JavaScript in NodeJS","how-to-convert-tiff-to-pdf-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert TIFF to PDF with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F'>Convert to PDF API Tool\u003C\u002Fa> provides a convenient way to programmatically convert various file formats to PDF. This is particularly useful in web applications where users may need to convert documents for uniformity, archiving, or compliance with certain standards.\n  \nFor instance, a user might want to convert TIFF images to PDF to ensure compatability with a wide array of viewers.\u003C\u002Fp>\n\n\u003Ch2>Convert TIFF to PDF with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('output', 'pdfrest_pdf');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.js\">GitHub - pdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code uses the Axios library to make HTTP requests and the FormData library to construct multipart\u002Fform-data payloads. Here's a breakdown of the key parts:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('output', 'pdfrest_pdf');\n\u003C\u002Fpre>\n\n\u003Cp>This section creates a new FormData object and appends different fields to it, including the file to be converted and any conversion parameters.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf',\n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\n\u003C\u002Fpre>\n\n\u003Cp>The config object defines the HTTP request configuration, including the API endpoint, headers (with your API key), and the data payload.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\u003C\u002Fpre>\n\n\u003Cp>This snippet sends the request and handles the response or error. On success, it logs the response data, which would typically include information about the converted PDF.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've seen how to send an API call to the pdfRest Convert to PDF API using JavaScript. By following the steps outlined, you can integrate PDF conversion into your applications, enhancing their functionality and user experience. To explore all of the pdfRest API Tools, visit the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\u003C\u002Fa>, and for more detailed information, refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.js\">GitHub - pdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-08T21:56:42.000+00:00","2026-09-02T18:28:16.000+00:00","Learn how to turn TIFF images into PDF documents by calling the Convert to PDF API Tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert TIFF to PDF with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-02-08T21:56:42.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:51.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to turn TIFF images into PDF documents by calling the Convert to PDF API Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF, JavaScript\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert TIFF to PDF with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7367,7368,7369,7370],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-tiff-to-pdf-with-javascript-in-nodejs\u002F","How to Convert TIFF to PDF with JavaScript in NodeJS, Tutorial | pdfRest",{"id":7375,"uuid":7376,"title":7377,"slug":7378,"html":7379,"comment_id":7375,"feature_image":48,"featured":284,"visibility":1257,"created_at":7380,"updated_at":7363,"published_at":7380,"custom_excerpt":7381,"codeinjection_head":7382,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7383,"primary_tag":7389,"url":7390,"excerpt":7381,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7391,"meta_description":7381,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65c551dd533c9f26b9436157","489d2bec-d3df-43dc-9c3f-be9a48f9e77d","How to Convert TIFF to PDF with PHP","how-to-convert-tiff-to-pdf-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Convert TIFF to PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool\u003C\u002Fa> allows developers to convert various file formats into PDFs. This tutorial will guide you through sending an API call to Convert to PDF using PHP.\n  \nImagine you have an application that generates images in different formats, such as TIFF or JPEG, and you need to convert these into a standardized PDF format for distribution. This is where the Convert to PDF API comes in handy.\u003C\u002Fp>\n\n\u003Ch2>Convert TIFF to PDF with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">\nrequire 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003CContent-type header>'\n      ]\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_pdf'\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\u003C\u002Fpre>\n\n\u003Cp>Reference to the source code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.php\">https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.php\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code example above demonstrates how to make a multipart\u002Fform-data POST request to the pdfRest API to convert a file to PDF. Let's break down the key parts of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\u003C\u002Fpre>\n\n\u003Cp>This section includes the necessary libraries and sets up the namespaces needed to make HTTP requests with Guzzle, a PHP HTTP client.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The API key is required for authentication with the pdfRest API. Replace 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$options = [\n  'multipart' => [\n    \u002F\u002F ... multipart form fields ...\n  ]\n];\n\u003C\u002Fpre>\n\n\u003Cp>This array contains the multipart form fields. Each field corresponds to an option or file required by the API. The 'file' field includes the file contents, the 'compression' field sets the compression level, 'downsample' specifies the downsample rate, 'tagged_pdf' indicates whether to create a tagged PDF, and 'output' names the output file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf', $headers);\n$res = $client->sendAsync($request, $options)->wait();\necho $res->getBody();\n\u003C\u002Fpre>\n\n\u003Cp>A new POST request is created with the specified URL and headers. The request is sent asynchronously, and the script waits for the response. The response body, which contains the processed PDF content, is then outputted.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we have successfully made a call to the pdfRest Convert to PDF API using PHP. This allows for the conversion of files to PDF format programmatically. To explore all of the pdfRest API Tools, visit the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\u003C\u002Fa>. For more detailed information, refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.php\">https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.php\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-08T22:12:45.000+00:00","Learn how to change TIFF images into PDF documents using the Convert to PDF API Tool in the pdfRest Cloud API.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-php\u002F#article\",\n      \"headline\": \"How to Convert TIFF to PDF with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-php\u002F\",\n      \"datePublished\": \"2024-02-08T22:12:45.000Z\",\n      \"dateModified\": \"2026-09-01T14:52:12.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to change TIFF images into PDF documents using the Convert to PDF API Tool in the pdfRest Cloud API.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Convert to PDF, PHP, TIFF\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert TIFF to PDF with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7384,7385,7386,7387,7388],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1554,"name":1555,"slug":1556,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-tiff-to-pdf-with-php\u002F","How to Convert TIFF to PDF with PHP, Tutorial | pdfRest",{"id":7393,"uuid":7394,"title":7395,"slug":7396,"html":7397,"comment_id":7393,"feature_image":48,"featured":284,"visibility":1257,"created_at":7398,"updated_at":7399,"published_at":7398,"custom_excerpt":7400,"codeinjection_head":7401,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7402,"primary_tag":7409,"url":7410,"excerpt":7400,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7411,"meta_description":7400,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65c5525b533c9f26b9436168","dacb12f0-4a98-457c-8fac-f98f4b7448b2","How to Convert TIFF to PDF with Python","how-to-convert-tiff-to-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Convert TIFF Images into Standardized PDF Documents\u003C\u002Fh2>\n\n\u003Cp>TIFF is widely used for scanned records, archival images, and high-resolution document capture, but it is not always the most convenient format for distribution or downstream document processing. Converting a \u003Ccode>.tif\u003C\u002Fcode> or \u003Ccode>.tiff\u003C\u002Fcode> file to PDF gives applications a consistent document format that is broadly supported by browsers, business systems, and PDF workflows.\u003C\u002Fp>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">Convert to PDF API Tool\u003C\u002Fa> accepts TIFF images through the same \u003Ccode>\u002Fpdf\u003C\u002Fcode> endpoint used for other supported image, Office, email, PostScript, HTML, and structured-text formats. That consistent request pattern helps simplify systems that receive mixed file types: the application can standardize them as PDF without maintaining a separate conversion library for each source format. pdfRest uses Adobe PDF Library technology to produce reliable output that conforms to the PDF ISO 32000 specification.\u003C\u002Fp>\n\n\u003Cp>For example, an insurance intake system may receive scanned claim documents as TIFF files from several offices. Converting each upload to PDF gives adjusters a consistent format to review and lets the application pass the result directly into OCR, text extraction, merging, or archival steps without requiring staff to convert files manually.\u003C\u002Fp>\n\n\u003Cp>This Python example sends a TIFF file as multipart form data, assigns a predictable output name, and prints the JSON response.\u003C\u002Fp>\n\n\u003Ch2>Python TIFF-to-PDF Code Example\u003C\u002Fh2>\n\n\u003Cp>Install the \u003Ccode>requests\u003C\u002Fcode> and \u003Ccode>requests-toolbelt\u003C\u002Fcode> packages, then replace the file path and API-key placeholders. Use the \u003Ccode>.tif\u003C\u002Fcode> or \u003Ccode>.tiff\u003C\u002Fcode> extension in the submitted filename and identify the upload with the \u003Ccode>image\u002Ftiff\u003C\u002Fcode> MIME type.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\n\npdf_endpoint_url = api_url+'\u002Fpdf'\n\n# The \u002Fpdf endpoint can take a single file, id, or url as input.\n# This sample passes a tif file to the endpoint, but there's a variety of input file types that are accepted by this endpoint.\n# The 'image\u002Ftiff' string below is known as a MIME type, which is a label used to identify the type of a file so that it is handled properly by software.\n# Please see https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FWeb\u002FHTTP\u002FBasics_of_HTTP\u002FMIME_types\u002FCommon_types for more information about MIME types.\nmp_encoder_pdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.tif', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'image\u002Ftiff'),\n        'output' : 'example_pdf_out',\n    }\n)\n\n# Let's set the headers that the pdf endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to pdf endpoint...\")\nresponse = requests.post(pdf_endpoint_url, data=mp_encoder_pdf, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf.py\">pdfRest Convert to PDF multipart Python sample\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Cp>If the TIFF already exists on the pdfRest processing service, use its resource ID in a JSON payload instead of uploading the file again. See the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf.py\">Convert to PDF JSON-payload sample\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Build the Multipart Conversion Request\u003C\u002Fh2>\n\n\u003Cp>\u003Ccode>MultipartEncoder\u003C\u002Fcode> combines the source file and conversion parameters into one multipart body. The \u003Ccode>file\u003C\u002Fcode> field contains the open binary stream, submitted filename, and MIME type. The optional \u003Ccode>output\u003C\u002Fcode> field sets the resulting PDF's base filename; the API adds the \u003Ccode>.pdf\u003C\u002Fcode> extension.\u003C\u002Fp>\n\n\u003Cp>The encoder also generates the multipart boundary required by the \u003Ccode>Content-Type\u003C\u002Fcode> header. Reuse \u003Ccode>mp_encoder_pdf.content_type\u003C\u002Fcode> rather than writing a multipart header manually, because an incorrect or missing boundary prevents the server from parsing the upload. The \u003Ccode>Accept: application\u002Fjson\u003C\u002Fcode> header requests a JSON response, and the \u003Ccode>Api-Key\u003C\u002Fcode> header authenticates the request.\u003C\u002Fp>\n\n\u003Cp>The sample defaults to the US Cloud API. Applications that require EU-based processing can select the EU base URL shown in the code. Keep the base URL in configuration so deployment environments can choose the appropriate service without modifying request logic.\u003C\u002Fp>\n\n\u003Ch2>Handle the Conversion Response\u003C\u002Fh2>\n\n\u003Cp>A successful request returns JSON containing information about the generated PDF, including values that can be used to download the result or pass it into another pdfRest API Tool. Check \u003Ccode>response.ok\u003C\u002Fcode> before parsing the success schema, and validate that the expected output is present before continuing. For production code, add an application-appropriate timeout and catch network exceptions so a temporary connection problem is not mistaken for a conversion failure.\u003C\u002Fp>\n\n\u003Cp>When another pdfRest operation should follow, pass the returned resource ID to the next API call instead of downloading and uploading the intermediate PDF. This supports efficient workflows such as converting a TIFF, applying OCR to make scanned text searchable, extracting text, merging the result with another document, or preparing it for delivery.\u003C\u002Fp>\n\n\u003Ch2>Standardize TIFF Intake Without a Separate Image-Conversion Stack\u003C\u002Fh2>\n\n\u003Cp>Applications that receive scans from different capture systems can send TIFF files through the same Convert to PDF workflow used for other supported image, Office, email, PostScript, HTML, and structured-text formats. That gives an intake service one document format for storage, search, review, and downstream PDF operations instead of a separate handling path for each incoming file type.\u003C\u002Fp>\n\n\u003Cp>Configure the request only with the parameters supported for TIFF conversion. Image-only inputs do not use the document-layout controls intended for formats such as HTML or PostScript. For a production rollout, establish the supported image dimensions, color modes, compression types, and page structures used by the capture systems in scope, then let the application handle unsupported or damaged inputs through its normal exception path.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-08T22:14:51.000+00:00","2026-09-22T19:02:55.000+00:00","Use the Convert to PDF API Tool and learn how to convert TIFF images into PDF documents easily, all in the pdfRest API Toolkit.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Convert TIFF to PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-python\u002F\",\n      \"datePublished\": \"2024-02-08T22:14:51.000Z\",\n      \"dateModified\": \"2026-09-22T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Use the Convert to PDF API Tool and learn how to convert TIFF images into PDF documents easily, all in the pdfRest API Toolkit.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, Python, TIFF\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert TIFF to PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-tiff-to-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7403,7404,7405,7406,7407,7408],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1554,"name":1555,"slug":1556,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-tiff-to-pdf-with-python\u002F","How to Convert TIFF to PDF with Python, Tutorial | pdfRest",{"id":7413,"uuid":7414,"title":7415,"slug":7416,"html":7417,"comment_id":7413,"feature_image":48,"featured":284,"visibility":1257,"created_at":7418,"updated_at":7419,"published_at":7420,"custom_excerpt":7421,"codeinjection_head":7422,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7423,"primary_tag":7432,"url":7433,"excerpt":7421,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7434,"meta_description":7421,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a964be6533c9f26b943ad4e","89323169-6632-4b3a-9f8e-f8047390c947","How to Convert XML to PDF in .NET with C#","how-to-convert-xml-to-pdf-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This .NET tutorial shows how a C# application can convert XML into a tagged PDF through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. The sample combines the XML upload with layout and style options, then returns a PDF resource suitable for the rest of a document workflow.\u003C\u002Fp>\n\n\u003Ch2>Why Convert XML to PDF in .NET with C#?\u003C\u002Fh2>\n\n\u003Cp>.NET applications frequently exchange XML with ERP systems, government services, and long-established line-of-business platforms. Although the data is structured, a raw XML file is inconvenient for people who need to approve, compare, or retain the information as part of a business record.\u003C\u002Fp>\n\n\u003Cp>A financial operations system, for instance, might receive an XML acknowledgement after submitting a batch to an external processor. Converting that acknowledgement into a hierarchy-formatted PDF gives reviewers a clear view of batch identifiers, status fields, warnings, and nested transaction results. The PDF can then be placed in the same audit packet as the related approvals and reports.\u003C\u002Fp>\n\n\u003Cp>C# developers do not have to translate every element into drawing coordinates or create a separate HTML template. Hierarchy mode emphasizes relationships for business review, while source mode keeps literal XML syntax visible when technical fidelity is more important. Both can include tags, metadata, and consistent page formatting.\u003C\u002Fp>\n\n\u003Ch2>C# Code Example for Converting XML to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">\u002F*\n * What this sample does:\n * - Converts structured XML input to PDF through the \u002Fpdf endpoint.\n *\n * Setup (environment):\n * - Set PDFREST_API_KEY=your_api_key_here\n * - Optional: set PDFREST_URL to override the API region.\n *\n * Usage:\n *   dotnet run -- pdf-from-xml-multipart \u003CinputFile>\n *\u002F\nusing Newtonsoft.Json.Linq;\nusing System.Net.Http.Headers;\nusing System.Text;\n\nnamespace Samples.EndpointExamples.MultipartPayload;\n\npublic static class PdfFromXml\n{\n    public static async Task Execute(string[] args)\n    {\n        var inputPath = args.Length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.xml\";\n        var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\n        if (string.IsNullOrWhiteSpace(apiKey)) throw new InvalidOperationException(\"Missing PDFREST_API_KEY\");\n        var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n        using var client = new HttpClient { BaseAddress = new Uri(baseUrl) };\n        client.DefaultRequestHeaders.TryAddWithoutValidation(\"Api-Key\", apiKey);\n        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(\"application\u002Fjson\"));\n        var options = JObject.Parse(@\"{\"\"title\"\":\"\"Structured Content Sample\"\",\"\"language\"\":\"\"en-US\"\",\"\"enable_tagging\"\":true,\"\"page_setup\"\":{\"\"size\"\":\"\"Letter\"\",\"\"orientation\"\":\"\"portrait\"\",\"\"margin\"\":{\"\"top\"\":36,\"\"right\"\":42,\"\"bottom\"\":36,\"\"left\"\":42}},\"\"style\"\":{\"\"font\"\":\"\"Arial\"\",\"\"heading_font\"\":\"\"Arial\"\",\"\"code_font\"\":\"\"Courier\"\",\"\"text_size\"\":11,\"\"text_color_rgb\"\":[34,34,34],\"\"heading_scale\"\":1.35,\"\"table\"\":{\"\"column_width_weights\"\":[2,3,2],\"\"keep_header_with_first_row\"\":true,\"\"repeat_headers_on_overflow\"\":true,\"\"show_borders\"\":true,\"\"border_width\"\":0.75,\"\"border_color_rgb\"\":[180,188,200],\"\"header_fill_color_rgb\"\":[33,64,98],\"\"header_text_color_rgb\"\":[255,255,255],\"\"row_fill_color_rgb\"\":[250,250,252],\"\"alternate_row_fill_color_rgb\"\":[235,240,246],\"\"cell_padding\"\":{\"\"top\"\":6,\"\"right\"\":8,\"\"bottom\"\":6,\"\"left\"\":8}}},\"\"data_presentation\"\":\"\"hierarchy\"\"}\");\n        using var form = new MultipartFormDataContent();\n        var inputContent = new ByteArrayContent(await File.ReadAllBytesAsync(inputPath));\n        inputContent.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Foctet-stream\");\n        form.Add(inputContent, \"file\", Path.GetFileName(inputPath));\n        form.Add(new StringContent(options.ToString()), \"structured_text_options\");\n        var response = await client.PostAsync(\"pdf\", form);\n        var result = await response.Content.ReadAsStringAsync();\n        Console.WriteLine(result);\n        if (!response.IsSuccessStatusCode) Environment.ExitCode = 1;\n    }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-xml.cs\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The C# XML sample uses the framework \u003Ccode>HttpClient\u003C\u002Fcode> APIs and Newtonsoft JSON types for \u003Ccode>structured_text_options\u003C\u002Fcode>. A project adopting this code must retain the Newtonsoft.Json package reference used by the samples repository.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using Newtonsoft.Json.Linq;\nusing System.Net.Http.Headers;\nusing System.Text;\n        using var client = new HttpClient { BaseAddress = new Uri(baseUrl) };\n        using var form = new MultipartFormDataContent();\u003C\u002Fpre>\n\n\u003Cp>The .NET endpoint block shows which regional service receives this XML request:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">        if (string.IsNullOrWhiteSpace(apiKey)) throw new InvalidOperationException(\"Missing PDFREST_API_KEY\");\n        var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n        using var client = new HttpClient { BaseAddress = new Uri(baseUrl) };\n        client.DefaultRequestHeaders.TryAddWithoutValidation(\"Api-Key\", apiKey);\u003C\u002Fpre>\n\n\u003Cp>C# turns the .xml source into \u003Ccode>StreamContent\u003C\u002Fcode> and preserves its filename in the multipart part. That extension directs the shared \u003Ccode>\u002Fpdf\u003C\u002Fcode> endpoint to the XML converter.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">    {\n        var inputPath = args.Length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.xml\";\n        var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\u003C\u002Fpre>\n\n\u003Cp>The Newtonsoft \u003Ccode>JObject\u003C\u002Fcode> represents pdfRest’s structured conversion settings. It defines the output title and language, explicitly enables tags, configures Letter portrait pages and margins, and carries the typography and XML-related style properties used by the renderer.\u003C\u002Fp>\n\n\u003Cpre class=\"language-json\">{\n  \"data_presentation\": \"hierarchy\"\n}\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>source\u003C\u002Fcode> is the default. It first validates the XML and then displays the user’s original source text, including its markup, whitespace, and declared encoding text. \u003Ccode>hierarchy\u003C\u002Fcode> instead creates a nested list: local element names become bold labels, attributes appear with an \u003Ccode>@\u003C\u002Fcode> prefix, and leaf values follow their element names. Namespace prefixes are not displayed in hierarchy labels. Invalid XML and documents without a root element are rejected in either mode.\u003C\u002Fp>\n\n\u003Cp>The shared \u003Ccode>style.table\u003C\u002Fcode> member does not affect XML hierarchy or source output. It can be removed from an XML-only profile without changing the resulting document.\u003C\u002Fp>\n\n\u003Cp>For XML, \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> owns the source stream, serialized settings, and output field. \u003Ccode>HttpClient\u003C\u002Fcode> generates the matching multipart boundary and content type when it sends the container.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">        var inputContent = new ByteArrayContent(await File.ReadAllBytesAsync(inputPath));\n        inputContent.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Foctet-stream\");\n        form.Add(inputContent, \"file\", Path.GetFileName(inputPath));\n        form.Add(new StringContent(options.ToString()), \"structured_text_options\");\n        var response = await client.PostAsync(\"pdf\", form);\n        var result = await response.Content.ReadAsStringAsync();\n        Console.WriteLine(result);\n        if (!response.IsSuccessStatusCode) Environment.ExitCode = 1;\n    }\n}\u003C\u002Fpre>\n\n\u003Cp>The C# client authenticates and posts the XML form, then reads the response as text. Reporting both status and payload lets an integration distinguish a generated PDF resource from validation or processing errors.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">        var inputContent = new ByteArrayContent(await File.ReadAllBytesAsync(inputPath));\n        inputContent.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Foctet-stream\");\n        form.Add(inputContent, \"file\", Path.GetFileName(inputPath));\n        form.Add(new StringContent(options.ToString()), \"structured_text_options\");\n        var response = await client.PostAsync(\"pdf\", form);\n        var result = await response.Content.ReadAsStringAsync();\n        Console.WriteLine(result);\n        if (!response.IsSuccessStatusCode) Environment.ExitCode = 1;\n    }\n}\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>Possible uses include documenting serialized application state, distributing configuration baselines, and creating human-readable copies of machine-to-machine messages. Teams can choose hierarchy or source presentation according to whether readability or syntax fidelity is more important.\u003C\u002Fp>\n\n\u003Cp>Enabling tags contributes document structure for assistive technology and automated workflows without certifying the result against a named standard. Developers can prototype the same request in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and find the authoritative field definitions in the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF reference\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T03:52:06.000+00:00","2026-09-02T18:28:17.000+00:00","2026-09-01T04:11:25.000+00:00","Generate a structured, tagged PDF from XML in .NET with C# using configurable hierarchy and source presentation modes.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Convert XML to PDF in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-in-net-with-c\u002F\",\n      \"datePublished\": \"2026-09-01T04:11:25.000Z\",\n      \"dateModified\": \"2026-09-01T05:07:10.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Generate a structured, tagged PDF from XML in .NET with C# using configurable hierarchy and source presentation modes.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Conversion, Convert to PDF\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert XML to PDF in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7424,7425,7426,7427,7428,7429,7430,7431],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1426,"name":1427,"slug":1428,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-xml-to-pdf-in-net-with-c\u002F","Convert XML to PDF in .NET with C# | pdfRest",{"id":7436,"uuid":7437,"title":7438,"slug":7439,"html":7440,"comment_id":7436,"feature_image":48,"featured":284,"visibility":1257,"created_at":7441,"updated_at":7442,"published_at":7443,"custom_excerpt":7444,"codeinjection_head":7445,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7446,"primary_tag":7455,"url":7456,"excerpt":7444,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7457,"meta_description":7444,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a964be5533c9f26b943ad30","ba693bb2-d563-4914-b671-c9098f264b42","How to Convert XML to PDF with cURL","how-to-convert-xml-to-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This tutorial shows how to convert an XML file to PDF with cURL and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. The request produces tagged output, presents nested XML as a readable hierarchy, and applies page and typography settings without requiring an XML stylesheet or local PDF software.\u003C\u002Fp>\n\n\u003Ch2>Why Convert XML to PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>XML is excellent for exchanging structured data between systems, but it is rarely the format a support specialist, project manager, or customer wants to review. Converting XML to PDF creates a portable representation that can be opened consistently, attached to a case, and shared without asking the recipient to use an XML editor.\u003C\u002Fp>\n\n\u003Cp>Consider a scheduled integration that saves a partner’s XML response whenever an order fails. A shell script can send that response to pdfRest, generate a hierarchy-formatted PDF, and attach the document to the incident record. The support team sees parent-child relationships and values without the visual noise of opening and closing tags, while the original XML remains available as the system record.\u003C\u002Fp>\n\n\u003Cp>The same endpoint can use \u003Ccode>data_presentation: \"source\"\u003C\u002Fcode> when exact markup is the point of the document. This makes the cURL workflow useful for both reader-friendly diagnostics and syntax-preserving technical evidence, with optional tags and controlled page styling applied during conversion.\u003C\u002Fp>\n\n\u003Ch2>cURL Code Example for Converting XML to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">#!\u002Fbin\u002Fsh\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# This sample converts XML input to a tagged PDF through multipart \u002Fpdf.\nINPUT_PATH=\"\u002Fpath\u002Fto\u002Fsample.xml\"\nOPTIONS='{\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"data_presentation\":\"hierarchy\"}'\n\ncurl --location \"$API_URL\u002Fpdf\" \\\n  --header \"Accept: application\u002Fjson\" \\\n  --header \"Content-Type: multipart\u002Fform-data\" \\\n  --header \"Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  --form \"file=@$INPUT_PATH\" \\\n  --form \"structured_text_options=$OPTIONS\" \\\n  --form \"output=pdf_from_xml\"\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-xml.sh\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The XML shell example calls cURL directly, so no language package is required. \u003Ccode>API_URL\u003C\u002Fcode> keeps regional routing visible: the active value uses the US service, and the commented alternative selects the EU service.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">#!\u002Fbin\u002Fsh\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# This sample converts XML input to a tagged PDF through multipart \u002Fpdf.\nINPUT_PATH=\"\u002Fpath\u002Fto\u002Fsample.xml\"\u003C\u002Fpre>\n\n\u003Cp>For this XML request, the endpoint excerpt makes the regional service choice explicit:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>INPUT_PATH\u003C\u002Fcode> identifies the local .xml source. The \u003Ccode>@\u003C\u002Fcode> prefix in the later \u003Ccode>--form\u003C\u002Fcode> argument instructs cURL to upload that file’s contents instead of sending its path as text.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\"># This sample converts XML input to a tagged PDF through multipart \u002Fpdf.\nINPUT_PATH=\"\u002Fpath\u002Fto\u002Fsample.xml\"\nOPTIONS='{\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"data_presentation\":\"hierarchy\"}'\u003C\u002Fpre>\n\n\u003Cp>The JSON assigned to \u003Ccode>OPTIONS\u003C\u002Fcode> is pdfRest-specific rather than shell syntax. \u003Ccode>title\u003C\u002Fcode> becomes document metadata, \u003Ccode>language\u003C\u002Fcode> identifies the document language, and \u003Ccode>enable_tagging\u003C\u002Fcode> explicitly requests logical structure. \u003Ccode>page_setup\u003C\u002Fcode> selects Letter portrait pages with 36-point margins, while \u003Ccode>style\u003C\u002Fcode> supplies fonts, text size, color, and format-specific presentation.\u003C\u002Fp>\n\n\u003Cpre class=\"language-json\">{\n  \"data_presentation\": \"hierarchy\"\n}\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>source\u003C\u002Fcode> is the default. It first validates the XML and then displays the user’s original source text, including its markup, whitespace, and declared encoding text. \u003Ccode>hierarchy\u003C\u002Fcode> instead creates a nested list: local element names become bold labels, attributes appear with an \u003Ccode>@\u003C\u002Fcode> prefix, and leaf values follow their element names. Namespace prefixes are not displayed in hierarchy labels. Invalid XML and documents without a root element are rejected in either mode.\u003C\u002Fp>\n\n\u003Cp>The shared \u003Ccode>style.table\u003C\u002Fcode> member does not affect XML hierarchy or source output. It can be removed from an XML-only profile without changing the resulting document.\u003C\u002Fp>\n\n\u003Cp>For XML conversion, the \u003Ccode>--form\u003C\u002Fcode> arguments create the multipart fields: \u003Ccode>file\u003C\u002Fcode> carries the structured source, \u003Ccode>structured_text_options\u003C\u002Fcode> carries serialized settings, and \u003Ccode>output\u003C\u002Fcode> names the requested PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">  --header \"Content-Type: multipart\u002Fform-data\" \\\n  --header \"Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  --form \"file=@$INPUT_PATH\" \\\n  --form \"structured_text_options=$OPTIONS\" \\\n  --form \"output=pdf_from_xml\"\u003C\u002Fpre>\n\n\u003Cp>The XML request asks for JSON with \u003Ccode>Accept\u003C\u002Fcode>, declares multipart form data with \u003Ccode>Content-Type\u003C\u002Fcode>, and authenticates through \u003Ccode>Api-Key\u003C\u002Fcode>. Success returns the generated PDF resource and download URL; failure returns API error information.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\"># This sample converts XML input to a tagged PDF through multipart \u002Fpdf.\nINPUT_PATH=\"\u002Fpath\u002Fto\u002Fsample.xml\"\nOPTIONS='{\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"data_presentation\":\"hierarchy\"}'\n\ncurl --location \"$API_URL\u002Fpdf\" \\\n  --header \"Accept: application\u002Fjson\" \\\n  --header \"Content-Type: multipart\u002Fform-data\" \\\n  --header \"Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  --form \"file=@$INPUT_PATH\" \\\n  --form \"structured_text_options=$OPTIONS\" \\\n  --form \"output=pdf_from_xml\"\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>Command-line conversion makes it practical to add XML reporting to scheduled jobs, build scripts, and operational diagnostics without first transforming the source into HTML. The hierarchy view favors human review, while source view is better suited to technical records where preserving markup matters.\u003C\u002Fp>\n\n\u003Cp>Tagged output supplies logical structure for accessibility and downstream processing, although enabling tags alone does not establish compliance with a particular accessibility standard. Experiment with the request in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, or consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF documentation\u003C\u002Fa> for every supported option.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T03:52:05.000+00:00","2026-09-02T18:28:18.000+00:00","2026-09-01T04:11:24.000+00:00","Learn how to convert XML to a tagged, readable PDF with cURL using hierarchy or source presentation options from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Convert XML to PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-curl\u002F\",\n      \"datePublished\": \"2026-09-01T04:11:24.000Z\",\n      \"dateModified\": \"2026-09-01T05:07:08.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert XML to a tagged, readable PDF with cURL using hierarchy or source presentation options from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert XML to PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7447,7448,7449,7450,7451,7452,7453,7454],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1426,"name":1427,"slug":1428,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-xml-to-pdf-with-curl\u002F","Convert XML to PDF with cURL | pdfRest",{"id":7459,"uuid":7460,"title":7461,"slug":7462,"html":7463,"comment_id":7459,"feature_image":48,"featured":284,"visibility":1257,"created_at":7418,"updated_at":7442,"published_at":7443,"custom_excerpt":7464,"codeinjection_head":7465,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7466,"primary_tag":7475,"url":7476,"excerpt":7464,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7477,"meta_description":7464,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a964be6533c9f26b943ad3a","a30291b0-1b5c-4811-9101-bb4606067333","How to Convert XML to PDF with Java","how-to-convert-xml-to-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This Java tutorial demonstrates how to upload XML to the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa> and receive a styled, tagged PDF. The example uses hierarchy presentation for readability and includes the page, language, and font controls needed for predictable document output.\u003C\u002Fp>\n\n\u003Ch2>Why Convert XML to PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>Java applications often sit at the center of enterprise systems where XML represents transactions, policy data, service messages, or archival metadata. Those payloads are useful to software, but business reviewers usually need a stable document that communicates the same information without exposing them to raw markup.\u003C\u002Fp>\n\n\u003Cp>For example, an insurance platform may receive a nested XML response from an underwriting service and need to preserve the decision details with a case file. The application can convert that response into a PDF whose hierarchy keeps sections, fields, and values visually related. Claims staff can review the result in ordinary document software, and the generated resource can continue through the organization’s existing PDF workflow.\u003C\u002Fp>\n\n\u003Cp>Centralizing this work in an API also keeps the Java service from maintaining its own XML-to-layout engine. Teams can select hierarchy mode for operational review or source mode for developers and auditors who need to see the original element syntax, while using the same conversion path for both audiences.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example for Converting XML to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class PdfFromXml {\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) throws IOException {\n    File inputFile = new File(args.length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.xml\");\n    Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n    String apiKey = dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY);\n    JSONObject options =\n        new JSONObject(\n            \"{\\\"title\\\":\\\"Structured Content Sample\\\",\\\"language\\\":\\\"en-US\\\",\\\"enable_tagging\\\":true,\\\"page_setup\\\":{\\\"size\\\":\\\"Letter\\\",\\\"orientation\\\":\\\"portrait\\\",\\\"margin\\\":{\\\"top\\\":36,\\\"right\\\":42,\\\"bottom\\\":36,\\\"left\\\":42}},\\\"style\\\":{\\\"font\\\":\\\"Arial\\\",\\\"heading_font\\\":\\\"Arial\\\",\\\"code_font\\\":\\\"Courier\\\",\\\"text_size\\\":11,\\\"text_color_rgb\\\":[34,34,34],\\\"heading_scale\\\":1.35,\\\"table\\\":{\\\"column_width_weights\\\":[2,3,2],\\\"keep_header_with_first_row\\\":true,\\\"repeat_headers_on_overflow\\\":true,\\\"show_borders\\\":true,\\\"border_width\\\":0.75,\\\"border_color_rgb\\\":[180,188,200],\\\"header_fill_color_rgb\\\":[33,64,98],\\\"header_text_color_rgb\\\":[255,255,255],\\\"row_fill_color_rgb\\\":[250,250,252],\\\"alternate_row_fill_color_rgb\\\":[235,240,246],\\\"cell_padding\\\":{\\\"top\\\":6,\\\"right\\\":8,\\\"bottom\\\":6,\\\"left\\\":8}}},\\\"data_presentation\\\":\\\"hierarchy\\\"}\");\n    MultipartBody.Builder form =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\n                \"file\",\n                inputFile.getName(),\n                RequestBody.create(inputFile, MediaType.parse(\"application\u002Foctet-stream\")))\n            .addFormDataPart(\"structured_text_options\", options.toString());\n    Request request =\n        new Request.Builder()\n            .url(API_URL + \"\u002Fpdf\")\n            .header(\"Api-Key\", apiKey)\n            .post(form.build())\n            .build();\n    send(request);\n  }\n\n  private static void send(Request request) throws IOException {\n    OkHttpClient client = new OkHttpClient.Builder().readTimeout(60, TimeUnit.SECONDS).build();\n    try (Response response = client.newCall(request).execute()) {\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) System.out.println(response.body().string());\n      if (!response.isSuccessful()) System.exit(1);\n    }\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPdfFromXml.java\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This Java XML example combines OkHttp for transport, \u003Ccode>org.json\u003C\u002Fcode> for conversion settings, and dotenv support for repository configuration. Those project dependencies must remain available when the class is moved into another application.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The Java endpoint excerpt exposes the regional service selection used for this XML conversion:\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">public class PdfFromXml {\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) throws IOException {\n    File inputFile = new File(args.length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.xml\");\n    Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n    String apiKey = dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY);\u003C\u002Fpre>\n\n\u003Cp>Java wraps the .xml path in an OkHttp request body and retains the filename in the multipart upload. The shared \u003Ccode>\u002Fpdf\u003C\u002Fcode> endpoint uses that extension to select XML conversion.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">  public static void main(String[] args) throws IOException {\n    File inputFile = new File(args.length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.xml\");\n    Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>JSONObject\u003C\u002Fcode> is the pdfRest conversion profile. Its title and language describe the PDF, \u003Ccode>enable_tagging\u003C\u002Fcode> explicitly requests logical tags, and \u003Ccode>page_setup\u003C\u002Fcode> establishes Letter portrait pages with 36-point margins. The \u003Ccode>style\u003C\u002Fcode> member controls the fonts, text size, color, and any XML-specific rendering choices.\u003C\u002Fp>\n\n\u003Cpre class=\"language-json\">{\n  \"data_presentation\": \"hierarchy\"\n}\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>source\u003C\u002Fcode> is the default. It first validates the XML and then displays the user’s original source text, including its markup, whitespace, and declared encoding text. \u003Ccode>hierarchy\u003C\u002Fcode> instead creates a nested list: local element names become bold labels, attributes appear with an \u003Ccode>@\u003C\u002Fcode> prefix, and leaf values follow their element names. Namespace prefixes are not displayed in hierarchy labels. Invalid XML and documents without a root element are rejected in either mode.\u003C\u002Fp>\n\n\u003Cp>The shared \u003Ccode>style.table\u003C\u002Fcode> member does not affect XML hierarchy or source output. It can be removed from an XML-only profile without changing the resulting document.\u003C\u002Fp>\n\n\u003Cp>For the XML upload, \u003Ccode>MultipartBody.Builder\u003C\u002Fcode> combines the source file, serialized \u003Ccode>structured_text_options\u003C\u002Fcode>, and ordinary \u003Ccode>output\u003C\u002Fcode> text field in one request body.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">                \"file\",\n                inputFile.getName(),\n                RequestBody.create(inputFile, MediaType.parse(\"application\u002Foctet-stream\")))\n            .addFormDataPart(\"structured_text_options\", options.toString());\n    Request request =\n        new Request.Builder()\n            .url(API_URL + \"\u002Fpdf\")\n            .header(\"Api-Key\", apiKey)\n            .post(form.build())\n            .build();\n    send(request);\u003C\u002Fpre>\n\n\u003Cp>OkHttp submits the XML conversion with the API key and checks the HTTP result. The printed body contains generated-resource JSON after success or API error details when processing fails.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">  }\n\n  private static void send(Request request) throws IOException {\n    OkHttpClient client = new OkHttpClient.Builder().readTimeout(60, TimeUnit.SECONDS).build();\n    try (Response response = client.newCall(request).execute()) {\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) System.out.println(response.body().string());\n      if (!response.isSuccessful()) System.exit(1);\n    }\n  }\n}\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>A hierarchy-based PDF can make deeply nested service responses, product catalogs, and interchange documents approachable to reviewers outside the development team. Source presentation remains available when engineers need the exact markup visible in the document.\u003C\u002Fp>\n\n\u003Cp>The requested tags describe the document’s logical organization but are not a declaration of PDF\u002FUA or WCAG conformance. Try variations interactively in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and use the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API reference\u003C\u002Fa> when selecting additional conversion controls.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Convert XML data into a styled and tagged PDF with Java while choosing a readable hierarchy or source-code presentation.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Convert XML to PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T04:11:24.000Z\",\n      \"dateModified\": \"2026-09-01T05:07:09.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert XML data into a styled and tagged PDF with Java while choosing a readable hierarchy or source-code presentation.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, Java\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert XML to PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7467,7468,7469,7470,7471,7472,7473,7474],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1426,"name":1427,"slug":1428,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-xml-to-pdf-with-java\u002F","Convert XML to PDF with Java | pdfRest",{"id":7479,"uuid":7480,"title":7481,"slug":7482,"html":7483,"comment_id":7479,"feature_image":48,"featured":284,"visibility":1257,"created_at":7418,"updated_at":7484,"published_at":7420,"custom_excerpt":7485,"codeinjection_head":7486,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7487,"primary_tag":7496,"url":7497,"excerpt":7485,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7498,"meta_description":7485,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a964be6533c9f26b943ad44","55730214-7551-4eaa-900c-91cbc472d301","How to Convert XML to PDF with JavaScript in NodeJS","how-to-convert-xml-to-pdf-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This walkthrough uses JavaScript in NodeJS to convert an XML file with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. It sends the source and structured-text settings in one multipart request, producing a tagged PDF with a readable nested layout.\u003C\u002Fp>\n\n\u003Ch2>Why Convert XML to PDF with JavaScript in NodeJS?\u003C\u002Fh2>\n\n\u003Cp>Modern NodeJS services still encounter XML through payment gateways, legacy APIs, syndication feeds, and business-to-business integrations. Returning that raw payload to a user or account team creates unnecessary friction because the structure is difficult to scan and the file may open differently across tools.\u003C\u002Fp>\n\n\u003Cp>Imagine a SaaS support portal that retrieves an XML status response from an older provisioning system. When an escalation is opened, the backend can create a PDF snapshot and add it to the case. Hierarchy presentation makes nested account, service, and error values understandable to the support engineer, while PDF provides a familiar artifact that can be downloaded or forwarded.\u003C\u002Fp>\n\n\u003Cp>NodeJS applications can also request source presentation when troubleshooting requires the exact tags and nesting to remain visible. Because both views use the same \u003Ccode>\u002Fpdf\u003C\u002Fcode> endpoint, the application can choose the presentation that matches the audience instead of maintaining separate rendering pipelines.\u003C\u002Fp>\n\n\u003Ch2>JavaScript Code Example for Converting XML to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar fs = require(\"fs\");\nvar FormData = require(\"form-data\");\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n\u002F\u002F This sample converts XML input to a tagged PDF through multipart \u002Fpdf.\n\u002F\u002F It demonstrates structured_text_options and the format-specific conversion options.\nvar inputPath = \"\u002Fpath\u002Fto\u002Fsample.xml\";\nvar form = new FormData();\nform.append(\"file\", fs.createReadStream(inputPath));\nform.append(\"structured_text_options\", JSON.stringify({\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"data_presentation\":\"hierarchy\"}));\nform.append(\"output\", \"pdf_from_xml\");\n\naxios.post(apiUrl + \"\u002Fpdf\", form, { headers: { \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", ...form.getHeaders() }, maxBodyLength: Infinity })\n.then((response) => { console.log(JSON.stringify(response.data, null, 2)); })\n.catch((error) => { console.error(error.response ? error.response.data : error.message); process.exitCode = 1; });\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-xml.js\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The NodeJS XML walkthrough uses \u003Ccode>axios\u003C\u002Fcode>, \u003Ccode>form-data\u003C\u002Fcode>, and Node’s file-system module. Outside the samples project, install its HTTP and multipart dependencies with \u003Ccode>npm install axios form-data\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar fs = require(\"fs\");\nvar FormData = require(\"form-data\");\u003C\u002Fpre>\n\n\u003Cp>This NodeJS excerpt keeps the regional endpoint visible for the XML workflow:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\u003C\u002Fpre>\n\n\u003Cp>JavaScript streams the .xml source into the form while preserving its filename. pdfRest infers XML conversion from that extension, so \u003Ccode>structured_text_options\u003C\u002Fcode> does not need an \u003Ccode>input_format\u003C\u002Fcode> property.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F It demonstrates structured_text_options and the format-specific conversion options.\nvar inputPath = \"\u002Fpath\u002Fto\u002Fsample.xml\";\nvar form = new FormData();\u003C\u002Fpre>\n\n\u003Cp>The object passed through \u003Ccode>JSON.stringify\u003C\u002Fcode> is interpreted by pdfRest as \u003Ccode>structured_text_options\u003C\u002Fcode>. It sets PDF metadata, explicitly enables tagging, defines Letter portrait geometry and margins, and supplies the font and color choices used when laying out the XML content.\u003C\u002Fp>\n\n\u003Cpre class=\"language-json\">{\n  \"data_presentation\": \"hierarchy\"\n}\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>source\u003C\u002Fcode> is the default. It first validates the XML and then displays the user’s original source text, including its markup, whitespace, and declared encoding text. \u003Ccode>hierarchy\u003C\u002Fcode> instead creates a nested list: local element names become bold labels, attributes appear with an \u003Ccode>@\u003C\u002Fcode> prefix, and leaf values follow their element names. Namespace prefixes are not displayed in hierarchy labels. Invalid XML and documents without a root element are rejected in either mode.\u003C\u002Fp>\n\n\u003Cp>The shared \u003Ccode>style.table\u003C\u002Fcode> member does not affect XML hierarchy or source output. It can be removed from an XML-only profile without changing the resulting document.\u003C\u002Fp>\n\n\u003Cp>NodeJS uses \u003Ccode>FormData\u003C\u002Fcode> to append the XML file, stringified \u003Ccode>structured_text_options\u003C\u002Fcode>, and output name. The generated form headers provide the multipart boundary for those fields.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var inputPath = \"\u002Fpath\u002Fto\u002Fsample.xml\";\nvar form = new FormData();\nform.append(\"file\", fs.createReadStream(inputPath));\nform.append(\"structured_text_options\", JSON.stringify({\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"data_presentation\":\"hierarchy\"}));\nform.append(\"output\", \"pdf_from_xml\");\n\naxios.post(apiUrl + \"\u002Fpdf\", form, { headers: { \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", ...form.getHeaders() }, maxBodyLength: Infinity })\n.then((response) => { console.log(JSON.stringify(response.data, null, 2)); })\n.catch((error) => { console.error(error.response ? error.response.data : error.message); process.exitCode = 1; });\u003C\u002Fpre>\n\n\u003Cp>Axios sends the XML request to \u003Ccode>\u002Fpdf\u003C\u002Fcode> with the form headers and \u003Ccode>Api-Key\u003C\u002Fcode>. Its success path prints resource JSON, while the rejection path exposes either the API response or the client-side error.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">form.append(\"file\", fs.createReadStream(inputPath));\nform.append(\"structured_text_options\", JSON.stringify({\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"data_presentation\":\"hierarchy\"}));\nform.append(\"output\", \"pdf_from_xml\");\n\naxios.post(apiUrl + \"\u002Fpdf\", form, { headers: { \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", ...form.getHeaders() }, maxBodyLength: Infinity })\n.then((response) => { console.log(JSON.stringify(response.data, null, 2)); })\n.catch((error) => { console.error(error.response ? error.response.data : error.message); process.exitCode = 1; });\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This approach can turn XML-based monitoring output, inventory feeds, or integration test results into documents that product and operations teams can inspect comfortably. Developers still retain source mode for cases where exact syntax is central to the review.\u003C\u002Fp>\n\n\u003Cp>Logical tagging can improve navigation and machine interpretation, but the sample makes no claim of complete accessibility conformance. Use \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> to explore the profile and review all accepted fields in the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF documentation\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-02T18:28:19.000+00:00","Use JavaScript in NodeJS to turn XML files into styled, tagged PDFs with configurable hierarchy and source views.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Convert XML to PDF with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2026-09-01T04:11:25.000Z\",\n      \"dateModified\": \"2026-09-01T05:07:09.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Use JavaScript in NodeJS to turn XML files into styled, tagged PDFs with configurable hierarchy and source views.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, JavaScript\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert XML to PDF with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7488,7489,7490,7491,7492,7493,7494,7495],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1426,"name":1427,"slug":1428,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-xml-to-pdf-with-javascript-in-nodejs\u002F","Convert XML to PDF with NodeJS | pdfRest",{"id":7500,"uuid":7501,"title":7502,"slug":7503,"html":7504,"comment_id":7500,"feature_image":48,"featured":284,"visibility":1257,"created_at":7505,"updated_at":7484,"published_at":7420,"custom_excerpt":7506,"codeinjection_head":7507,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7508,"primary_tag":7517,"url":7518,"excerpt":7506,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7519,"meta_description":7506,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a964be7533c9f26b943ad58","6f778138-2aa4-4b53-84cc-e5680b3b4b04","How to Convert XML to PDF with PHP","how-to-convert-xml-to-pdf-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This PHP example converts an XML file with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa> and applies structured document settings in the same request. The resulting PDF displays XML data as a tagged hierarchy that is easier to read than raw markup.\u003C\u002Fp>\n\n\u003Ch2>Why Convert XML to PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>PHP applications often import XML product catalogs, order acknowledgements, publishing feeds, and records from older web services. Developers can process those files directly, but merchandising, customer service, and operations teams usually need a document they can review without interpreting XML syntax.\u003C\u002Fp>\n\n\u003Cp>Suppose an online marketplace receives a supplier feed containing products, variants, availability, and pricing in nested XML. A PHP job can convert a rejected feed into a hierarchy-formatted PDF and send it with the validation report. The supplier and marketplace team can discuss the same readable snapshot, reducing the chance that an important nested value is overlooked.\u003C\u002Fp>\n\n\u003Cp>When the markup itself must be inspected, changing \u003Ccode>data_presentation\u003C\u002Fcode> to \u003Ccode>source\u003C\u002Fcode> produces a formatted code view instead. That choice lets one PHP integration support both business-facing summaries and developer-facing evidence while retaining common PDF styling and tagging controls.\u003C\u002Fp>\n\n\u003Ch2>PHP Code Example for Converting XML to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n$inputPath = '\u002Fpath\u002Fto\u002Fsample.xml';\n$options = json_decode('{\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"data_presentation\":\"hierarchy\"}', true);\n\n\u002F\u002F This sample converts XML input to a tagged PDF through multipart \u002Fpdf.\n\u002F\u002F It demonstrates structured_text_options and the format-specific conversion options.\n$multipart = [\n  ['name' => 'file', 'contents' => Utils::tryFopen($inputPath, 'r'), 'filename' => basename($inputPath)],\n  ['name' => 'structured_text_options', 'contents' => json_encode($options)],\n  ['name' => 'output', 'contents' => 'pdf_from_xml'],\n];\n$response = (new Client())->post($apiUrl . '\u002Fpdf', ['headers' => ['Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'Accept' => 'application\u002Fjson'], 'multipart' => $multipart]);\necho $response->getBody();\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-xml.php\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This PHP XML example relies on Guzzle for HTTP and PSR-7 stream utilities for the upload. When using the code outside this repository, add the client with \u003Ccode>composer require guzzlehttp\u002Fguzzle\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\u003C\u002Fpre>\n\n\u003Cp>The PHP endpoint excerpt keeps regional routing explicit for this XML operation:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\u003C\u002Fpre>\n\n\u003Cp>PHP opens the .xml source as a PSR-7 stream and includes its filename in the multipart part. The extension selects XML processing without duplicating the format in the options JSON.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$inputPath = '\u002Fpath\u002Fto\u002Fsample.xml';\n$options = json_decode('{\"title\":\"Structured Content Sample\",\"language\":\"en-US\",\"enable_tagging\":true,\"page_setup\":{\"size\":\"Letter\",\"orientation\":\"portrait\",\"margin\":{\"top\":36,\"right\":42,\"bottom\":36,\"left\":42}},\"style\":{\"font\":\"Arial\",\"heading_font\":\"Arial\",\"code_font\":\"Courier\",\"text_size\":11,\"text_color_rgb\":[34,34,34],\"heading_scale\":1.35,\"table\":{\"column_width_weights\":[2,3,2],\"keep_header_with_first_row\":true,\"repeat_headers_on_overflow\":true,\"show_borders\":true,\"border_width\":0.75,\"border_color_rgb\":[180,188,200],\"header_fill_color_rgb\":[33,64,98],\"header_text_color_rgb\":[255,255,255],\"row_fill_color_rgb\":[250,250,252],\"alternate_row_fill_color_rgb\":[235,240,246],\"cell_padding\":{\"top\":6,\"right\":8,\"bottom\":6,\"left\":8}}},\"data_presentation\":\"hierarchy\"}', true);\u003C\u002Fpre>\n\n\u003Cp>The array decoded into \u003Ccode>$options\u003C\u002Fcode> is serialized as pdfRest’s \u003Ccode>structured_text_options\u003C\u002Fcode>. It describes the PDF title and language, explicitly turns on tagging, chooses Letter portrait pages with 36-point margins, and provides typography plus XML-specific styling.\u003C\u002Fp>\n\n\u003Cpre class=\"language-json\">{\n  \"data_presentation\": \"hierarchy\"\n}\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>source\u003C\u002Fcode> is the default. It first validates the XML and then displays the user’s original source text, including its markup, whitespace, and declared encoding text. \u003Ccode>hierarchy\u003C\u002Fcode> instead creates a nested list: local element names become bold labels, attributes appear with an \u003Ccode>@\u003C\u002Fcode> prefix, and leaf values follow their element names. Namespace prefixes are not displayed in hierarchy labels. Invalid XML and documents without a root element are rejected in either mode.\u003C\u002Fp>\n\n\u003Cp>The shared \u003Ccode>style.table\u003C\u002Fcode> member does not affect XML hierarchy or source output. It can be removed from an XML-only profile without changing the resulting document.\u003C\u002Fp>\n\n\u003Cp>The PHP multipart array assigns \u003Ccode>name\u003C\u002Fcode> and \u003Ccode>contents\u003C\u002Fcode> values to the XML stream, serialized \u003Ccode>structured_text_options\u003C\u002Fcode>, and requested output name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">\u002F\u002F It demonstrates structured_text_options and the format-specific conversion options.\n$multipart = [\n  ['name' => 'file', 'contents' => Utils::tryFopen($inputPath, 'r'), 'filename' => basename($inputPath)],\n  ['name' => 'structured_text_options', 'contents' => json_encode($options)],\n  ['name' => 'output', 'contents' => 'pdf_from_xml'],\n];\n$response = (new Client())->post($apiUrl . '\u002Fpdf', ['headers' => ['Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'Accept' => 'application\u002Fjson'], 'multipart' => $multipart]);\necho $response->getBody();\u003C\u002Fpre>\n\n\u003Cp>Guzzle prepares and submits the XML multipart body with the API key. The response body contains generated-resource information on success and service error details when the conversion cannot be completed.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">  ['name' => 'file', 'contents' => Utils::tryFopen($inputPath, 'r'), 'filename' => basename($inputPath)],\n  ['name' => 'structured_text_options', 'contents' => json_encode($options)],\n  ['name' => 'output', 'contents' => 'pdf_from_xml'],\n];\n$response = (new Client())->post($apiUrl . '\u002Fpdf', ['headers' => ['Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'Accept' => 'application\u002Fjson'], 'multipart' => $multipart]);\necho $response->getBody();\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>XML-to-PDF conversion can support invoice-message review, feed diagnostics, and readable exports from content platforms. Hierarchy mode serves mixed technical and business audiences, whereas source mode is useful when reviewers need to see exact element names.\u003C\u002Fp>\n\n\u003Cp>Document tags provide a structural foundation, not an automatic guarantee of conformance with accessibility specifications. Build and inspect request variations in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, then consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF API documentation\u003C\u002Fa> for limits and optional settings.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T03:52:07.000+00:00","Create readable, tagged PDF documents from XML with PHP and select either hierarchy or source presentation.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-php\u002F#article\",\n      \"headline\": \"How to Convert XML to PDF with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-php\u002F\",\n      \"datePublished\": \"2026-09-01T04:11:25.000Z\",\n      \"dateModified\": \"2026-09-01T05:07:10.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Create readable, tagged PDF documents from XML with PHP and select either hierarchy or source presentation.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert XML to PDF with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7509,7510,7511,7512,7513,7514,7515,7516],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1426,"name":1427,"slug":1428,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-xml-to-pdf-with-php\u002F","Convert XML to PDF with PHP | pdfRest",{"id":7521,"uuid":7522,"title":7523,"slug":7524,"html":7525,"comment_id":7521,"feature_image":48,"featured":284,"visibility":1257,"created_at":7505,"updated_at":7526,"published_at":7527,"custom_excerpt":7528,"codeinjection_head":7529,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7530,"primary_tag":7539,"url":7540,"excerpt":7528,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7541,"meta_description":7528,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a964be7533c9f26b943ad62","191e6c91-d381-4850-8a0a-e8f522a689b0","How to Convert XML to PDF with Python","how-to-convert-xml-to-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This Python tutorial converts XML into a styled, tagged PDF using the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\">pdfRest Convert to PDF API Tool\u003C\u002Fa>. It demonstrates a multipart upload, structured conversion options, and hierarchy presentation for nested XML content.\u003C\u002Fp>\n\n\u003Ch2>Why Convert XML to PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>Python automation produces and consumes XML in testing, scientific processing, data exchange, and infrastructure tooling. The file may contain exactly the information a team needs, yet raw XML is a poor deliverable for release managers, researchers, or clients who expect a document they can open and annotate.\u003C\u002Fp>\n\n\u003Cp>A continuous-integration pipeline provides a practical example: test tools may emit XML containing suites, cases, durations, and failure details. A Python step can convert that artifact into a hierarchy-formatted PDF for a release evidence package. Reviewers can follow the nested results in a familiar document, while engineers still retain the XML source for machine analysis.\u003C\u002Fp>\n\n\u003Cp>For workflows centered on code review, Python can request source presentation and show the markup directly. For broader audiences, hierarchy mode suppresses syntax and emphasizes names, values, and nesting. The API handles both outcomes while also applying page setup, typography, language metadata, and optional tagging.\u003C\u002Fp>\n\n\u003Ch2>Python Code Example for Converting XML to PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">import json\nimport os\nimport requests\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# This sample converts XML input to a tagged PDF through multipart \u002Fpdf.\n# It demonstrates structured_text_options and the format-specific conversion options.\ninput_path = \"\u002Fpath\u002Fto\u002Fsample.xml\"\noptions = json.loads(r'''{\n  \"title\": \"Structured Content Sample\",\n  \"language\": \"en-US\",\n  \"enable_tagging\": true,\n  \"page_setup\": {\n    \"size\": \"Letter\",\n    \"orientation\": \"portrait\",\n    \"margin\": {\n      \"top\": 36,\n      \"right\": 42,\n      \"bottom\": 36,\n      \"left\": 42\n    }\n  },\n  \"style\": {\n    \"font\": \"Arial\",\n    \"heading_font\": \"Arial\",\n    \"code_font\": \"Courier\",\n    \"text_size\": 11,\n    \"text_color_rgb\": [\n      34,\n      34,\n      34\n    ],\n    \"heading_scale\": 1.35,\n    \"table\": {\n      \"column_width_weights\": [\n        2,\n        3,\n        2\n      ],\n      \"keep_header_with_first_row\": true,\n      \"repeat_headers_on_overflow\": true,\n      \"show_borders\": true,\n      \"border_width\": 0.75,\n      \"border_color_rgb\": [\n        180,\n        188,\n        200\n      ],\n      \"header_fill_color_rgb\": [\n        33,\n        64,\n        98\n      ],\n      \"header_text_color_rgb\": [\n        255,\n        255,\n        255\n      ],\n      \"row_fill_color_rgb\": [\n        250,\n        250,\n        252\n      ],\n      \"alternate_row_fill_color_rgb\": [\n        235,\n        240,\n        246\n      ],\n      \"cell_padding\": {\n        \"top\": 6,\n        \"right\": 8,\n        \"bottom\": 6,\n        \"left\": 8\n      }\n    }\n  },\n  \"data_presentation\": \"hierarchy\"\n}''')\n\nfrom requests_toolbelt import MultipartEncoder\nwith open(input_path, \"rb\") as input_file:\n    fields = {\n        \"file\": (os.path.basename(input_path), input_file, \"text\u002Fplain\"),\n        \"structured_text_options\": json.dumps(options),\n    }\n    form = MultipartEncoder(fields=fields)\n    response = requests.post(api_url + \"\u002Fpdf\", data=form, headers={\n        \"Accept\": \"application\u002Fjson\",\n        \"Content-Type\": form.content_type,\n        \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    })\n\nprint(\"Response status code: \" + str(response.status_code))\nif response.ok:\n    print(json.dumps(response.json(), indent=2))\nelse:\n    print(response.text)\n    raise SystemExit(1)\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-from-xml.py\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The Python XML sample uses \u003Ccode>requests\u003C\u002Fcode> and \u003Ccode>MultipartEncoder\u003C\u002Fcode> from \u003Ccode>requests-toolbelt\u003C\u002Fcode>. Install both with \u003Ccode>python -m pip install requests requests-toolbelt\u003C\u002Fcode> when they are not already present. The caller does not need a separate XML parsing package.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">import json\nimport os\nimport requests\u003C\u002Fpre>\n\n\u003Cp>This Python endpoint excerpt identifies the regional service used for XML conversion:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\"># By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>Python opens the .xml input in binary mode and sends its base filename with the stream. \u003Ccode>\u002Fpdf\u003C\u002Fcode> uses that filename extension to infer the XML input type.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\"># It demonstrates structured_text_options and the format-specific conversion options.\ninput_path = \"\u002Fpath\u002Fto\u002Fsample.xml\"\noptions = json.loads(r'''{\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>options\u003C\u002Fcode> dictionary becomes pdfRest’s \u003Ccode>structured_text_options\u003C\u002Fcode> field. It supplies document metadata, explicitly requests tags, establishes Letter portrait pages and 36-point margins, and selects the fonts, text size, color, and XML-specific presentation values.\u003C\u002Fp>\n\n\u003Cpre class=\"language-json\">{\n  \"data_presentation\": \"hierarchy\"\n}\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>source\u003C\u002Fcode> is the default. It first validates the XML and then displays the user’s original source text, including its markup, whitespace, and declared encoding text. \u003Ccode>hierarchy\u003C\u002Fcode> instead creates a nested list: local element names become bold labels, attributes appear with an \u003Ccode>@\u003C\u002Fcode> prefix, and leaf values follow their element names. Namespace prefixes are not displayed in hierarchy labels. Invalid XML and documents without a root element are rejected in either mode.\u003C\u002Fp>\n\n\u003Cp>The shared \u003Ccode>style.table\u003C\u002Fcode> member does not affect XML hierarchy or source output. It can be removed from an XML-only profile without changing the resulting document.\u003C\u002Fp>\n\n\u003Cp>For the XML call, \u003Ccode>MultipartEncoder\u003C\u002Fcode> combines the file tuple with serialized \u003Ccode>structured_text_options\u003C\u002Fcode>. Its \u003Ccode>content_type\u003C\u002Fcode>, including the boundary, becomes the request’s \u003Ccode>Content-Type\u003C\u002Fcode> header.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">with open(input_path, \"rb\") as input_file:\n    fields = {\n        \"file\": (os.path.basename(input_path), input_file, \"text\u002Fplain\"),\n        \"structured_text_options\": json.dumps(options),\n    }\n    form = MultipartEncoder(fields=fields)\n    response = requests.post(api_url + \"\u002Fpdf\", data=form, headers={\n        \"Accept\": \"application\u002Fjson\",\n        \"Content-Type\": form.content_type,\n        \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    })\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>requests.post\u003C\u002Fcode> sends the encoded XML form with the API key. The script pretty-prints resource JSON after success and otherwise displays the API message before exiting with a nonzero status.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">        \"file\": (os.path.basename(input_path), input_file, \"text\u002Fplain\"),\n        \"structured_text_options\": json.dumps(options),\n    }\n    form = MultipartEncoder(fields=fields)\n    response = requests.post(api_url + \"\u002Fpdf\", data=form, headers={\n        \"Accept\": \"application\u002Fjson\",\n        \"Content-Type\": form.content_type,\n        \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    })\n\nprint(\"Response status code: \" + str(response.status_code))\nif response.ok:\n    print(json.dumps(response.json(), indent=2))\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This pattern can automate readable reports from test fixtures, metadata repositories, or batch integration output. The choice between hierarchy and source views lets the workflow serve either general reviewers or developers investigating the raw structure.\u003C\u002Fp>\n\n\u003Cp>Tags can make the PDF’s logical organization available to assistive and downstream software, but they do not independently prove accessibility conformance. Explore different profiles in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and reference the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\u002F\">Convert to PDF documentation\u003C\u002Fa> for the complete contract.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-02T18:28:20.000+00:00","2026-09-01T04:11:26.000+00:00","Learn how to convert XML into a tagged PDF with Python and present the data as a hierarchy or formatted source.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Convert XML to PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-python\u002F\",\n      \"datePublished\": \"2026-09-01T04:11:26.000Z\",\n      \"dateModified\": \"2026-09-01T05:09:04.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert XML into a tagged PDF with Python and present the data as a hierarchy or formatted source.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Convert XML to PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-convert-xml-to-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7531,7532,7533,7534,7535,7536,7537,7538],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1426,"name":1427,"slug":1428,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-convert-xml-to-pdf-with-python\u002F","Convert XML to PDF with Python | pdfRest",{"id":7543,"uuid":7544,"title":7545,"slug":7546,"html":7547,"comment_id":7543,"feature_image":48,"featured":284,"visibility":1257,"created_at":7548,"updated_at":7526,"published_at":7548,"custom_excerpt":7549,"codeinjection_head":7550,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7551,"primary_tag":7557,"url":7558,"excerpt":7549,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7559,"meta_description":7549,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6920dee8533c9f26b943a8a2","c14d3081-6dbb-4dd7-bdad-156f31305522","How to Create a Blank PDF in .NET with C#","how-to-create-a-blank-pdf-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Create Blank PDF with C#?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-blank-pdf\u002F'>pdfRest Create Blank PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to automate the creation of blank PDF documents. This tutorial will guide you through the process of sending an API call to the Create Blank PDF endpoint using C#. By leveraging this tool, you can generate blank PDFs with customizable attributes such as page size, count, and orientation, directly from your C# applications.\u003C\u002Fp>\n\n\u003Cp>Imagine you're developing a document management system that requires generating placeholders for future content. By using the Create Blank PDF API, you can efficiently create these placeholder PDFs programmatically, saving time and reducing manual effort. This can be particularly useful in scenarios where documents need to be dynamically generated and stored for later use.\u003C\u002Fp>\n\n\u003Ch2>Create Blank PDF with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">\u002F*\n * What this sample does:\n * - Calls \u002Fblank-pdf via multipart\u002Fform-data to create a three-page blank PDF.\n * - Routed from Program.cs as: `dotnet run -- blank-pdf-multipart`.\n *\n * Setup (environment):\n * - Copy .env.example to .env\n * - Set PDFREST_API_KEY=your_api_key_here\n * - Optional: set PDFREST_URL to override the API region. For EU\u002FGDPR compliance and proximity, use:\n *     PDFREST_URL=https:\u002F\u002Feu-api.pdfrest.com\n *   For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\n * Usage:\n *   dotnet run -- blank-pdf-multipart\n *\n * Output:\n * - Prints the JSON response. Validation errors (args\u002Fenv) exit non-zero.\n *\u002F\n\nnamespace Samples.EndpointExamples.MultipartPayload\n{\n    public static class BlankPdf\n    {\n        public static async Task Execute(string[] args)\n        {\n            var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\n            if (string.IsNullOrWhiteSpace(apiKey))\n            {\n                Console.Error.WriteLine(\"Missing required environment variable: PDFREST_API_KEY\");\n                Environment.Exit(1);\n                return;\n            }\n\n            var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n\n            using (var httpClient = new HttpClient { BaseAddress = new Uri(baseUrl) })\n            using (var request = new HttpRequestMessage(HttpMethod.Post, \"blank-pdf\"))\n            {\n                request.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\n                request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n\n                var multipartContent = new MultipartFormDataContent\n                {\n                    { new StringContent(\"letter\"), \"page_size\" },\n                    { new StringContent(\"3\"), \"page_count\" },\n                    { new StringContent(\"portrait\"), \"page_orientation\" }\n                };\n\n                request.Content = multipartContent;\n                var response = await httpClient.SendAsync(request);\n                var apiResult = await response.Content.ReadAsStringAsync();\n\n                Console.WriteLine(\"blank-pdf response received.\");\n                Console.WriteLine(apiResult);\n\n                if (!response.IsSuccessStatusCode)\n                {\n                    Environment.ExitCode = 1;\n                }\n            }\n        }\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fblank-pdf.cs\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by retrieving the API key from the environment variables:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\n\u003C\u002Fpre>\n\n\u003Cp>This key is essential for authenticating the request. If the key is missing, the program exits with an error message.\u003C\u002Fp>\n\n\u003Cp>The base URL for the API is determined next, with an option to override it for GDPR compliance:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n\u003C\u002Fpre>\n\n\u003Cp>An HTTP client is then configured to send a POST request to the \"blank-pdf\" endpoint:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(baseUrl) })\nusing (var request = new HttpRequestMessage(HttpMethod.Post, \"blank-pdf\"))\n\u003C\u002Fpre>\n\n\u003Cp>The request headers include the API key and specify that the response should be in JSON format:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\nrequest.Headers.Accept.Add(new(\"application\u002Fjson\"));\n\u003C\u002Fpre>\n\n\u003Cp>The request content is prepared using \u003Ccode>MultipartFormDataContent\u003C\u002Fcode>, setting parameters for page size, count, and orientation:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent\n{\n    { new StringContent(\"letter\"), \"page_size\" },\n    { new StringContent(\"3\"), \"page_count\" },\n    { new StringContent(\"portrait\"), \"page_orientation\" }\n};\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the request is sent, and the response is read and printed:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\nvar apiResult = await response.Content.ReadAsStringAsync();\nConsole.WriteLine(\"blank-pdf response received.\");\nConsole.WriteLine(apiResult);\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to create a blank PDF using the pdfRest API with C#. This example demonstrated a multipart API call, setting parameters for the PDF's attributes. To further explore the capabilities of pdfRest, try out all the available API tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>For detailed information on the API's capabilities, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcreate-blank-pdf\u002F\">API Reference Guide\u003C\u002Fa>. Additionally, for examples using JSON payloads, visit the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fblank-pdf.cs\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-11-21T21:51:36.000+00:00","Learn how to use the pdfRest Create Blank PDF API to generate an empty PDF that can be filled with content using C#.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Create a Blank PDF in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-in-net-with-c\u002F\",\n      \"datePublished\": \"2025-11-21T21:51:36.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:07.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use the pdfRest Create Blank PDF API to generate an empty PDF that can be filled with content using C#.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Create Blank PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-blank-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fblank-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcreate-blank-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Create Blank PDF, PDF Generation\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Create a Blank PDF in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7552,7553,7554,7555,7556],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1846,"name":1847,"slug":1848,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-create-a-blank-pdf-in-net-with-c\u002F","How to Create a Blank PDF in .NET with C#, Tutorial | pdfRest",{"id":7561,"uuid":7562,"title":7563,"slug":7564,"html":7565,"comment_id":7561,"feature_image":48,"featured":284,"visibility":1257,"created_at":7566,"updated_at":7567,"published_at":7566,"custom_excerpt":7568,"codeinjection_head":7569,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7570,"primary_tag":7576,"url":7577,"excerpt":7568,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7578,"meta_description":7568,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6920df57533c9f26b943a8b6","5dde5715-25b3-4876-88c3-afadac3eefd5","How to Create a Blank PDF with cURL","how-to-create-a-blank-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Create Blank PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-blank-pdf\u002F'>pdfRest Create Blank PDF API Tool\u003C\u002Fa> is a convenient solution for developers looking to generate blank PDF documents programmatically. This tool allows users to specify the size, number of pages, and orientation of the PDF, making it highly customizable for various needs. In this tutorial, we will demonstrate how to send an API call to Create Blank PDF using cURL, a command-line tool for transferring data with URLs.\u003C\u002Fp>\n\n\u003Cp>Imagine a scenario where a company needs to generate multiple blank PDF templates for internal documentation or client forms. By using the Create Blank PDF tool, they can automate this process, ensuring consistency and saving time. This is particularly useful for businesses that require a large volume of standardized documents, such as legal firms or educational institutions.\u003C\u002Fp>\n\n\u003Ch2>Create Blank PDF with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\ncurl -X POST \"$API_URL\u002Fblank-pdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"page_size=letter\" \\\n  -F \"page_count=3\" \\\n  -F \"page_orientation=portrait\"\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fblank-pdf.sh\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided script begins by defining the \u003Ccode>API_URL\u003C\u002Fcode> variable, which points to the US-based API service at \u003Ccode>https:\u002F\u002Fapi.pdfrest.com\u003C\u002Fcode>. This is the primary endpoint for global users. For European users requiring GDPR compliance, an alternative EU-based service URL is available, which can be uncommented if needed.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>curl\u003C\u002Fcode> command is used to send an HTTP POST request to the \u003Ccode>$API_URL\u002Fblank-pdf\u003C\u002Fcode> endpoint. The \u003Ccode>-X POST\u003C\u002Fcode> option specifies the request method.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>-H \"Accept: application\u002Fjson\"\u003C\u002Fcode> header indicates that the client expects a JSON response from the server. The \u003Ccode>-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\u003C\u002Fcode> header includes the API key, which is necessary for authenticating the request. Replace the placeholder with your actual API key.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>-F\u003C\u002Fcode> options are used to specify form data for the request:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Ccode>page_size=letter\u003C\u002Fcode>: Sets the size of the PDF pages to \"letter\".\u003C\u002Fli>\n\u003Cli>\u003Ccode>page_count=3\u003C\u002Fcode>: Specifies that the PDF should contain three pages.\u003C\u002Fli>\n\u003Cli>\u003Ccode>page_orientation=portrait\u003C\u002Fcode>: Sets the orientation of the pages to \"portrait\".\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we learned how to use cURL to make an API call to the pdfRest Create Blank PDF endpoint, allowing us to generate a customizable blank PDF document. This process can be easily integrated into larger workflows to automate document creation.\u003C\u002Fp>\n\n\u003Cp>For more experimentation, you can try out all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. Additionally, the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> provides comprehensive information on all available endpoints and parameters.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fblank-pdf.sh\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-11-21T21:53:27.000+00:00","2026-09-02T18:28:21.000+00:00","Learn how to generate a blank PDF to fill with content using the pdfRest Create Blank PDF API with cURL.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Create a Blank PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-curl\u002F\",\n      \"datePublished\": \"2025-11-21T21:53:27.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:07.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to generate a blank PDF to fill with content using the pdfRest Create Blank PDF API with cURL.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Create Blank PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-blank-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fblank-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcreate-blank-pdf\"\n        }\n      ],\n      \"keywords\": \"Create Blank PDF, PDF Generation, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Create a Blank PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7571,7572,7573,7574,7575],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1846,"name":1847,"slug":1848,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-create-a-blank-pdf-with-curl\u002F","How to Create a Blank PDF with cURL, Tutorial | pdfRest",{"id":7580,"uuid":7581,"title":7582,"slug":7583,"html":7584,"comment_id":7580,"feature_image":48,"featured":284,"visibility":1257,"created_at":7585,"updated_at":7586,"published_at":7585,"custom_excerpt":7587,"codeinjection_head":7588,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7589,"primary_tag":7595,"url":7596,"excerpt":7587,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7597,"meta_description":7587,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6920df7f533c9f26b943a8c0","570d31f1-c312-409a-b008-93d804a83025","How to Create a Blank PDF with Java","how-to-create-a-blank-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Generate a Blank PDF Programmatically with Java\u003C\u002Fh2>\n\n\u003Cp>Some PDF-generation workflows need a document with known page dimensions and count before any content is added. Storing a separate empty template for every variation creates files that must be versioned, distributed, and kept synchronized. The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-blank-pdf\u002F\">Create Blank PDF API Tool\u003C\u002Fa> generates that starting document on demand, giving a Java application a consistent canvas for reports, covers, forms, certificates, print pieces, test fixtures, and other dynamically assembled PDFs.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>\u002Fblank-pdf\u003C\u002Fcode> endpoint requires no source upload. It creates the requested pages and returns a resource that is ready for another pdfRest operation. This separates document setup from content placement and allows applications to vary size, orientation, and page count through data rather than maintaining a growing template library.\u003C\u002Fp>\n\n\u003Cp>For example, a Java reporting service can create a three-page Letter-size PDF for each customer, then use Add to PDF to place a cover, account summary, and supporting details on the appropriate pages. The document structure can be generated from report data without storing and selecting a separate empty template first.\u003C\u002Fp>\n\n\u003Cp>This Java example creates a three-page, portrait, Letter-size PDF with OkHttp and prints the JSON response.\u003C\u002Fp>\n\n\u003Ch2>Java Create Blank PDF Code Example\u003C\u002Fh2>\n\n\u003Cp>Add OkHttp, java-dotenv, and JSON-java to the project. Set \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode> in the environment or a \u003Ccode>.env\u003C\u002Fcode> file before running the sample.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONObject;\n\npublic class BlankPDF {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n   * service by commenting out the URL above and uncommenting the URL below.\n   * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n   *\u002F\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    MultipartBody.Builder builder = new MultipartBody.Builder().setType(MultipartBody.FORM);\n    builder.addFormDataPart(\"page_size\", \"letter\");\n    builder.addFormDataPart(\"page_count\", \"3\");\n    builder.addFormDataPart(\"page_orientation\", \"portrait\");\n\n    RequestBody requestBody = builder.build();\n\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fblank-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"blank-pdf Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FBlankPDF.java\">pdfRest Create Blank PDF multipart Java sample\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Cp>Create Blank PDF does not require an input file, so an application can send the page settings as JSON instead of multipart form data. See the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FBlankPDF.java\">Create Blank PDF JSON-payload sample for Java\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Define Page Size, Count, and Orientation\u003C\u002Fh2>\n\n\u003Cp>The sample builds a multipart request with three fields:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Ccode>page_size\u003C\u002Fcode> selects a standard size. Current values include \u003Ccode>letter\u003C\u002Fcode>, \u003Ccode>legal\u003C\u002Fcode>, \u003Ccode>ledger\u003C\u002Fcode>, \u003Ccode>A3\u003C\u002Fcode>, \u003Ccode>A4\u003C\u002Fcode>, and \u003Ccode>A5\u003C\u002Fcode>.\u003C\u002Fli>\n\u003Cli>\u003Ccode>page_count\u003C\u002Fcode> sets the number of blank pages. One request can create as many as 1,000 pages.\u003C\u002Fli>\n\u003Cli>\u003Ccode>page_orientation\u003C\u002Fcode> selects \u003Ccode>portrait\u003C\u002Fcode> or \u003Ccode>landscape\u003C\u002Fcode> when a standard page size is used.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>For a nonstandard canvas, set \u003Ccode>page_size\u003C\u002Fcode> to \u003Ccode>custom\u003C\u002Fcode> and provide \u003Ccode>custom_width\u003C\u002Fcode> and \u003Ccode>custom_height\u003C\u002Fcode>. Custom dimensions use PDF units, where 72 units equal one inch. Orientation is implicit in the custom width and height, so \u003Ccode>page_orientation\u003C\u002Fcode> is not required for a custom size.\u003C\u002Fp>\n\n\u003Cp>Choose these values from validated application input rather than inserting untrusted strings directly into the request. Consistent page specifications are especially important when later steps position text or images at known coordinates or when the output must meet printing requirements.\u003C\u002Fp>\n\n\u003Ch2>Continue the PDF Generation Workflow\u003C\u002Fh2>\n\n\u003Cp>After the request succeeds, the response contains a resource ID for the new PDF. Pass that ID to the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fadd-to-pdf\u002F\">Add to PDF API Tool\u003C\u002Fa> to place text, images, or other content onto the blank pages. Because the next call can use the server-side ID, the application does not have to download the empty PDF and upload it again before adding content.\u003C\u002Fp>\n\n\u003Cp>The same resource-based pattern can continue into other pdfRest tools for merging, optimization, security, or delivery. It keeps the Java application focused on workflow rules while pdfRest handles the underlying PDF creation and modification operations. An optional \u003Ccode>output\u003C\u002Fcode> field can provide a meaningful filename for the generated document.\u003C\u002Fp>\n\n\u003Ch2>Handle the OkHttp Response Reliably\u003C\u002Fh2>\n\n\u003Cp>The example reads the API key through \u003Ccode>Dotenv\u003C\u002Fcode>, sends the request to the US Cloud API, and includes an alternate EU base URL. Keep the selected base URL in deployment configuration when the same application runs in multiple regions or environments.\u003C\u002Fp>\n\n\u003Cp>Before using the result, check \u003Ccode>response.isSuccessful()\u003C\u002Fcode> and validate that the expected resource information is present. Use try-with-resources around the OkHttp \u003Ccode>Response\u003C\u002Fcode> so its body is closed after every request. The sample applies a 60-second read timeout; production services should choose timeouts and retry behavior based on their own workload and should distinguish transient network failures from invalid request parameters.\u003C\u002Fp>\n\n\u003Cp>Keep the API key out of source control and avoid logging credentials or sensitive generated content. Standard and custom page sizes, page counts, and resource-ID chaining give the application a predictable starting point for every supported document-generation path.\u003C\u002Fp>\n\n\u003Cp>You can experiment with page settings in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and review the exact request and response schema in the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcreate-blank-pdf\">Create Blank PDF API reference\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-11-21T21:54:07.000+00:00","2026-09-11T03:35:00.000+00:00","Learn how to generate a blank PDF to fill with content using Java with the pdfRest Create Blank PDF API.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Create a Blank PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-java\u002F\",\n      \"datePublished\": \"2025-11-21T21:54:07.000Z\",\n      \"dateModified\": \"2026-09-10T18:59:32.275Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to generate a blank PDF to fill with content using Java with the pdfRest Create Blank PDF API.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Create Blank PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-blank-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fblank-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcreate-blank-pdf\"\n        }\n      ],\n      \"keywords\": \"Create Blank PDF, Java, PDF Generation\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Create a Blank PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7590,7591,7592,7593,7594],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1846,"name":1847,"slug":1848,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-create-a-blank-pdf-with-java\u002F","How to Create a Blank PDF with Java, Tutorial | pdfRest",{"id":7599,"uuid":7600,"title":7601,"slug":7602,"html":7603,"comment_id":7599,"feature_image":48,"featured":284,"visibility":1257,"created_at":7604,"updated_at":7567,"published_at":7604,"custom_excerpt":7605,"codeinjection_head":7606,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7607,"primary_tag":7613,"url":7614,"excerpt":7605,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7615,"meta_description":7605,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6920df32533c9f26b943a8ac","dd963627-11d6-4a73-90fc-e351bb4075dc","How to Create a Blank PDF with JavaScript in NodeJS","how-to-create-a-blank-pdf-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Create Blank PDF with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-blank-pdf\u002F'>pdfRest Create Blank PDF API Tool\u003C\u002Fa> allows developers to generate blank PDF documents programmatically. This tutorial will guide you through the process of sending an API call to create a blank PDF using JavaScript. By leveraging this API, you can automate the creation of PDF documents with specified parameters such as page size, count, and orientation, making it a versatile tool for various applications.\u003C\u002Fp>\n\n\u003Cp>A real-world example of using the Create Blank PDF API might involve a document management system where users need to generate standardized forms or templates for further data entry. For instance, a company might use this API to create blank invoices or reports that are later filled with specific data, ensuring consistency and efficiency in document creation.\u003C\u002Fp>\n\n\u003Ch2>Create Blank PDF with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to generate a blank PDF.\nvar axios = require('axios');\nvar FormData = require('form-data');\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n\u002F\u002F Create a new form data instance and append the required parameters to it\nvar data = new FormData();\ndata.append('page_size', 'letter');\ndata.append('page_count', '3');\ndata.append('page_orientation', 'portrait');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: apiUrl + '\u002Fblank-pdf',\n  headers: {\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error);\n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fblank-pdf.js\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing the necessary modules, \u003Ccode>axios\u003C\u002Fcode> and \u003Ccode>form-data\u003C\u002Fcode>, which are essential for making HTTP requests and handling form data, respectively.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\u003C\u002Fpre>\n\n\u003Cp>This line sets the API endpoint to the US-based service. For European users, the EU-based endpoint can be used by uncommenting the alternative URL.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('page_size', 'letter');\ndata.append('page_count', '3');\ndata.append('page_orientation', 'portrait');\n\u003C\u002Fpre>\n\n\u003Cp>A \u003Ccode>FormData\u003C\u002Fcode> instance is created to hold the parameters for the API request. The parameters include \u003Ccode>page_size\u003C\u002Fcode> (set to 'letter'), \u003Ccode>page_count\u003C\u002Fcode> (set to '3'), and \u003Ccode>page_orientation\u003C\u002Fcode> (set to 'portrait'). These parameters define the characteristics of the blank PDF to be created.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: apiUrl + '\u002Fblank-pdf',\n  headers: {\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>config\u003C\u002Fcode> object defines the request configuration, including the HTTP method ('post'), the URL for the API call, and the headers. The \u003Ccode>'Api-Key'\u003C\u002Fcode> must be replaced with your actual API key. The \u003Ccode>data\u003C\u002Fcode> property holds the form data to be sent.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error);\n});\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>axios\u003C\u002Fcode> function sends the request using the defined configuration. The response is logged to the console if successful, or an error is logged if the request fails.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to make an API call to create a blank PDF using JavaScript and the pdfRest API. This example demonstrates a multipart API call, which is useful for sending form data. To explore more, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further details, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fblank-pdf.js\">here\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-11-21T21:52:50.000+00:00","Learn how to generate an empty PDF that can be filled with content using the pdfRest Create Blank PDF API with JavaScript.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Create a Blank PDF with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2025-11-21T21:52:50.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:07.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to generate an empty PDF that can be filled with content using the pdfRest Create Blank PDF API with JavaScript.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Create Blank PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-blank-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fblank-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcreate-blank-pdf\"\n        }\n      ],\n      \"keywords\": \"Create Blank PDF, JavaScript, PDF Generation\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Create a Blank PDF with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7608,7609,7610,7611,7612],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1846,"name":1847,"slug":1848,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-create-a-blank-pdf-with-javascript-in-nodejs\u002F","How to Create a Blank PDF with JavaScript in NodeJS, Tutorial | pdfRest",{"id":7617,"uuid":7618,"title":7619,"slug":7620,"html":7621,"comment_id":7617,"feature_image":48,"featured":284,"visibility":1257,"created_at":7622,"updated_at":7623,"published_at":7622,"custom_excerpt":7624,"codeinjection_head":7625,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7626,"primary_tag":7632,"url":7633,"excerpt":7624,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7634,"meta_description":7624,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6920deaa533c9f26b943a898","0f3abbc3-1a49-4256-a922-07bbd275a89b","How to Create a Blank PDF with PHP","how-to-create-a-blank-pdf-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Create Blank PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-blank-pdf\u002F'>pdfRest Create Blank PDF API Tool\u003C\u002Fa> offers a convenient way to generate blank PDF documents programmatically. This tutorial will guide you through the process of sending an API call to create a blank PDF using PHP. By leveraging the capabilities of the pdfRest API, developers can automate the creation of PDF documents with specific attributes such as page size, count, and orientation.\u003C\u002Fp>\n\n\u003Cp>Imagine a scenario where a company needs to generate blank PDF templates for internal documentation or forms that require manual filling. Using the Create Blank PDF API, developers can automate the production of these templates, ensuring consistency and saving time. This API is particularly useful for applications that need to dynamically generate documents based on user input or other criteria.\u003C\u002Fp>\n\n\u003Ch2>Create Blank PDF with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">\nrequire 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\n$headers = [\n  'Api-Key' =--> 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'page_size',\n      'contents' => 'letter'\n    ],\n    [\n      'name' => 'page_count',\n      'contents' => '3'\n    ],\n    [\n      'name' => 'page_orientation',\n      'contents' => 'portrait'\n    ]\n  ]\n];\n\n$request = new Request('POST', $apiUrl.'\u002Fblank-pdf', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the JSON metadata for the blank PDF.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fblank-pdf.php\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>\u003C\u002Fp>\n\u003Cpre class=\"language-python\">require 'vendor\u002Fautoload.php';\u003C\u002Fpre>\n\n\u003Cp>\u003C\u002Fp>\n\n\u003Cp>\u003C\u002Fp>\n\u003Cpre class=\"language-python\">use GuzzleHttp\\Client;\u003C\u002Fpre>\n\n\u003Cpre class=\"language-python\">use GuzzleHttp\\Psr7\\Request;\u003C\u002Fpre>\n\n\u003Cp>\u003C\u002Fp>\n\n\u003Cp>The \u003C\u002Fp>\n\u003Cpre class=\"language-python\">$apiUrl\u003C\u002Fpre>\n\n\u003Cp>\u003C\u002Fp>\n\n\u003Cp>\u003C\u002Fp>\n\u003Cpre class=\"language-python\">$client = new Client();\u003C\u002Fpre>\n\n\u003Cp>\u003C\u002Fp>\n\n\u003Cp>The \u003C\u002Fp>\n\u003Cpre class=\"language-python\">$headers\u003C\u002Fpre>\n\n\u003Cpre class=\"language-python\">'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\u003C\u002Fpre>\n\n\u003Cp>\u003C\u002Fp>\n\n\u003Cp>The \u003C\u002Fp>\n\u003Cpre class=\"language-python\">$options\u003C\u002Fpre>\n\n\u003Cpre class=\"language-python\">'page_size'\u003C\u002Fpre>\n\n\u003Cpre class=\"language-python\">'page_count'\u003C\u002Fpre>\n\n\u003Cpre class=\"language-python\">'page_orientation'\u003C\u002Fpre>\n\n\u003Cp>\u003C\u002Fp>\n\n\u003Cp>\u003C\u002Fp>\n\u003Cpre class=\"language-python\">$request = new Request('POST', $apiUrl.'\u002Fblank-pdf', $headers);\u003C\u002Fpre>\n\n\u003Cp>\u003C\u002Fp>\n\n\u003Cp>\u003C\u002Fp>\n\u003Cpre class=\"language-python\">$res = $client->sendAsync($request, $options)->wait();\u003C\u002Fpre>\n\n\u003Cp>\u003C\u002Fp>\n\n\u003Cp>\u003C\u002Fp>\n\u003Cpre class=\"language-python\">echo $res->getBody();\u003C\u002Fpre>\n\n\u003Cp>\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use the pdfRest Create Blank PDF API tool to generate a blank PDF document using PHP. This approach can be extended to automate the creation of various document templates in your applications.\u003C\u002Fp>\n\n\u003Cp>For further exploration, you are encouraged to try out all the pdfRest API Tools available in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. Detailed documentation can be found in the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. This example demonstrates a multipart API call, and code samples using JSON payloads can be found \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fblank-pdf.php\">here\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-11-21T21:50:34.000+00:00","2026-09-02T18:28:22.000+00:00","Learn how to use the pdfRest Create Blank PDF API with PHP to generate an empty PDF that can be filled with content.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-php\u002F#article\",\n      \"headline\": \"How to Create a Blank PDF with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-php\u002F\",\n      \"datePublished\": \"2025-11-21T21:50:34.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:07.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use the pdfRest Create Blank PDF API with PHP to generate an empty PDF that can be filled with content.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Create Blank PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-blank-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fblank-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcreate-blank-pdf\"\n        }\n      ],\n      \"keywords\": \"Create Blank PDF, PDF Generation, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Create a Blank PDF with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7627,7628,7629,7630,7631],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1846,"name":1847,"slug":1848,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-create-a-blank-pdf-with-php\u002F","How to Create a Blank PDF with PHP, Tutorial | pdfRest",{"id":7636,"uuid":7637,"title":7638,"slug":7639,"html":7640,"comment_id":7636,"feature_image":48,"featured":284,"visibility":1257,"created_at":7641,"updated_at":7623,"published_at":7641,"custom_excerpt":7642,"codeinjection_head":7643,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7644,"primary_tag":7650,"url":7651,"excerpt":7642,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7652,"meta_description":7642,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6920ddc8533c9f26b943a88e","2098f58d-d089-47e4-98a0-af4a620ff9dd","How to Create a Blank PDF with Python","how-to-create-a-blank-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Create Blank PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-blank-pdf\u002F'>pdfRest Create Blank PDF API Tool\u003C\u002Fa> is a powerful utility that allows developers to generate blank PDF documents programmatically. This tutorial will guide you through the process of sending an API call to the Create Blank PDF endpoint using Python. By leveraging this tool, you can automate the creation of PDF documents, which can be beneficial for various applications where generating blank PDFs is necessary.\u003C\u002Fp>\n\n\u003Cp>In a real-world scenario, you might use the Create Blank PDF feature to generate placeholders for documents that will be filled in later. For example, a company might need to create blank invoice templates that are later populated with customer-specific data. Automating this process with the pdfRest API can save time and reduce the potential for human error, making it an invaluable tool for businesses that handle large volumes of documents.\u003C\u002Fp>\n\n\u003Ch2>Create Blank PDF with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\n\nblank_pdf_endpoint_url = api_url + '\u002Fblank-pdf'\n\n# The \u002Fblank-pdf endpoint generates an empty PDF, so no file upload is required.\nmp_encoder_blank_pdf = MultipartEncoder(\n    fields={\n        'page_size': 'letter',\n        'page_count': '3',\n        'page_orientation': 'portrait',\n    }\n)\n\n# Let's set the headers that the blank-pdf endpoint expects.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_blank_pdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'  # place your api key here\n}\n\nprint(\"Sending POST request to blank-pdf endpoint...\")\nresponse = requests.post(blank_pdf_endpoint_url, data=mp_encoder_blank_pdf, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent=2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-multipart.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fblank-pdf.py\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary libraries: \u003Ccode>requests_toolbelt\u003C\u002Fcode> for handling multipart form data, \u003Ccode>requests\u003C\u002Fcode> for making HTTP requests, and \u003Ccode>json\u003C\u002Fcode> for working with JSON data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">api_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\u003C\u002Fpre>\n\n\u003Cp>This line sets the base URL for the API. You can switch to an EU-based service by uncommenting the alternative URL for GDPR compliance.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">blank_pdf_endpoint_url = api_url + '\u002Fblank-pdf'\n\u003C\u002Fpre>\n\n\u003Cp>This constructs the full URL for the blank PDF endpoint by appending \u003Ccode>\u002Fblank-pdf\u003C\u002Fcode> to the base URL.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_blank_pdf = MultipartEncoder(\n    fields={\n        'page_size': 'letter',\n        'page_count': '3',\n        'page_orientation': 'portrait',\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>MultipartEncoder\u003C\u002Fcode> is used to create the payload for the request. The fields specify the page size, count, and orientation of the PDF. According to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcreate-blank-pdf\u002F\">pdfRest Cloud API Reference Guide\u003C\u002Fa>, these parameters define the properties of the generated PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_blank_pdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'  # place your api key here\n}\n\u003C\u002Fpre>\n\n\u003Cp>The headers are set to specify the expected response format (\u003Ccode>application\u002Fjson\u003C\u002Fcode>), the content type of the request, and the API key for authentication. The API key must be replaced with your own.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(blank_pdf_endpoint_url, data=mp_encoder_blank_pdf, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This line sends a POST request to the API endpoint with the specified data and headers. The response is then processed to check for success and print the result.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use Python to make an API call to the pdfRest Create Blank PDF endpoint. This allows you to programmatically generate blank PDFs with specific properties. To explore more features and capabilities of pdfRest, you can try out all the API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>For more detailed information on each API call and its parameters, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. Note that this example uses a multipart API call, and you can find code samples using JSON payloads at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fblank-pdf.py\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-11-21T21:46:48.000+00:00","Learn how to create a blank PDF to fill with content using the pdfRest Create Blank PDF API with Python.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Create a Blank PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-python\u002F\",\n      \"datePublished\": \"2025-11-21T21:46:48.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:08.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to create a blank PDF to fill with content using the pdfRest Create Blank PDF API with Python.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Create Blank PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-blank-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fblank-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcreate-blank-pdf\"\n        }\n      ],\n      \"keywords\": \"Create Blank PDF, PDF Generation, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Create a Blank PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-blank-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7645,7646,7647,7648,7649],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1846,"name":1847,"slug":1848,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1850,"name":1851,"slug":1852,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-create-a-blank-pdf-with-python\u002F","How to Create a Blank PDF with Python, Tutorial | pdfRest",{"id":7654,"uuid":7655,"title":7656,"slug":7657,"html":7658,"comment_id":7654,"feature_image":48,"featured":284,"visibility":1257,"created_at":7659,"updated_at":7660,"published_at":7660,"custom_excerpt":7661,"codeinjection_head":7662,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7663,"primary_tag":48,"url":7672,"excerpt":7661,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7673,"meta_description":7661,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6aad55afd1b70dd2e2978f2d","16581e2b-59ac-4350-b5df-282e332885f1","How to Create a ZUGFeRD PDF in .NET with C#","how-to-create-a-zugferd-pdf-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This tutorial shows how to create a ZUGFeRD or Factur-X hybrid PDF\u002FA-3 invoice with .NET with C#. It uses the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-zugferd-pdf\u002F\">pdfRest Create ZUGFeRD PDF API Tool\u003C\u002Fa> to send canonical invoice XML and a visual invoice PDF, then returns a managed invoice resource for the next step in the workflow.\u003C\u002Fp>\n\n\u003Ch2>Why Create a ZUGFeRD PDF in .NET with C#?\u003C\u002Fh2>\n\n\u003Cp>Electronic invoicing programs increasingly require an invoice that people can read and systems can process. ZUGFeRD and Factur-X pair a visual PDF with structured invoice XML so finance teams, customers, and downstream systems can work from the same invoice record.\u003C\u002Fp>\n\n\u003Cp>A .NET with C# billing service could generate the invoice XML from its accounting data, pair it with a customer-facing PDF, and submit both to pdfRest before delivery. That gives the service a documented API step for producing the hybrid invoice rather than relying on a manual desktop process.\u003C\u002Fp>\n\n\u003Cp>The supplied PDF is retained when it agrees with the canonical XML. With \u003Ccode>regenerate_pdf=true\u003C\u002Fcode>, the service can create a replacement PDF when it cannot confirm that agreement or finds a mismatch, which gives the workflow a defined fallback instead of silently accepting an uncertain visual invoice.\u003C\u002Fp>\n\n\u003Ch2>What the Request Does\u003C\u002Fh2>\n\n\u003Cp>The multipart request sends the invoice XML as \u003Ccode>file\u003C\u002Fcode> and the visual invoice PDF as \u003Ccode>pdf_file\u003C\u002Fcode>. \u003Ccode>regenerate_pdf\u003C\u002Fcode> controls the fallback behavior. Optional \u003Ccode>render_options\u003C\u002Fcode> set locale, label language, fonts, and accent color only for a replacement PDF; they do not alter a supplied PDF that is preserved.\u003C\u002Fp>\n\n\u003Cp>The C# samples use framework \u003Ccode>HttpClient\u003C\u002Fcode> APIs and disposable request content. The API key is read from \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode>, keeping the credential out of the source file.\u003C\u002Fp>\n\n\u003Ch2>How to Create a ZUGFeRD PDF in .NET with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">\u002F*\n * What this sample does:\n * - Creates a ZUGFeRD \u002F Factur-X PDF\u002FA-3 invoice from XML and an existing PDF through multipart\u002Fform-data.\n * - Preserves the supplied PDF when it agrees with the canonical XML.\n * - Regenerates a styled replacement only for a mismatch or unconfirmed PDF\u002FXML match.\n *\n * Setup (environment):\n * - Copy .env.example to .env and set PDFREST_API_KEY=your_api_key_here.\n * - Optional: set PDFREST_URL to override the API region. For EU\u002FGDPR compliance and proximity, use:\n *     PDFREST_URL=https:\u002F\u002Feu-api.pdfrest.com\n *   For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\n * Usage:\n *   dotnet run -- zugferd-pdf-multipart \u002Fpath\u002Fto\u002Finvoice.xml \u002Fpath\u002Fto\u002Finvoice.pdf\n *\n * Output:\n * - Prints the API JSON response and returns a nonzero exit code when the request fails.\n *\u002F\nusing System.Net.Http.Headers;\nusing Newtonsoft.Json.Linq;\n\nnamespace Samples.EndpointExamples.MultipartPayload;\n\npublic static class ZugferdPdf\n{\n    public static async Task Execute(string[] args)\n    {\n        var invoiceXml = args.Length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Finvoice.xml\";\n        var invoicePdf = args.Length > 1 ? args[1] : \"\u002Fpath\u002Fto\u002Finvoice.pdf\";\n        if (!File.Exists(invoiceXml)) throw new FileNotFoundException(\"Invoice XML not found.\", invoiceXml);\n        if (!File.Exists(invoicePdf)) throw new FileNotFoundException(\"Invoice PDF not found.\", invoicePdf);\n        var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\") ?? throw new InvalidOperationException(\"Missing PDFREST_API_KEY\");\n        var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n        using var client = new HttpClient { BaseAddress = new Uri(baseUrl) };\n        client.DefaultRequestHeaders.TryAddWithoutValidation(\"Api-Key\", apiKey);\n        using var form = new MultipartFormDataContent();\n        var xml = new ByteArrayContent(await File.ReadAllBytesAsync(invoiceXml));\n        xml.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Fxml\");\n        form.Add(xml, \"file\", Path.GetFileName(invoiceXml));\n        var pdf = new ByteArrayContent(await File.ReadAllBytesAsync(invoicePdf));\n        pdf.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Fpdf\");\n        form.Add(pdf, \"pdf_file\", Path.GetFileName(invoicePdf));\n        \u002F\u002F Render options style only a fallback-generated replacement, not a preserved PDF.\n        form.Add(new StringContent(\"true\"), \"regenerate_pdf\");\n        form.Add(new StringContent(new JObject { [\"locale\"] = \"de-DE\", [\"label_language\"] = \"de\", [\"font\"] = \"arial\", [\"bold_font\"] = \"arialbold\", [\"accent_color_rgb\"] = new JArray(0, 92, 171) }.ToString()), \"render_options\");\n        form.Add(new StringContent(\"zugferd_invoice\"), \"output\");\n        var response = await client.PostAsync(\"zugferd-pdf\", form);\n        Console.WriteLine(await response.Content.ReadAsStringAsync());\n        if (!response.IsSuccessStatusCode) Environment.ExitCode = 1;\n    }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics-erics\u002Fpdf-rest-api-samples\u002Fblob\u002Fcodex\u002Fzugferd-api-samples\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fzugferd-pdf.cs\">View the multipart sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The request is compact, but each field has a distinct role in the hybrid-invoice workflow.\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Cstrong>Identify the two document roles.\u003C\u002Fstrong> The \u003Ccode>file\u003C\u002Fcode> field holds canonical invoice XML, while \u003Ccode>pdf_file\u003C\u002Fcode> holds the customer-facing invoice PDF. The sample marks them as \u003Ccode>application\u002Fxml\u003C\u002Fcode> and \u003Ccode>application\u002Fpdf\u003C\u002Fcode>, respectively, so the service can distinguish the structured record from its visual companion.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Build the multipart request.\u003C\u002Fstrong> \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> owns the fields and generates the multipart boundary. Each \u003Ccode>StreamContent\u003C\u002Fcode> value is disposed with the form after \u003Ccode>HttpClient\u003C\u002Fcode> sends it.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Configure the request safely.\u003C\u002Fstrong> The sample gets \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode> and an optional \u003Ccode>PDFREST_URL\u003C\u002Fcode> from environment variables, keeping both regional selection and credentials outside the code.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Understand the fallback settings.\u003C\u002Fstrong> \u003Ccode>regenerate_pdf=true\u003C\u002Fcode> permits a replacement PDF when pdfRest cannot confirm that the supplied PDF agrees with the XML. The \u003Ccode>render_options\u003C\u002Fcode> object controls locale, labels, fonts, and accent color for that replacement only; it does not restyle a supplied PDF that pdfRest preserves.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Name and handle the result.\u003C\u002Fstrong> \u003Ccode>output=zugferd_invoice\u003C\u002Fcode> gives the generated resource a useful output name. The example prints \u003Ccode>response.Content\u003C\u002Fcode> and returns a nonzero process exit code for an unsuccessful HTTP status. Parse the JSON only after \u003Ccode>IsSuccessStatusCode\u003C\u002Fcode> is true.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this .NET with C# tutorial, you created a ZUGFeRD or Factur-X hybrid invoice from invoice XML and a visual PDF. The response gives the application a managed output resource it can download, deliver, or pass to a following pdfRest operation.\u003C\u002Fp>\n\n\u003Cp>For the complete request fields, accepted values, response contract, and service limits, review the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcreate-zugferd-pdf\u002F\">Create ZUGFeRD PDF API Tool documentation\u003C\u002Fa>. The same endpoint can be used with multipart uploads when the files are present in the current request or with resource IDs after a separate upload step.\u003C\u002Fp>\n\n\u003Cp>The repository also includes a \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics-erics\u002Fpdf-rest-api-samples\u002Fblob\u002Fcodex\u002Fzugferd-api-samples\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fzugferd-pdf.cs\">JSON-payload Create ZUGFeRD PDF sample for .NET with C#\u003C\u002Fa>. That version uploads the source files first and then sends their resource IDs to \u003Ccode>\u002Fzugferd-pdf\u003C\u002Fcode>, which is useful when a service already stages input files for later operations.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-18T15:15:59.000+00:00","2026-09-18T20:27:38.000+00:00","Create a ZUGFeRD or Factur-X hybrid PDF\u002FA-3 invoice with pdfRest using .NET with C#.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-zugferd-pdf-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Create a ZUGFeRD PDF in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-zugferd-pdf-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-zugferd-pdf-in-net-with-c\u002F\",\n      \"datePublished\": \"2026-09-18T15:15:59.000Z\",\n      \"dateModified\": \"2026-09-18T20:09:41.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Create a ZUGFeRD or Factur-X hybrid PDF\u002FA-3 invoice with pdfRest using .NET with C#.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Create ZUGFeRD PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-zugferd-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fzugferd-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcreate-zugferd-pdf\u002F\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, ZUGFeRD, Factur-X, C#, .NET\",\n      \"dependencies\": \"C#, .NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Create a ZUGFeRD PDF in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-zugferd-pdf-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7664,7665,7666,7667,7668,7669,7670,7671],{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1434,"name":1435,"slug":1436,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1438,"name":1439,"slug":1440,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1442,"name":1443,"slug":1444,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-create-a-zugferd-pdf-in-net-with-c\u002F","How to Create a ZUGFeRD PDF in .NET with C# | pdfRest",{"id":7675,"uuid":7676,"title":7677,"slug":7678,"html":7679,"comment_id":7675,"feature_image":48,"featured":284,"visibility":1257,"created_at":7680,"updated_at":7681,"published_at":7681,"custom_excerpt":7682,"codeinjection_head":7683,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7684,"primary_tag":48,"url":7693,"excerpt":7682,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7694,"meta_description":7682,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6aad55aed1b70dd2e2978f0f","cd6b503b-430a-4dd4-bcc0-fdbbcdbceb16","How to Create a ZUGFeRD PDF with cURL","how-to-create-a-zugferd-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This tutorial shows how to create a ZUGFeRD or Factur-X hybrid PDF\u002FA-3 invoice with cURL. It uses the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-zugferd-pdf\u002F\">pdfRest Create ZUGFeRD PDF API Tool\u003C\u002Fa> to send canonical invoice XML and a visual invoice PDF, then returns a managed invoice resource for the next step in the workflow.\u003C\u002Fp>\n\n\u003Ch2>Why Create a ZUGFeRD PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>Electronic invoicing programs increasingly require an invoice that people can read and systems can process. ZUGFeRD and Factur-X pair a visual PDF with structured invoice XML so finance teams, customers, and downstream systems can work from the same invoice record.\u003C\u002Fp>\n\n\u003Cp>A cURL billing service could generate the invoice XML from its accounting data, pair it with a customer-facing PDF, and submit both to pdfRest before delivery. That gives the service a documented API step for producing the hybrid invoice rather than relying on a manual desktop process.\u003C\u002Fp>\n\n\u003Cp>The supplied PDF is retained when it agrees with the canonical XML. With \u003Ccode>regenerate_pdf=true\u003C\u002Fcode>, the service can create a replacement PDF when it cannot confirm that agreement or finds a mismatch, which gives the workflow a defined fallback instead of silently accepting an uncertain visual invoice.\u003C\u002Fp>\n\n\u003Ch2>What the Request Does\u003C\u002Fh2>\n\n\u003Cp>The multipart request sends the invoice XML as \u003Ccode>file\u003C\u002Fcode> and the visual invoice PDF as \u003Ccode>pdf_file\u003C\u002Fcode>. \u003Ccode>regenerate_pdf\u003C\u002Fcode> controls the fallback behavior. Optional \u003Ccode>render_options\u003C\u002Fcode> set locale, label language, fonts, and accent color only for a replacement PDF; they do not alter a supplied PDF that is preserved.\u003C\u002Fp>\n\n\u003Cp>The shell sample uses cURL directly. Set the service URL, API key, and local input paths near the top of the script before running it.\u003C\u002Fp>\n\n\u003Ch2>How to Create a ZUGFeRD PDF with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">#!\u002Fbin\u002Fsh\n\n# Create a ZUGFeRD \u002F Factur-X PDF\u002FA-3 invoice from XML and an existing invoice PDF.\n# By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# Replace the API key and invoice paths below with your own values.\nAPI_KEY=\"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" # Replace with your API key\nINVOICE_XML=\"\u002Fpath\u002Fto\u002Finvoice.xml\"\nINVOICE_PDF=\"\u002Fpath\u002Fto\u002Finvoice.pdf\"\n\n# pdfRest preserves the supplied PDF when it agrees with the canonical XML.\n# `regenerate_pdf` enables a fallback replacement PDF for a mismatch or unconfirmed match.\n# `render_options` style that fallback PDF only; they do not alter a preserved supplied PDF.\ncurl --location \"$API_URL\u002Fzugferd-pdf\" \\\n  --header \"Accept: application\u002Fjson\" \\\n  --header \"Api-Key: $API_KEY\" \\\n  --form \"file=@$INVOICE_XML;type=application\u002Fxml\" \\\n  --form \"pdf_file=@$INVOICE_PDF;type=application\u002Fpdf\" \\\n  --form \"regenerate_pdf=true\" \\\n  --form 'render_options={\"locale\":\"de-DE\",\"label_language\":\"de\",\"font\":\"arial\",\"bold_font\":\"arialbold\",\"accent_color_rgb\":[0,92,171]}' \\\n  --form \"output=zugferd_invoice\"\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics-erics\u002Fpdf-rest-api-samples\u002Fblob\u002Fcodex\u002Fzugferd-api-samples\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fzugferd-pdf.sh\">View the multipart sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The request is compact, but each field has a distinct role in the hybrid-invoice workflow.\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Cstrong>Identify the two document roles.\u003C\u002Fstrong> The \u003Ccode>file\u003C\u002Fcode> field holds canonical invoice XML, while \u003Ccode>pdf_file\u003C\u002Fcode> holds the customer-facing invoice PDF. The sample marks them as \u003Ccode>application\u002Fxml\u003C\u002Fcode> and \u003Ccode>application\u002Fpdf\u003C\u002Fcode>, respectively, so the service can distinguish the structured record from its visual companion.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Build the multipart request.\u003C\u002Fstrong> \u003Ccode>curl --form\u003C\u002Fcode> builds the multipart body. The \u003Ccode>@\u003C\u002Fcode> prefix uploads a local file, and cURL supplies the multipart boundary automatically.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Configure the request safely.\u003C\u002Fstrong> Set \u003Ccode>API_URL\u003C\u002Fcode>, \u003Ccode>API_KEY\u003C\u002Fcode>, and the local input paths near the beginning of the script. The commented EU URL is an optional regional service setting.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Understand the fallback settings.\u003C\u002Fstrong> \u003Ccode>regenerate_pdf=true\u003C\u002Fcode> permits a replacement PDF when pdfRest cannot confirm that the supplied PDF agrees with the XML. The \u003Ccode>render_options\u003C\u002Fcode> object controls locale, labels, fonts, and accent color for that replacement only; it does not restyle a supplied PDF that pdfRest preserves.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Name and handle the result.\u003C\u002Fstrong> \u003Ccode>output=zugferd_invoice\u003C\u002Fcode> gives the generated resource a useful output name. The command prints the service response. In an application script, inspect the HTTP result and JSON before treating a returned resource ID or validation result as usable.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this cURL tutorial, you created a ZUGFeRD or Factur-X hybrid invoice from invoice XML and a visual PDF. The response gives the application a managed output resource it can download, deliver, or pass to a following pdfRest operation.\u003C\u002Fp>\n\n\u003Cp>For the complete request fields, accepted values, response contract, and service limits, review the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcreate-zugferd-pdf\u002F\">Create ZUGFeRD PDF API Tool documentation\u003C\u002Fa>. The same endpoint can be used with multipart uploads when the files are present in the current request or with resource IDs after a separate upload step.\u003C\u002Fp>\n\n\u003Cp>The repository also includes a \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics-erics\u002Fpdf-rest-api-samples\u002Fblob\u002Fcodex\u002Fzugferd-api-samples\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fzugferd-pdf.sh\">JSON-payload Create ZUGFeRD PDF sample for cURL\u003C\u002Fa>. That version uploads the source files first and then sends their resource IDs to \u003Ccode>\u002Fzugferd-pdf\u003C\u002Fcode>, which is useful when a service already stages input files for later operations.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-18T15:15:58.000+00:00","2026-09-18T20:27:37.000+00:00","Create a ZUGFeRD or Factur-X hybrid PDF\u002FA-3 invoice with pdfRest using cURL.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-zugferd-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Create a ZUGFeRD PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-zugferd-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-zugferd-pdf-with-curl\u002F\",\n      \"datePublished\": \"2026-09-18T15:15:58.000Z\",\n      \"dateModified\": \"2026-09-18T20:09:40.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Create a ZUGFeRD or Factur-X hybrid PDF\u002FA-3 invoice with pdfRest using cURL.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Create ZUGFeRD PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-zugferd-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fzugferd-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcreate-zugferd-pdf\u002F\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, ZUGFeRD, Factur-X, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Create a ZUGFeRD PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-zugferd-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7685,7686,7687,7688,7689,7690,7691,7692],{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1434,"name":1435,"slug":1436,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1438,"name":1439,"slug":1440,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1442,"name":1443,"slug":1444,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-create-a-zugferd-pdf-with-curl\u002F","How to Create a ZUGFeRD PDF with cURL | pdfRest",{"id":7696,"uuid":7697,"title":7698,"slug":7699,"html":7700,"comment_id":7696,"feature_image":48,"featured":284,"visibility":1257,"created_at":7659,"updated_at":7681,"published_at":7681,"custom_excerpt":7701,"codeinjection_head":7702,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7703,"primary_tag":48,"url":7712,"excerpt":7701,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7713,"meta_description":7701,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6aad55afd1b70dd2e2978f19","b5ec61df-13b3-4a0b-a108-b6257209ade0","How to Create a ZUGFeRD PDF with Java","how-to-create-a-zugferd-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This tutorial shows how to create a ZUGFeRD or Factur-X hybrid PDF\u002FA-3 invoice with Java. It uses the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-zugferd-pdf\u002F\">pdfRest Create ZUGFeRD PDF API Tool\u003C\u002Fa> to send canonical invoice XML and a visual invoice PDF, then returns a managed invoice resource for the next step in the workflow.\u003C\u002Fp>\n\n\u003Ch2>Why Create a ZUGFeRD PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>Electronic invoicing programs increasingly require an invoice that people can read and systems can process. ZUGFeRD and Factur-X pair a visual PDF with structured invoice XML so finance teams, customers, and downstream systems can work from the same invoice record.\u003C\u002Fp>\n\n\u003Cp>A Java billing service could generate the invoice XML from its accounting data, pair it with a customer-facing PDF, and submit both to pdfRest before delivery. That gives the service a documented API step for producing the hybrid invoice rather than relying on a manual desktop process.\u003C\u002Fp>\n\n\u003Cp>The supplied PDF is retained when it agrees with the canonical XML. With \u003Ccode>regenerate_pdf=true\u003C\u002Fcode>, the service can create a replacement PDF when it cannot confirm that agreement or finds a mismatch, which gives the workflow a defined fallback instead of silently accepting an uncertain visual invoice.\u003C\u002Fp>\n\n\u003Ch2>What the Request Does\u003C\u002Fh2>\n\n\u003Cp>The multipart request sends the invoice XML as \u003Ccode>file\u003C\u002Fcode> and the visual invoice PDF as \u003Ccode>pdf_file\u003C\u002Fcode>. \u003Ccode>regenerate_pdf\u003C\u002Fcode> controls the fallback behavior. Optional \u003Ccode>render_options\u003C\u002Fcode> set locale, label language, fonts, and accent color only for a replacement PDF; they do not alter a supplied PDF that is preserved.\u003C\u002Fp>\n\n\u003Cp>The Java samples use OkHttp for HTTP and the repository’s established project dependencies. Applications adopting the class should provide equivalent dependencies and obtain credentials from secure runtime configuration.\u003C\u002Fp>\n\n\u003Ch2>How to Create a ZUGFeRD PDF with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONObject;\n\npublic class ZugferdPdf {\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, use the EU-based service\n  \u002F\u002F instead.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n  private static final OkHttpClient CLIENT =\n      new OkHttpClient.Builder().readTimeout(60, TimeUnit.SECONDS).build();\n\n  public static void main(String[] args) throws IOException {\n    \u002F\u002F Specify XML and PDF paths here, or as the first and second program arguments.\n    File invoiceXml = new File(args.length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Finvoice.xml\");\n    File invoicePdf = new File(args.length > 1 ? args[1] : \"\u002Fpath\u002Fto\u002Finvoice.pdf\");\n    String apiKey =\n        Dotenv.configure()\n            .ignoreIfMalformed()\n            .ignoreIfMissing()\n            .load()\n            .get(\"PDFREST_API_KEY\", DEFAULT_API_KEY);\n    JSONObject options =\n        new JSONObject()\n            .put(\"locale\", \"de-DE\")\n            .put(\"label_language\", \"de\")\n            .put(\"font\", \"arial\")\n            .put(\"bold_font\", \"arialbold\")\n            .put(\"accent_color_rgb\", new int[] {0, 92, 171});\n    \u002F\u002F Create a ZUGFeRD \u002F Factur-X PDF\u002FA-3 invoice from XML and an existing invoice PDF.\n    \u002F\u002F pdfRest preserves the supplied PDF when it agrees with the canonical XML.\n    \u002F\u002F Fallback generation handles a mismatch or an unconfirmed PDF\u002FXML match.\n    \u002F\u002F The render options style only that replacement PDF, not a preserved supplied PDF.\n    MultipartBody body =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\n                \"file\",\n                invoiceXml.getName(),\n                RequestBody.create(invoiceXml, MediaType.parse(\"application\u002Fxml\")))\n            .addFormDataPart(\n                \"pdf_file\",\n                invoicePdf.getName(),\n                RequestBody.create(invoicePdf, MediaType.parse(\"application\u002Fpdf\")))\n            .addFormDataPart(\"regenerate_pdf\", \"true\")\n            .addFormDataPart(\"render_options\", options.toString())\n            .addFormDataPart(\"output\", \"zugferd_invoice\")\n            .build();\n    send(\n        new Request.Builder()\n            .url(API_URL + \"\u002Fzugferd-pdf\")\n            .header(\"Api-Key\", apiKey)\n            .post(body)\n            .build());\n  }\n\n  private static void send(Request request) throws IOException {\n    try (Response response = CLIENT.newCall(request).execute()) {\n      String body = response.body() == null ? \"\" : response.body().string();\n      System.out.println(\"Result code \" + response.code());\n      System.out.println(body);\n      if (!response.isSuccessful()) {\n        System.exit(1);\n      }\n    }\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics-erics\u002Fpdf-rest-api-samples\u002Fblob\u002Fcodex\u002Fzugferd-api-samples\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FZugferdPdf.java\">View the multipart sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The request is compact, but each field has a distinct role in the hybrid-invoice workflow.\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Cstrong>Identify the two document roles.\u003C\u002Fstrong> The \u003Ccode>file\u003C\u002Fcode> field holds canonical invoice XML, while \u003Ccode>pdf_file\u003C\u002Fcode> holds the customer-facing invoice PDF. The sample marks them as \u003Ccode>application\u002Fxml\u003C\u002Fcode> and \u003Ccode>application\u002Fpdf\u003C\u002Fcode>, respectively, so the service can distinguish the structured record from its visual companion.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Build the multipart request.\u003C\u002Fstrong> \u003Ccode>MultipartBody.Builder\u003C\u002Fcode> creates the form and its boundary. \u003Ccode>RequestBody.create\u003C\u002Fcode> assigns the XML and PDF media types before the request is sent with OkHttp.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Configure the request safely.\u003C\u002Fstrong> The sample loads \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode> through dotenv, with a placeholder only as a fallback. Replace the placeholder and keep real credentials outside source control.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Understand the fallback settings.\u003C\u002Fstrong> \u003Ccode>regenerate_pdf=true\u003C\u002Fcode> permits a replacement PDF when pdfRest cannot confirm that the supplied PDF agrees with the XML. The \u003Ccode>render_options\u003C\u002Fcode> object controls locale, labels, fonts, and accent color for that replacement only; it does not restyle a supplied PDF that pdfRest preserves.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Name and handle the result.\u003C\u002Fstrong> \u003Ccode>output=zugferd_invoice\u003C\u002Fcode> gives the generated resource a useful output name. The \u003Ccode>send\u003C\u002Fcode> method reads and prints the JSON body, then exits nonzero when \u003Ccode>response.isSuccessful()\u003C\u002Fcode> is false. A production caller can parse a successful body after that check.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this Java tutorial, you created a ZUGFeRD or Factur-X hybrid invoice from invoice XML and a visual PDF. The response gives the application a managed output resource it can download, deliver, or pass to a following pdfRest operation.\u003C\u002Fp>\n\n\u003Cp>For the complete request fields, accepted values, response contract, and service limits, review the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcreate-zugferd-pdf\u002F\">Create ZUGFeRD PDF API Tool documentation\u003C\u002Fa>. The same endpoint can be used with multipart uploads when the files are present in the current request or with resource IDs after a separate upload step.\u003C\u002Fp>\n\n\u003Cp>The repository also includes a \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics-erics\u002Fpdf-rest-api-samples\u002Fblob\u002Fcodex\u002Fzugferd-api-samples\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FZugferdPdf.java\">JSON-payload Create ZUGFeRD PDF sample for Java\u003C\u002Fa>. That version uploads the source files first and then sends their resource IDs to \u003Ccode>\u002Fzugferd-pdf\u003C\u002Fcode>, which is useful when a service already stages input files for later operations.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Create a ZUGFeRD or Factur-X hybrid PDF\u002FA-3 invoice with pdfRest using Java.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-zugferd-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Create a ZUGFeRD PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-zugferd-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-zugferd-pdf-with-java\u002F\",\n      \"datePublished\": \"2026-09-18T15:15:59.000Z\",\n      \"dateModified\": \"2026-09-18T20:09:40.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Create a ZUGFeRD or Factur-X hybrid PDF\u002FA-3 invoice with pdfRest using Java.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Create ZUGFeRD PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-zugferd-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fzugferd-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcreate-zugferd-pdf\u002F\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, ZUGFeRD, Factur-X, Java\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Create a ZUGFeRD PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-zugferd-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7704,7705,7706,7707,7708,7709,7710,7711],{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1434,"name":1435,"slug":1436,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1438,"name":1439,"slug":1440,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1442,"name":1443,"slug":1444,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-create-a-zugferd-pdf-with-java\u002F","How to Create a ZUGFeRD PDF with Java | pdfRest",{"id":7715,"uuid":7716,"title":7717,"slug":7718,"html":7719,"comment_id":7715,"feature_image":48,"featured":284,"visibility":1257,"created_at":7659,"updated_at":7660,"published_at":7660,"custom_excerpt":7720,"codeinjection_head":7721,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7722,"primary_tag":48,"url":7731,"excerpt":7720,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7732,"meta_description":7720,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6aad55afd1b70dd2e2978f23","871910aa-3c39-4471-825f-c1678c7adf9e","How to Create a ZUGFeRD PDF with JavaScript in NodeJS","how-to-create-a-zugferd-pdf-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This tutorial shows how to create a ZUGFeRD or Factur-X hybrid PDF\u002FA-3 invoice with JavaScript in NodeJS. It uses the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-zugferd-pdf\u002F\">pdfRest Create ZUGFeRD PDF API Tool\u003C\u002Fa> to send canonical invoice XML and a visual invoice PDF, then returns a managed invoice resource for the next step in the workflow.\u003C\u002Fp>\n\n\u003Ch2>Why Create a ZUGFeRD PDF with JavaScript in NodeJS?\u003C\u002Fh2>\n\n\u003Cp>Electronic invoicing programs increasingly require an invoice that people can read and systems can process. ZUGFeRD and Factur-X pair a visual PDF with structured invoice XML so finance teams, customers, and downstream systems can work from the same invoice record.\u003C\u002Fp>\n\n\u003Cp>A JavaScript in NodeJS billing service could generate the invoice XML from its accounting data, pair it with a customer-facing PDF, and submit both to pdfRest before delivery. That gives the service a documented API step for producing the hybrid invoice rather than relying on a manual desktop process.\u003C\u002Fp>\n\n\u003Cp>The supplied PDF is retained when it agrees with the canonical XML. With \u003Ccode>regenerate_pdf=true\u003C\u002Fcode>, the service can create a replacement PDF when it cannot confirm that agreement or finds a mismatch, which gives the workflow a defined fallback instead of silently accepting an uncertain visual invoice.\u003C\u002Fp>\n\n\u003Ch2>What the Request Does\u003C\u002Fh2>\n\n\u003Cp>The multipart request sends the invoice XML as \u003Ccode>file\u003C\u002Fcode> and the visual invoice PDF as \u003Ccode>pdf_file\u003C\u002Fcode>. \u003Ccode>regenerate_pdf\u003C\u002Fcode> controls the fallback behavior. Optional \u003Ccode>render_options\u003C\u002Fcode> set locale, label language, fonts, and accent color only for a replacement PDF; they do not alter a supplied PDF that is preserved.\u003C\u002Fp>\n\n\u003Cp>The NodeJS samples use Axios for HTTP, FormData for multipart construction, and streams from the file system for local inputs. Keep the API key in protected runtime configuration rather than in application source.\u003C\u002Fp>\n\n\u003Ch2>How to Create a ZUGFeRD PDF with JavaScript in NodeJS Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F Create a ZUGFeRD \u002F Factur-X PDF\u002FA-3 invoice from XML and an existing invoice PDF.\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n\u002F\u002F Set these paths to your CII XML invoice and the corresponding visual PDF.\nvar invoiceXml = \"\u002Fpath\u002Fto\u002Finvoice.xml\";\nvar invoicePdf = \"\u002Fpath\u002Fto\u002Finvoice.pdf\";\n\nvar data = new FormData();\ndata.append('file', fs.createReadStream(invoiceXml));\ndata.append('pdf_file', fs.createReadStream(invoicePdf));\n\u002F\u002F pdfRest preserves the supplied PDF when it agrees with the canonical XML.\n\u002F\u002F Fallback: generate a replacement PDF when the supplied PDF is mismatched or cannot be fully confirmed.\ndata.append('regenerate_pdf', 'true');\n\u002F\u002F These styles apply only to that fallback-generated PDF; they do not alter a preserved PDF.\ndata.append('render_options', JSON.stringify({\n  locale: \"de-DE\", label_language: \"de\", font: \"arial\", bold_font: \"arialbold\",\n  accent_color_rgb: [0, 92, 171],\n}));\ndata.append('output', 'zugferd_invoice');\n\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: apiUrl + '\u002Fzugferd-pdf',\n  headers: {\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders()\n  },\n  data: data\n};\n\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error);\n});\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics-erics\u002Fpdf-rest-api-samples\u002Fblob\u002Fcodex\u002Fzugferd-api-samples\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fzugferd-pdf.js\">View the multipart sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The request is compact, but each field has a distinct role in the hybrid-invoice workflow.\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Cstrong>Identify the two document roles.\u003C\u002Fstrong> The \u003Ccode>file\u003C\u002Fcode> field holds canonical invoice XML, while \u003Ccode>pdf_file\u003C\u002Fcode> holds the customer-facing invoice PDF. The sample marks them as \u003Ccode>application\u002Fxml\u003C\u002Fcode> and \u003Ccode>application\u002Fpdf\u003C\u002Fcode>, respectively, so the service can distinguish the structured record from its visual companion.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Build the multipart request.\u003C\u002Fstrong> \u003Ccode>FormData\u003C\u002Fcode> receives NodeJS file streams and text fields. Passing \u003Ccode>form.getHeaders()\u003C\u002Fcode> to Axios is important because it carries the generated multipart boundary.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Configure the request safely.\u003C\u002Fstrong> The sample reads local paths and the API key from its configuration values. Keep the key in protected runtime configuration rather than committing it with the application.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Understand the fallback settings.\u003C\u002Fstrong> \u003Ccode>regenerate_pdf=true\u003C\u002Fcode> permits a replacement PDF when pdfRest cannot confirm that the supplied PDF agrees with the XML. The \u003Ccode>render_options\u003C\u002Fcode> object controls locale, labels, fonts, and accent color for that replacement only; it does not restyle a supplied PDF that pdfRest preserves.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Name and handle the result.\u003C\u002Fstrong> \u003Ccode>output=zugferd_invoice\u003C\u002Fcode> gives the generated resource a useful output name. Axios exposes successful JSON through \u003Ccode>response.data\u003C\u002Fcode>. Its error path prints the returned API detail when available, which separates a service response from a network or setup failure.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this JavaScript in NodeJS tutorial, you created a ZUGFeRD or Factur-X hybrid invoice from invoice XML and a visual PDF. The response gives the application a managed output resource it can download, deliver, or pass to a following pdfRest operation.\u003C\u002Fp>\n\n\u003Cp>For the complete request fields, accepted values, response contract, and service limits, review the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcreate-zugferd-pdf\u002F\">Create ZUGFeRD PDF API Tool documentation\u003C\u002Fa>. The same endpoint can be used with multipart uploads when the files are present in the current request or with resource IDs after a separate upload step.\u003C\u002Fp>\n\n\u003Cp>The repository also includes a \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics-erics\u002Fpdf-rest-api-samples\u002Fblob\u002Fcodex\u002Fzugferd-api-samples\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fzugferd-pdf.js\">JSON-payload Create ZUGFeRD PDF sample for JavaScript in NodeJS\u003C\u002Fa>. That version uploads the source files first and then sends their resource IDs to \u003Ccode>\u002Fzugferd-pdf\u003C\u002Fcode>, which is useful when a service already stages input files for later operations.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Create a ZUGFeRD or Factur-X hybrid PDF\u002FA-3 invoice with pdfRest using JavaScript in NodeJS.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-zugferd-pdf-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Create a ZUGFeRD PDF with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-zugferd-pdf-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-zugferd-pdf-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2026-09-18T15:15:59.000Z\",\n      \"dateModified\": \"2026-09-18T20:09:40.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Create a ZUGFeRD or Factur-X hybrid PDF\u002FA-3 invoice with pdfRest using JavaScript in NodeJS.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Create ZUGFeRD PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-zugferd-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fzugferd-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcreate-zugferd-pdf\u002F\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, ZUGFeRD, Factur-X, JavaScript, NodeJS\",\n      \"dependencies\": \"JavaScript, NodeJS, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Create a ZUGFeRD PDF with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-zugferd-pdf-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7723,7724,7725,7726,7727,7728,7729,7730],{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1434,"name":1435,"slug":1436,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1438,"name":1439,"slug":1440,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1442,"name":1443,"slug":1444,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-create-a-zugferd-pdf-with-javascript-in-nodejs\u002F","How to Create a ZUGFeRD PDF with JavaScript in NodeJS | pdfRest",{"id":7734,"uuid":7735,"title":7736,"slug":7737,"html":7738,"comment_id":7734,"feature_image":48,"featured":284,"visibility":1257,"created_at":7739,"updated_at":7740,"published_at":7740,"custom_excerpt":7741,"codeinjection_head":7742,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7743,"primary_tag":48,"url":7752,"excerpt":7741,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7753,"meta_description":7741,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6aad55b0d1b70dd2e2978f37","2ba63084-097a-4de4-a6ad-d170531644dc","How to Create a ZUGFeRD PDF with PHP","how-to-create-a-zugferd-pdf-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This tutorial shows how to create a ZUGFeRD or Factur-X hybrid PDF\u002FA-3 invoice with PHP. It uses the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-zugferd-pdf\u002F\">pdfRest Create ZUGFeRD PDF API Tool\u003C\u002Fa> to send canonical invoice XML and a visual invoice PDF, then returns a managed invoice resource for the next step in the workflow.\u003C\u002Fp>\n\n\u003Ch2>Why Create a ZUGFeRD PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>Electronic invoicing programs increasingly require an invoice that people can read and systems can process. ZUGFeRD and Factur-X pair a visual PDF with structured invoice XML so finance teams, customers, and downstream systems can work from the same invoice record.\u003C\u002Fp>\n\n\u003Cp>A PHP billing service could generate the invoice XML from its accounting data, pair it with a customer-facing PDF, and submit both to pdfRest before delivery. That gives the service a documented API step for producing the hybrid invoice rather than relying on a manual desktop process.\u003C\u002Fp>\n\n\u003Cp>The supplied PDF is retained when it agrees with the canonical XML. With \u003Ccode>regenerate_pdf=true\u003C\u002Fcode>, the service can create a replacement PDF when it cannot confirm that agreement or finds a mismatch, which gives the workflow a defined fallback instead of silently accepting an uncertain visual invoice.\u003C\u002Fp>\n\n\u003Ch2>What the Request Does\u003C\u002Fh2>\n\n\u003Cp>The multipart request sends the invoice XML as \u003Ccode>file\u003C\u002Fcode> and the visual invoice PDF as \u003Ccode>pdf_file\u003C\u002Fcode>. \u003Ccode>regenerate_pdf\u003C\u002Fcode> controls the fallback behavior. Optional \u003Ccode>render_options\u003C\u002Fcode> set locale, label language, fonts, and accent color only for a replacement PDF; they do not alter a supplied PDF that is preserved.\u003C\u002Fp>\n\n\u003Cp>The PHP samples use Guzzle and PSR-7 stream utilities. Install Guzzle with Composer when moving the code outside the repository and supply the API key through protected configuration.\u003C\u002Fp>\n\n\u003Ch2>How to Create a ZUGFeRD PDF with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n\u002F\u002F Create a ZUGFeRD \u002F Factur-X PDF\u002FA-3 invoice from XML and an existing invoice PDF.\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = 'https:\u002F\u002Fapi.pdfrest.com';\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = 'https:\u002F\u002Feu-api.pdfrest.com';\n\n\u002F\u002F Set these paths to your CII XML invoice and the corresponding visual PDF.\n$apiKey = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';\n$invoiceXml = '\u002Fpath\u002Fto\u002Finvoice.xml';\n$invoicePdf = '\u002Fpath\u002Fto\u002Finvoice.pdf';\n\n$client = new Client();\n$headers = ['Accept' => 'application\u002Fjson', 'Api-Key' => $apiKey];\n\n\u002F\u002F pdfRest preserves the supplied PDF when it agrees with the canonical XML.\n\u002F\u002F Fallback: generate a replacement PDF for a mismatch or unconfirmed PDF\u002FXML match.\n\u002F\u002F These styles apply only to that fallback-generated PDF, not to a preserved PDF.\n$options = [\n    'multipart' => [\n        ['name' => 'file', 'contents' => Utils::tryFopen($invoiceXml, 'r'), 'filename' => basename($invoiceXml), 'headers' => ['Content-Type' => 'application\u002Fxml']],\n        ['name' => 'pdf_file', 'contents' => Utils::tryFopen($invoicePdf, 'r'), 'filename' => basename($invoicePdf), 'headers' => ['Content-Type' => 'application\u002Fpdf']],\n        ['name' => 'regenerate_pdf', 'contents' => 'true'],\n        ['name' => 'render_options', 'contents' => json_encode(['locale' => 'de-DE', 'label_language' => 'de', 'font' => 'arial', 'bold_font' => 'arialbold', 'accent_color_rgb' => [0, 92, 171]])],\n        ['name' => 'output', 'contents' => 'zugferd_invoice'],\n    ]\n];\n\n$request = new Request('POST', $apiUrl . '\u002Fzugferd-pdf', $headers);\n$response = $client->sendAsync($request, $options)->wait();\n\necho $response->getBody();\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics-erics\u002Fpdf-rest-api-samples\u002Fblob\u002Fcodex\u002Fzugferd-api-samples\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fzugferd-pdf.php\">View the multipart sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The request is compact, but each field has a distinct role in the hybrid-invoice workflow.\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Cstrong>Identify the two document roles.\u003C\u002Fstrong> The \u003Ccode>file\u003C\u002Fcode> field holds canonical invoice XML, while \u003Ccode>pdf_file\u003C\u002Fcode> holds the customer-facing invoice PDF. The sample marks them as \u003Ccode>application\u002Fxml\u003C\u002Fcode> and \u003Ccode>application\u002Fpdf\u003C\u002Fcode>, respectively, so the service can distinguish the structured record from its visual companion.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Build the multipart request.\u003C\u002Fstrong> Guzzle receives the multipart body as an array. File entries provide an opened stream, filename, and content type; text entries carry the ordinary API options.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Configure the request safely.\u003C\u002Fstrong> Configure the endpoint, key, and input paths before running the sample. Use Composer-managed Guzzle dependencies and keep the credential in protected application configuration.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Understand the fallback settings.\u003C\u002Fstrong> \u003Ccode>regenerate_pdf=true\u003C\u002Fcode> permits a replacement PDF when pdfRest cannot confirm that the supplied PDF agrees with the XML. The \u003Ccode>render_options\u003C\u002Fcode> object controls locale, labels, fonts, and accent color for that replacement only; it does not restyle a supplied PDF that pdfRest preserves.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Name and handle the result.\u003C\u002Fstrong> \u003Ccode>output=zugferd_invoice\u003C\u002Fcode> gives the generated resource a useful output name. The response body is printed as JSON. Check the HTTP status before accepting the result so an error document is not confused with a successful output or validation response.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this PHP tutorial, you created a ZUGFeRD or Factur-X hybrid invoice from invoice XML and a visual PDF. The response gives the application a managed output resource it can download, deliver, or pass to a following pdfRest operation.\u003C\u002Fp>\n\n\u003Cp>For the complete request fields, accepted values, response contract, and service limits, review the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcreate-zugferd-pdf\u002F\">Create ZUGFeRD PDF API Tool documentation\u003C\u002Fa>. The same endpoint can be used with multipart uploads when the files are present in the current request or with resource IDs after a separate upload step.\u003C\u002Fp>\n\n\u003Cp>The repository also includes a \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics-erics\u002Fpdf-rest-api-samples\u002Fblob\u002Fcodex\u002Fzugferd-api-samples\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fzugferd-pdf.php\">JSON-payload Create ZUGFeRD PDF sample for PHP\u003C\u002Fa>. That version uploads the source files first and then sends their resource IDs to \u003Ccode>\u002Fzugferd-pdf\u003C\u002Fcode>, which is useful when a service already stages input files for later operations.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-18T15:16:00.000+00:00","2026-09-18T20:27:39.000+00:00","Create a ZUGFeRD or Factur-X hybrid PDF\u002FA-3 invoice with pdfRest using PHP.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-zugferd-pdf-with-php\u002F#article\",\n      \"headline\": \"How to Create a ZUGFeRD PDF with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-zugferd-pdf-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-zugferd-pdf-with-php\u002F\",\n      \"datePublished\": \"2026-09-18T15:16:00.000Z\",\n      \"dateModified\": \"2026-09-18T20:09:41.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Create a ZUGFeRD or Factur-X hybrid PDF\u002FA-3 invoice with pdfRest using PHP.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Create ZUGFeRD PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-zugferd-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fzugferd-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcreate-zugferd-pdf\u002F\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, ZUGFeRD, Factur-X, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Create a ZUGFeRD PDF with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-zugferd-pdf-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7744,7745,7746,7747,7748,7749,7750,7751],{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1434,"name":1435,"slug":1436,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1438,"name":1439,"slug":1440,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1442,"name":1443,"slug":1444,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-create-a-zugferd-pdf-with-php\u002F","How to Create a ZUGFeRD PDF with PHP | pdfRest",{"id":7755,"uuid":7756,"title":7757,"slug":7758,"html":7759,"comment_id":7755,"feature_image":48,"featured":284,"visibility":1257,"created_at":7739,"updated_at":7740,"published_at":7740,"custom_excerpt":7760,"codeinjection_head":7761,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7762,"primary_tag":48,"url":7771,"excerpt":7760,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7772,"meta_description":7760,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6aad55b0d1b70dd2e2978f41","52b5d930-0687-49eb-b3a4-1656773f681f","How to Create a ZUGFeRD PDF with Python","how-to-create-a-zugferd-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This tutorial shows how to create a ZUGFeRD or Factur-X hybrid PDF\u002FA-3 invoice with Python. It uses the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-zugferd-pdf\u002F\">pdfRest Create ZUGFeRD PDF API Tool\u003C\u002Fa> to send canonical invoice XML and a visual invoice PDF, then returns a managed invoice resource for the next step in the workflow.\u003C\u002Fp>\n\n\u003Ch2>Why Create a ZUGFeRD PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>Electronic invoicing programs increasingly require an invoice that people can read and systems can process. ZUGFeRD and Factur-X pair a visual PDF with structured invoice XML so finance teams, customers, and downstream systems can work from the same invoice record.\u003C\u002Fp>\n\n\u003Cp>A Python billing service could generate the invoice XML from its accounting data, pair it with a customer-facing PDF, and submit both to pdfRest before delivery. That gives the service a documented API step for producing the hybrid invoice rather than relying on a manual desktop process.\u003C\u002Fp>\n\n\u003Cp>The supplied PDF is retained when it agrees with the canonical XML. With \u003Ccode>regenerate_pdf=true\u003C\u002Fcode>, the service can create a replacement PDF when it cannot confirm that agreement or finds a mismatch, which gives the workflow a defined fallback instead of silently accepting an uncertain visual invoice.\u003C\u002Fp>\n\n\u003Ch2>What the Request Does\u003C\u002Fh2>\n\n\u003Cp>The multipart request sends the invoice XML as \u003Ccode>file\u003C\u002Fcode> and the visual invoice PDF as \u003Ccode>pdf_file\u003C\u002Fcode>. \u003Ccode>regenerate_pdf\u003C\u002Fcode> controls the fallback behavior. Optional \u003Ccode>render_options\u003C\u002Fcode> set locale, label language, fonts, and accent color only for a replacement PDF; they do not alter a supplied PDF that is preserved.\u003C\u002Fp>\n\n\u003Cp>The Python samples use \u003Ccode>requests\u003C\u002Fcode> and \u003Ccode>requests-toolbelt\u003C\u002Fcode>. Install those packages in the application environment and keep the API key in an environment variable or other secure configuration store.\u003C\u002Fp>\n\n\u003Ch2>How to Create a ZUGFeRD PDF with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">import json\nimport os\nimport requests\nfrom requests_toolbelt import MultipartEncoder\n\n# Create a ZUGFeRD \u002F Factur-X PDF\u002FA-3 invoice from XML and an existing invoice PDF.\n# By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# Set these paths to your CII XML invoice and the corresponding visual PDF.\napi_key = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\ninvoice_xml = \"\u002Fpath\u002Fto\u002Finvoice.xml\"\ninvoice_pdf = \"\u002Fpath\u002Fto\u002Finvoice.pdf\"\n\n# pdfRest preserves the supplied PDF when it agrees with the canonical XML.\n# Fallback: generate a replacement PDF for a mismatch or unconfirmed PDF\u002FXML match.\n# These styles apply only to that fallback-generated PDF, not to a preserved PDF.\nmp_encoder_zugferd = MultipartEncoder(\n    fields={\n        'file': ('invoice.xml', open(invoice_xml, 'rb'), 'application\u002Fxml'),\n        'pdf_file': ('invoice.pdf', open(invoice_pdf, 'rb'), 'application\u002Fpdf'),\n        'regenerate_pdf': 'true',\n        'render_options': json.dumps({'locale': 'de-DE', 'label_language': 'de', 'font': 'arial', 'bold_font': 'arialbold', 'accent_color_rgb': [0, 92, 171]}),\n        'output': 'zugferd_invoice',\n    }\n)\n\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_zugferd.content_type,\n    'Api-Key': api_key\n}\n\nprint(\"Sending POST request to zugferd-pdf endpoint...\")\nresponse = requests.post(api_url + '\u002Fzugferd-pdf', data=mp_encoder_zugferd, headers=headers)\nprint(\"Response status code: \" + str(response.status_code))\nif response.ok:\n    print(json.dumps(response.json(), indent=2))\nelse:\n    print(response.text)\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics-erics\u002Fpdf-rest-api-samples\u002Fblob\u002Fcodex\u002Fzugferd-api-samples\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fzugferd-pdf.py\">View the multipart sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The request is compact, but each field has a distinct role in the hybrid-invoice workflow.\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Cstrong>Identify the two document roles.\u003C\u002Fstrong> The \u003Ccode>file\u003C\u002Fcode> field holds canonical invoice XML, while \u003Ccode>pdf_file\u003C\u002Fcode> holds the customer-facing invoice PDF. The sample marks them as \u003Ccode>application\u002Fxml\u003C\u002Fcode> and \u003Ccode>application\u002Fpdf\u003C\u002Fcode>, respectively, so the service can distinguish the structured record from its visual companion.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Build the multipart request.\u003C\u002Fstrong> \u003Ccode>MultipartEncoder\u003C\u002Fcode> combines file tuples with text fields. Its \u003Ccode>content_type\u003C\u002Fcode> includes the multipart boundary, so the request headers reuse that value.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Configure the request safely.\u003C\u002Fstrong> Set the service URL, API key, and source paths before running the script. The sample uses \u003Ccode>requests\u003C\u002Fcode> and \u003Ccode>requests-toolbelt\u003C\u002Fcode> for the HTTP and multipart work.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Understand the fallback settings.\u003C\u002Fstrong> \u003Ccode>regenerate_pdf=true\u003C\u002Fcode> permits a replacement PDF when pdfRest cannot confirm that the supplied PDF agrees with the XML. The \u003Ccode>render_options\u003C\u002Fcode> object controls locale, labels, fonts, and accent color for that replacement only; it does not restyle a supplied PDF that pdfRest preserves.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Name and handle the result.\u003C\u002Fstrong> \u003Ccode>output=zugferd_invoice\u003C\u002Fcode> gives the generated resource a useful output name. The \u003Ccode>response.ok\u003C\u002Fcode> branch prints formatted JSON; the other branch prints the error response. Treat output identifiers or validation values as application data only from the successful branch.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this Python tutorial, you created a ZUGFeRD or Factur-X hybrid invoice from invoice XML and a visual PDF. The response gives the application a managed output resource it can download, deliver, or pass to a following pdfRest operation.\u003C\u002Fp>\n\n\u003Cp>For the complete request fields, accepted values, response contract, and service limits, review the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcreate-zugferd-pdf\u002F\">Create ZUGFeRD PDF API Tool documentation\u003C\u002Fa>. The same endpoint can be used with multipart uploads when the files are present in the current request or with resource IDs after a separate upload step.\u003C\u002Fp>\n\n\u003Cp>The repository also includes a \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics-erics\u002Fpdf-rest-api-samples\u002Fblob\u002Fcodex\u002Fzugferd-api-samples\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fzugferd-pdf.py\">JSON-payload Create ZUGFeRD PDF sample for Python\u003C\u002Fa>. That version uploads the source files first and then sends their resource IDs to \u003Ccode>\u002Fzugferd-pdf\u003C\u002Fcode>, which is useful when a service already stages input files for later operations.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Create a ZUGFeRD or Factur-X hybrid PDF\u002FA-3 invoice with pdfRest using Python.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-zugferd-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Create a ZUGFeRD PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-zugferd-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-zugferd-pdf-with-python\u002F\",\n      \"datePublished\": \"2026-09-18T15:16:00.000Z\",\n      \"dateModified\": \"2026-09-18T20:09:41.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Create a ZUGFeRD or Factur-X hybrid PDF\u002FA-3 invoice with pdfRest using Python.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Create ZUGFeRD PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-zugferd-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fzugferd-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fcreate-zugferd-pdf\u002F\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, ZUGFeRD, Factur-X, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Create a ZUGFeRD PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-create-a-zugferd-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7763,7764,7765,7766,7767,7768,7769,7770],{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1434,"name":1435,"slug":1436,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1438,"name":1439,"slug":1440,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1442,"name":1443,"slug":1444,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-create-a-zugferd-pdf-with-python\u002F","How to Create a ZUGFeRD PDF with Python | pdfRest",{"id":7774,"uuid":7775,"title":7776,"slug":7777,"html":7778,"comment_id":7774,"feature_image":48,"featured":284,"visibility":1257,"created_at":7779,"updated_at":7780,"published_at":7779,"custom_excerpt":7781,"codeinjection_head":7782,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7783,"primary_tag":7789,"url":7790,"excerpt":7781,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7791,"meta_description":7781,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6837528c533c9f26b9439954","bb451e30-6f4a-4ec2-8353-abc07c68d474","How to Crop PDF in .NET with C#","how-to-crop-pdf-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Crop PDF Files with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fset-page-boxes\u002F\">Set Page Boxes API Tool\u003C\u002Fa> allows you to modify the page boxes of a PDF file, including the CropBox, which defines the visible content area. This tutorial will guide you through the process of sending an API call to set the CropBox using C# to \u003Cstrong>crop PDF files\u003C\u002Fstrong>.\u003C\u002Fp>\n\n\u003Cp>Imagine you need to process a batch of PDF documents and remove the outer margins to focus on the main content. By using the Set Page Boxes API to programmatically adjust the CropBox, you can automate this \u003Cstrong>PDF cropping\u003C\u002Fstrong> task efficiently and consistently across all your files.\u003C\u002Fp>\n\n\u003Ch2>Crop PDF with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using Newtonsoft.Json;\nusing Newtonsoft.Json.Linq;\nusing System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf-with-page-boxes-set\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"YOUR_API_KEY\"); \u002F\u002F Replace with your actual API key\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf\"); \u002F\u002F Replace with the actual path to your PDF file\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"filename.pdf\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        \u002F\u002F Define the CropBox settings to crop the first page\n        var cropBoxOptions = new JObject\n        {\n            [\"boxes\"] = new JArray\n            {\n                new JObject\n                {\n                    [\"box\"] = \"crop\",\n                    [\"pages\"] = new JArray\n                    {\n                        new JObject\n                        {\n                            [\"range\"] = \"1\",\n                            [\"left\"] = 50,  \u002F\u002F Adjust these values to your desired crop\n                            [\"top\"] = 50,\n                            [\"bottom\"] = 50,\n                            [\"right\"] = 50\n                        }\n                    }\n                }\n            }\n        };\n\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(cropBoxOptions.ToString(Formatting.None)));\n        multipartContent.Add(byteArrayOption, \"boxes\");\n\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-page-boxes-set.cs\">GitHub\u003C\u002Fa> (Note: This example has been modified to focus on cropping)\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code for Cropping\u003C\u002Fh2>\n\n\u003Cp>The code initializes an \u003Ccode>HttpClient\u003C\u002Fcode> to interact with the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>It then creates an \u003Ccode>HttpRequestMessage\u003C\u002Fcode> for a POST request to the \u003Ccode>pdf-with-page-boxes-set\u003C\u002Fcode> endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf-with-page-boxes-set\"))\n\u003C\u002Fpre>\n\n\u003Cp>Your API key is added to the request headers for authentication. \u003Cstrong>Replace \u003Ccode>\"YOUR_API_KEY\"\u003C\u002Fcode> with your actual pdfRest API key.\u003C\u002Fstrong>\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"YOUR_API_KEY\");\n\u003C\u002Fpre>\n\n\u003Cp>A \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> is created to handle sending both the PDF file and the cropping instructions.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n\u003C\u002Fpre>\n\n\u003Cp>The PDF file is read as bytes and added to the multipart content. \u003Cstrong>Ensure you replace \u003Ccode>\"\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf\"\u003C\u002Fcode> with the correct path to your PDF file.\u003C\u002Fstrong>\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"filename.pdf\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>cropBoxOptions\u003C\u002Fcode> JSON object is constructed to specifically \u003Cstrong>crop the PDF\u003C\u002Fstrong>. The \u003Ccode>\"box\"\u003C\u002Fcode> is set to \u003Ccode>\"crop\"\u003C\u002Fcode>, and the \u003Ccode>\"pages\"\u003C\u002Fcode> array targets the first page (\u003Ccode>\"range\": \"1\"\u003C\u002Fcode>). The \u003Ccode>\"left\"\u003C\u002Fcode>, \u003Ccode>\"top\"\u003C\u002Fcode>, \u003Ccode>\"bottom\"\u003C\u002Fcode>, and \u003Ccode>\"right\"\u003C\u002Fcode> values define the new visible boundaries of the page in points. \u003Cstrong>Adjust these values to achieve your desired cropping.\u003C\u002Fstrong>\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var cropBoxOptions = new JObject\n{\n    [\"boxes\"] = new JArray\n    {\n        new JObject\n        {\n            [\"box\"] = \"crop\",\n            [\"pages\"] = new JArray\n            {\n                new JObject\n                {\n                    [\"range\"] = \"1\",\n                    [\"left\"] = 50,  \u002F\u002F Adjust these values to your desired crop\n                    [\"top\"] = 50,\n                    [\"bottom\"] = 50,\n                    [\"right\"] = 50\n                }\n            }\n        }\n    }\n};\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>cropBoxOptions\u003C\u002Fcode> are added to the multipart content as a byte array.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(cropBoxOptions.ToString(Formatting.None)));\nmultipartContent.Add(byteArrayOption, \"boxes\");\n\u003C\u002Fpre>\n\n\u003Cp>The API request is sent, and the response is read and printed to the console.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Content = multipartContent;\nvar response = await httpClient.SendAsync(request);\nvar apiResult = await response.Content.ReadAsStringAsync();\nConsole.WriteLine(\"API response received.\");\nConsole.WriteLine(apiResult);\n\u003C\u002Fpre>\n\n\u003Ch2>Further Exploration for PDF Cropping\u003C\u002Fh2>\n\n\u003Cp>This tutorial showed you how to use C# and the pdfRest Set Page Boxes API to \u003Cstrong>crop PDF files\u003C\u002Fstrong> by manipulating the CropBox. You can modify the \u003Ccode>cropBoxOptions\u003C\u002Fcode> to apply different cropping settings to various pages or page ranges within your PDF documents. Experiment with different margin values to achieve the precise visual outcome you need.\u003C\u002Fp>\n\n\u003Cp>To discover more about the capabilities of the Set Page Boxes API and other pdfRest tools, explore the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and consult the comprehensive \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example uses a multipart API call. JSON payload examples for setting page boxes, including the CropBox, can be found \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-page-boxes-set.cs\">here\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-05-28T18:14:36.000+00:00","2026-09-02T18:28:23.000+00:00","Learn how to use pdfRest's Set Page Boxes API to crop PDF files by setting the CropBox with C#.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Crop PDF in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-in-net-with-c\u002F\",\n      \"datePublished\": \"2025-05-28T18:14:36.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:15.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest's Set Page Boxes API to crop PDF files by setting the CropBox with C#.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Set Page Boxes API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fset-page-boxes\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-page-boxes-set API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fset-page-boxes\"\n        }\n      ],\n      \"keywords\": \".NET, Crop, Set Page Boxes\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Crop PDF in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7784,7785,7786,7787,7788],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2181,"name":2182,"slug":2183,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1935,"name":1936,"slug":1937,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-crop-pdf-in-net-with-c\u002F","How to Crop PDF in .NET with C#, Tutorial | pdfRest",{"id":7793,"uuid":7794,"title":7795,"slug":7796,"html":7797,"comment_id":7793,"feature_image":48,"featured":284,"visibility":1257,"created_at":7798,"updated_at":7780,"published_at":7798,"custom_excerpt":7799,"codeinjection_head":7800,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7801,"primary_tag":7807,"url":7808,"excerpt":7799,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7809,"meta_description":7799,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"68375343533c9f26b9439968","877b8d58-66f6-49f6-a69e-4a7e338aae4b","How to Crop PDF with cURL","how-to-crop-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Crop PDF Files with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fset-page-boxes\u002F\">Set Page Boxes API Tool\u003C\u002Fa> allows you to define or modify the page boxes of a PDF document, including the CropBox, which controls the visible content area. This tutorial will guide you through the process of sending an API call to set the CropBox using cURL to \u003Cstrong>crop PDF files\u003C\u002Fstrong> from the command line.\u003C\u002Fp>\n\n\u003Cp>Consider a scenario where you need to quickly process a PDF and remove unwanted margins directly from your terminal. By using the Set Page Boxes API with cURL to adjust the CropBox, you can efficiently \u003Cstrong>crop the PDF\u003C\u002Fstrong> without the need for dedicated desktop software.\u003C\u002Fp>\n\n\u003Ch2>Crop PDF with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\"># Define the CropBox settings as a JSON string\nCROP_BOXES='{\"boxes\":[{\"box\":\"crop\",\"pages\":[{\"range\":\"1\",\"left\":50,\"top\":50,\"bottom\":50,\"right\":50}]}]}'\n\n# Use curl to send a POST request to the pdfRest API endpoint\ncurl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-page-boxes-set\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: YOUR_API_KEY\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf\" \\\n  -F \"boxes=$CROP_BOXES\" \\\n  -F \"output=cropped_example_out.pdf\"\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-page-boxes-set.sh\">GitHub\u003C\u002Fa> (Note: This example has been modified to focus on cropping)\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code for Cropping\u003C\u002Fh2>\n\n\u003Cp>The code starts by defining a variable \u003Ccode>CROP_BOXES\u003C\u002Fcode> which contains a JSON string. This JSON specifically sets the CropBox for the first page with the desired left, top, bottom, and right margins (in points) to achieve the \u003Cstrong>PDF cropping\u003C\u002Fstrong>:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">CROP_BOXES='{\"boxes\":[{\"box\":\"crop\",\"pages\":[{\"range\":\"1\",\"left\":50,\"top\":50,\"bottom\":50,\"right\":50}]}]}'\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>curl\u003C\u002Fcode> command is used to send a POST request to the pdfRest API endpoint for setting page boxes.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-page-boxes-set\"\u003C\u002Fpre>\n\n\u003Cp>Headers are set to specify that we expect a JSON response and that we are sending multipart form data. The \u003Ccode>Api-Key\u003C\u002Fcode> header is crucial for authentication. \u003Cstrong>Replace \u003Ccode>YOUR_API_KEY\u003C\u002Fcode> with your actual pdfRest API key.\u003C\u002Fstrong>\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\" \\\n-H \"Content-Type: multipart\u002Fform-data\" \\\n-H \"Api-Key: YOUR_API_KEY\"\u003C\u002Fpre>\n\n\u003Cp>Form data is included using the \u003Ccode>-F\u003C\u002Fcode> option. The \u003Ccode>file\u003C\u002Fcode> parameter specifies the path to the PDF file you want to \u003Cstrong>crop\u003C\u002Fstrong>. \u003Cstrong>Make sure to replace \u003Ccode>\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf\u003C\u002Fcode> with the actual path to your PDF.\u003C\u002Fstrong> The \u003Ccode>boxes\u003C\u002Fcode> parameter contains the JSON string we defined in the \u003Ccode>CROP_BOXES\u003C\u002Fcode> variable. The \u003Ccode>output\u003C\u002Fcode> parameter specifies the name of the resulting cropped PDF file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf\" \\\n-F \"boxes=$CROP_BOXES\" \\\n-F \"output=cropped_example_out.pdf\"\u003C\u002Fpre>\n\n\u003Ch2>Further Exploration for PDF Cropping with cURL\u003C\u002Fh2>\n\n\u003Cp>This tutorial demonstrated how to quickly \u003Cstrong>crop PDF files\u003C\u002Fstrong> from the command line using cURL and the pdfRest Set Page Boxes API by specifically adjusting the CropBox. You can modify the JSON string in the \u003Ccode>CROP_BOXES\u003C\u002Fcode> variable to apply different cropping settings to various pages or page ranges within your PDF. Experiment with different margin values to achieve the precise visual outcome you need.\u003C\u002Fp>\n\n\u003Cp>To explore more about the Set Page Boxes API and its capabilities, including setting other page boxes, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and consult the comprehensive \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fset-page-boxes\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. JSON payload examples for setting page boxes, including the CropBox, can be found on \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-page-boxes-set.sh\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-05-28T18:17:39.000+00:00","Learn how to use cURL to crop PDF files by setting the CropBox with pdfRest's Set Page Boxes API.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Crop PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-curl\u002F\",\n      \"datePublished\": \"2025-05-28T18:17:39.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:15.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use cURL to crop PDF files by setting the CropBox with pdfRest's Set Page Boxes API.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Set Page Boxes API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fset-page-boxes\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-page-boxes-set API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fset-page-boxes\"\n        }\n      ],\n      \"keywords\": \"Crop, Set Page Boxes, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Crop PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7802,7803,7804,7805,7806],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2181,"name":2182,"slug":2183,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1935,"name":1936,"slug":1937,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-crop-pdf-with-curl\u002F","How to Crop PDF with cURL, Tutorial | pdfRest",{"id":7811,"uuid":7812,"title":7813,"slug":7814,"html":7815,"comment_id":7811,"feature_image":48,"featured":284,"visibility":1257,"created_at":7816,"updated_at":7780,"published_at":7816,"custom_excerpt":7817,"codeinjection_head":7818,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7819,"primary_tag":7825,"url":7826,"excerpt":7817,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7827,"meta_description":7817,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"68375382533c9f26b9439972","1c65ea0a-90ba-4e5e-a089-08888c2c04cf","How to Crop PDF with Java","how-to-crop-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Crop PDF Files with Java?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fset-page-boxes\u002F\">Set Page Boxes API Tool\u003C\u002Fa> allows you to programmatically define the page boxes for PDF documents, specifically the CropBox, which controls the visible content area. This tutorial will guide you through the process of sending an API call to set the CropBox using Java to \u003Cstrong>crop PDF files\u003C\u002Fstrong>.\u003C\u002Fp>\n\n\u003Cp>Consider a scenario where you need to automate the process of removing unwanted margins from a batch of PDF documents. By using the Set Page Boxes API with Java to adjust the CropBox, you can efficiently \u003Cstrong>crop PDFs\u003C\u002Fstrong> to focus on the essential content for improved viewing or further processing.\u003C\u002Fp>\n\n\u003Ch2>Crop PDF with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\n\npublic class PDFWithPageBoxesSet {\n\n    \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n    private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf\"; \u002F\u002F Replace with your file path\n\n    \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n    \u002F\u002F You can also put the environment variable in a .env file.\n    private static final String DEFAULT_API_KEY = \"YOUR_API_KEY\"; \u002F\u002F Replace with your actual API key\n\n    public static void main(String[] args) {\n        File inputFile;\n        if (args.length > 0) {\n            inputFile = new File(args[0]);\n        } else {\n            inputFile = new File(DEFAULT_FILE_PATH);\n        }\n\n        final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n        JSONObject page = new JSONObject();\n        page.put(\"range\", \"1\");\n        page.put(\"left\", 50);  \u002F\u002F Adjust these values to your desired crop\n        page.put(\"top\", 50);\n        page.put(\"bottom\", 50);\n        page.put(\"right\", 50);\n\n        JSONArray pagesArray = new JSONArray();\n        pagesArray.put(page);\n\n        JSONObject box = new JSONObject();\n        box.put(\"box\", \"crop\"); \u002F\u002F Set the box type to \"crop\"\n        box.put(\"pages\", pagesArray);\n\n        JSONArray boxesArray = new JSONArray();\n        boxesArray.put(box);\n\n        JSONObject boxOptionsObject = new JSONObject();\n        boxOptionsObject.put(\"boxes\", boxesArray);\n        final RequestBody inputFileRequestBody =\n                RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n        RequestBody requestBody =\n                new MultipartBody.Builder()\n                        .setType(MultipartBody.FORM)\n                        .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n                        .addFormDataPart(\"boxes\", boxOptionsObject.toString())\n                        .addFormDataPart(\"output\", \"cropped_example_out.pdf\")\n                        .build();\n        Request request =\n                new Request.Builder()\n                        .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n                        .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-page-boxes-set\")\n                        .post(requestBody)\n                        .build();\n        try {\n            OkHttpClient client =\n                    new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n            Response response = client.newCall(request).execute();\n            System.out.println(\"Result code \" + response.code());\n            if (response.body() != null) {\n                System.out.println(prettyJson(response.body().string()));\n            }\n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    private static String prettyJson(String json) {\n        \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n        return new JSONObject(json).toString(4);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPDFWithPageBoxesSet.java\">GitHub Repository\u003C\u002Fa> (Note: This example has been modified to focus on cropping)\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code for Cropping\u003C\u002Fh2>\n\n\u003Cp>The code imports necessary libraries for HTTP requests and JSON handling. It defines placeholders for the input file path and API key. \u003Cstrong>Ensure you replace \u003Ccode>\"\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf\"\u003C\u002Fcode> with the actual path to your PDF file and \u003Ccode>\"YOUR_API_KEY\"\u003C\u002Fcode> with your actual pdfRest API key.\u003C\u002Fstrong>\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">JSONObject page = new JSONObject();\npage.put(\"range\", \"1\");\npage.put(\"left\", 50);  \u002F\u002F Adjust these values to your desired crop\npage.put(\"top\", 50);\npage.put(\"bottom\", 50);\npage.put(\"right\", 50);\n\u003C\u002Fpre>\n\n\u003Cp>This section creates a JSON object to define the cropping boundaries for the first page. The \u003Ccode>left\u003C\u002Fcode>, \u003Ccode>top\u003C\u002Fcode>, \u003Ccode>bottom\u003C\u002Fcode>, and \u003Ccode>right\u003C\u002Fcode> values specify the new margins in points after the \u003Cstrong>PDF is cropped\u003C\u002Fstrong>. \u003Cstrong>Adjust these values to achieve your desired cropping effect.\u003C\u002Fstrong>\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">JSONObject box = new JSONObject();\nbox.put(\"box\", \"crop\"); \u002F\u002F Set the box type to \"crop\"\nbox.put(\"pages\", pagesArray);\n\u003C\u002Fpre>\n\n\u003Cp>Here, a JSON object sets the \u003Ccode>\"box\"\u003C\u002Fcode> type to \u003Ccode>\"crop\"\u003C\u002Fcode>, indicating that we want to adjust the CropBox.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">RequestBody requestBody =\n    new MultipartBody.Builder()\n        .setType(MultipartBody.FORM)\n        .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n        .addFormDataPart(\"boxes\", boxOptionsObject.toString())\n        .addFormDataPart(\"output\", \"cropped_example_out.pdf\")\n        .build();\n\u003C\u002Fpre>\n\n\u003Cp>This part of the code constructs the multipart request body, including the PDF file, the JSON object containing the CropBox settings, and the desired output filename.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Request request =\n    new Request.Builder()\n        .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n        .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-page-boxes-set\")\n        .post(requestBody)\n        .build();\n\u003C\u002Fpre>\n\n\u003Cp>The API request is built with your API key in the header and the URL for the Set Page Boxes endpoint. The POST method is used to send the request with the constructed body.\u003C\u002Fp>\n\n\u003Ch2>Further Exploration for PDF Cropping\u003C\u002Fh2>\n\n\u003Cp>This tutorial demonstrated how to use Java and the pdfRest API to \u003Cstrong>crop PDF files\u003C\u002Fstrong> by specifically setting the CropBox. You can modify the \u003Ccode>left\u003C\u002Fcode>, \u003Ccode>top\u003C\u002Fcode>, \u003Ccode>bottom\u003C\u002Fcode>, and \u003Ccode>right\u003C\u002Fcode> values in the JSON payload to achieve different cropping results. You can also extend this example to apply different cropping settings to multiple pages or page ranges within a PDF document.\u003C\u002Fp>\n\n\u003Cp>To explore more about the Set Page Boxes API and other pdfRest tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and consult the comprehensive \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. JSON payload examples for setting page boxes, including the CropBox, can be found \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPDFWithPageBoxesSet.java\">here\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-05-28T18:18:42.000+00:00","Learn how to use Set Page Boxes API from pdfRest with Java to crop PDF files by setting the CropBox.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Crop PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-java\u002F\",\n      \"datePublished\": \"2025-05-28T18:18:42.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:15.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use Set Page Boxes API from pdfRest with Java to crop PDF files by setting the CropBox.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Set Page Boxes API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fset-page-boxes\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-page-boxes-set API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fset-page-boxes\"\n        }\n      ],\n      \"keywords\": \"Crop, Java, Set Page Boxes\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Crop PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7820,7821,7822,7823,7824],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2181,"name":2182,"slug":2183,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1935,"name":1936,"slug":1937,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-crop-pdf-with-java\u002F","How to Crop PDF with Java, Tutorial | pdfRest",{"id":7829,"uuid":7830,"title":7831,"slug":7832,"html":7833,"comment_id":7829,"feature_image":48,"featured":284,"visibility":1257,"created_at":7834,"updated_at":7835,"published_at":7834,"custom_excerpt":7836,"codeinjection_head":7837,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7838,"primary_tag":7844,"url":7845,"excerpt":7836,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7846,"meta_description":7836,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"68375322533c9f26b943995e","2bce1ebe-1ece-45ca-8c53-77f8a5bac0b5","How to Crop PDF with JavaScript in NodeJS","how-to-crop-pdf-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Crop PDF Files with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fset-page-boxes\u002F\">Set Page Boxes API Tool\u003C\u002Fa> allows you to modify the page boxes of a PDF, including the CropBox, which defines the visible content area. This tutorial will guide you through the process of sending an API call to Set Page Boxes using JavaScript to \u003Cstrong>crop PDF files\u003C\u002Fstrong>.\u003C\u002Fp>\n\n\u003Cp>Imagine you have a PDF document with unnecessary margins that you want to remove to focus on the core content for better display or printing. By using the Set Page Boxes API to programmatically adjust the CropBox, you can automate the process of \u003Cstrong>cropping PDFs\u003C\u002Fstrong> directly within your JavaScript applications.\u003C\u002Fp>\n\n\u003Ch2>Crop PDF with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F**\n * This request demonstrates how to crop a PDF by adjusting the CropBox.\n *\u002F\nvar axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf\")); \u002F\u002F Replace with the actual path to your PDF file\nconst cropBoxOptions = {\n  boxes: [\n    {\n      box: \"crop\",\n      pages: [\n        {\n          range: \"1\",\n          left: 50,    \u002F\u002F Adjust these values to your desired crop (in points)\n          top: 50,\n          bottom: 50,\n          right: 50,\n        },\n      ],\n    },\n  ],\n};\ndata.append(\"boxes\", JSON.stringify(cropBoxOptions));\ndata.append(\"output\", \"cropped_example_out\");\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: \"post\",\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-page-boxes-set\",\n  headers: {\n    \"Api-Key\": \"YOUR_API_KEY\", \u002F\u002F Replace with your actual API key\n    ...data.getHeaders(), \u002F\u002F set headers for the request\n  },\n  data: data, \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error);\n  });\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-page-boxes-set.js\">GitHub Repository\u003C\u002Fa> (Note: This example has been modified to focus on cropping)\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code for Cropping\u003C\u002Fh2>\n\n\u003Cp>The code starts by importing the necessary modules for making HTTP requests and handling form data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\u003C\u002Fpre>\n\n\u003Cp>A new \u003Ccode>FormData\u003C\u002Fcode> instance is created to hold the PDF file and the cropping parameters. The PDF file is read using \u003Ccode>fs.createReadStream()\u003C\u002Fcode>. \u003Cstrong>Make sure to replace \u003Ccode>\"\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf\"\u003C\u002Fcode> with the actual path to your PDF file.\u003C\u002Fstrong>\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf\"));\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>cropBoxOptions\u003C\u002Fcode> object is specifically configured to \u003Cstrong>crop the PDF\u003C\u002Fstrong>. The \u003Ccode>\"box\"\u003C\u002Fcode> property is set to \u003Ccode>\"crop\"\u003C\u002Fcode>, and the \u003Ccode>\"pages\"\u003C\u002Fcode> array specifies the pages to be cropped (in this case, the first page with \u003Ccode>\"range\": \"1\"\u003C\u002Fcode>). The \u003Ccode>\"left\"\u003C\u002Fcode>, \u003Ccode>\"top\"\u003C\u002Fcode>, \u003Ccode>\"bottom\"\u003C\u002Fcode>, and \u003Ccode>\"right\"\u003C\u002Fcode> values define the new boundaries of the visible content area in points. \u003Cstrong>Adjust these values to achieve your desired cropping.\u003C\u002Fstrong>\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">const cropBoxOptions = {\n  boxes: [\n    {\n      box: \"crop\",\n      pages: [\n        {\n          range: \"1\",\n          left: 50,    \u002F\u002F Adjust these values to your desired crop (in points)\n          top: 50,\n          bottom: 50,\n          right: 50,\n        },\n      ],\n    },\n  ],\n};\u003C\u002Fpre>\n\n\u003Cp>This \u003Ccode>cropBoxOptions\u003C\u002Fcode> object is converted to a JSON string and appended to the \u003Ccode>FormData\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">data.append(\"boxes\", JSON.stringify(cropBoxOptions));\ndata.append(\"output\", \"cropped_example_out\");\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>config\u003C\u002Fcode> object sets up the Axios request, including the API endpoint URL and your API key in the headers. \u003Cstrong>Replace \u003Ccode>\"YOUR_API_KEY\"\u003C\u002Fcode> with your actual pdfRest API key.\u003C\u002Fstrong>\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: \"post\",\n  maxBodyLength: Infinity,\n  url: \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-page-boxes-set\",\n  headers: {\n    \"Api-Key\": \"YOUR_API_KEY\",\n    ...data.getHeaders(),\n  },\n  data: data,\n};\u003C\u002Fpre>\n\n\u003Cp>Finally, the Axios library is used to send the POST request to the pdfRest API to \u003Cstrong>crop the PDF\u003C\u002Fstrong>. The response or any errors are then logged to the console.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error);\n  });\u003C\u002Fpre>\n\n\u003Ch2>Further Exploration for PDF Cropping\u003C\u002Fh2>\n\n\u003Cp>This tutorial demonstrated how to \u003Cstrong>crop PDF files\u003C\u002Fstrong> using JavaScript and the pdfRest Set Page Boxes API by specifically manipulating the CropBox. You can modify the \u003Ccode>cropBoxOptions\u003C\u002Fcode> to apply different cropping settings to various pages or page ranges within your PDF. Experiment with different margin values to achieve the precise visual outcome you need.\u003C\u002Fp>\n\n\u003Cp>To explore more about the Set Page Boxes API and its capabilities, including setting other page boxes, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and consult the comprehensive \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fset-page-boxes\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-page-boxes-set.js\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-05-28T18:17:06.000+00:00","2026-09-02T18:28:24.000+00:00","Learn how to crop PDF files by setting the CropBox with Set Page Boxes API from pdfRest using JavaScript.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Crop PDF with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2025-05-28T18:17:06.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:15.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to crop PDF files by setting the CropBox with Set Page Boxes API from pdfRest using JavaScript.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Set Page Boxes API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fset-page-boxes\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-page-boxes-set API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fset-page-boxes\"\n        }\n      ],\n      \"keywords\": \"Crop, JavaScript, Set Page Boxes\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Crop PDF with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7839,7840,7841,7842,7843],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2181,"name":2182,"slug":2183,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1935,"name":1936,"slug":1937,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-crop-pdf-with-javascript-in-nodejs\u002F","How to Crop PDF with JavaScript in NodeJS, Tutorial | pdfRest",{"id":7848,"uuid":7849,"title":7850,"slug":7851,"html":7852,"comment_id":7848,"feature_image":48,"featured":284,"visibility":1257,"created_at":7853,"updated_at":7835,"published_at":7853,"custom_excerpt":7854,"codeinjection_head":7855,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7856,"primary_tag":7862,"url":7863,"excerpt":7854,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7864,"meta_description":7854,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"68375246533c9f26b943994a","e1e8d55c-67eb-481b-acf3-1bf69fc83bc4","How to Crop PDF with PHP","how-to-crop-pdf-with-php-code","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Crop PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fset-page-boxes\u002F\">Set Page Boxes API Tool\u003C\u002Fa> allows developers to programmatically define and modify the page boxes of a PDF document, specifically the CropBox, to control the visible content area. This tutorial demonstrates how to use PHP to send an API call to set the CropBox using this tool to \u003Cstrong>crop PDF files\u003C\u002Fstrong>.\u003C\u002Fp>\n\n\u003Cp>Consider a scenario where you have PDF documents with excessive margins that you want to remove for better readability or to fit specific layout requirements. By using the Set Page Boxes tool to adjust the CropBox via the pdfRest API, you can automate the process of \u003Cstrong>cropping PDFs\u003C\u002Fstrong> to focus on the essential content.\u003C\u002Fp>\n\n\u003Ch2>Crop PDF with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">\nrequire 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\n$headers = [\n    'Api-Key' => 'YOUR_API_KEY' \u002F\u002F Set the API key in the headers for authentication. Replace with your actual API key.\n];\n\n\u002F\u002F Define the CropBox settings to crop the first page\n$crop_box_options = [\n    'boxes' => [\n        [\n            'box' => 'crop',\n            'pages' => [\n                [\n                    'range' => '1',\n                    'left' => 50,  \u002F\u002F Adjust these values to your desired crop\n                    'top' => 50,\n                    'bottom' => 50,\n                    'right' => 50\n                ]\n            ]\n        ]\n    ]\n];\n\n$options = [\n    'multipart' => [\n        [\n            'name' => 'file', \u002F\u002F Specify the field name for the file.\n            'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf' for reading. Replace with your actual file path.\n            'filename' => 'filename.pdf', \u002F\u002F Set the filename for the file to be processed.\n            'headers' => [\n                'Content-Type' => 'application\u002Fpdf' \u002F\u002F Set the Content-Type header for the file.\n            ]\n        ],\n        [\n            'name' => 'boxes', \u002F\u002F Specify the field name for the text options.\n            'contents' => json_encode($crop_box_options) \u002F\u002F Set the value for the boxes option as a JSON string.\n        ],\n        [\n            'name' => 'output', \u002F\u002F Specify the field name for the output option.\n            'contents' => 'cropped_example_out' \u002F\u002F Set the desired name for the output file.\n        ]\n    ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-page-boxes-set', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the cropped PDF.\n\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-page-boxes-set.php\">GitHub Repository\u003C\u002Fa> (Note: This example has been modified to focus on cropping)\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code for Cropping\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">require 'vendor\u002Fautoload.php';\u003C\u002Fpre>\n\n\u003Cp>This line includes the Composer autoloader to load the Guzzle HTTP client library.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$client = new Client();\u003C\u002Fpre>\n\n\u003Cp>This creates a new instance of the Guzzle HTTP client, which will be used to make the API request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$headers = [\n    'Api-Key' => 'YOUR_API_KEY'\n];\n\u003C\u002Fpre>\n\n\u003Cp>Here, you define the headers for the API request, including your unique API key. \u003Cstrong>Replace \u003Ccode>'YOUR_API_KEY'\u003C\u002Fcode> with your actual pdfRest API key.\u003C\u002Fstrong>\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$crop_box_options = [\n    'boxes' => [\n        [\n            'box' => 'crop',\n            'pages' => [\n                [\n                    'range' => '1',\n                    'left' => 50,  \u002F\u002F Adjust these values to your desired crop\n                    'top' => 50,\n                    'bottom' => 50,\n                    'right' => 50\n                ]\n            ]\n        ]\n    ]\n];\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>$crop_box_options\u003C\u002Fcode> array is configured to specifically \u003Cstrong>crop the PDF\u003C\u002Fstrong>. The \u003Ccode>'box'\u003C\u002Fcode> is set to \u003Ccode>'crop'\u003C\u002Fcode>, and the \u003Ccode>'pages'\u003C\u002Fcode> array targets the first page (\u003Ccode>'range' => '1'\u003C\u002Fcode>). The \u003Ccode>'left'\u003C\u002Fcode>, \u003Ccode>'top'\u003C\u002Fcode>, \u003Ccode>'bottom'\u003C\u002Fcode>, and \u003Ccode>'right'\u003C\u002Fcode> values define the new boundaries of the visible content area in points. \u003Cstrong>Modify these values to achieve your desired cropping.\u003C\u002Fstrong>\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$options = [\n    'multipart' => [\n        [\n            'name' => 'file',\n            'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf', 'r'), \u002F\u002F Replace with your actual file path\n            'filename' => 'filename.pdf',\n            'headers' => [\n                'Content-Type' => 'application\u002Fpdf'\n            ]\n        ],\n        [\n            'name' => 'boxes',\n            'contents' => json_encode($crop_box_options)\n        ],\n        [\n            'name' => 'output',\n            'contents' => 'cropped_example_out'\n        ]\n    ]\n];\n\u003C\u002Fpre>\n\n\u003Cp>This section sets up the multipart form data for the API request. It includes the PDF file (\u003Cstrong>remember to replace \u003Ccode>'\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf'\u003C\u002Fcode> with your file's actual path\u003C\u002Fstrong>), the \u003Ccode>$crop_box_options\u003C\u002Fcode> encoded as a JSON string, and the desired output filename.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-page-boxes-set', $headers);\u003C\u002Fpre>\n\n\u003Cp>This creates a new HTTP POST request to the pdfRest API endpoint for setting page boxes.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$res = $client->sendAsync($request, $options)->wait();\u003C\u002Fpre>\n\n\u003Cp>This line sends the API request and waits for the response from the pdfRest server.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">echo $res->getBody();\u003C\u002Fpre>\n\n\u003Cp>Finally, the response from the API, which will be the cropped PDF data, is outputted.\u003C\u002Fp>\n\n\u003Ch2>Further Exploration for PDF Cropping\u003C\u002Fh2>\n\n\u003Cp>This tutorial showed you how to \u003Cstrong>crop PDF files\u003C\u002Fstrong> using PHP and the pdfRest Set Page Boxes API by specifically adjusting the CropBox. You can experiment with different margin values in the \u003Ccode>$crop_box_options\u003C\u002Fcode> to achieve various cropping results and apply these settings to different page ranges. For more advanced control and to explore setting other page boxes, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fset-page-boxes\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example uses a multipart API call. JSON payload examples for setting page boxes, including the CropBox, can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-page-boxes-set.php\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-05-28T18:13:26.000+00:00","Learn how to crop PDF files by setting the CropBox with pdfRest Set Page Boxes API using Python.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-php-code\u002F#article\",\n      \"headline\": \"How to Crop PDF with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-php-code\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-php-code\u002F\",\n      \"datePublished\": \"2025-05-28T18:13:26.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:15.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to crop PDF files by setting the CropBox with pdfRest Set Page Boxes API using Python.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Set Page Boxes API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fset-page-boxes\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-page-boxes-set API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fset-page-boxes\"\n        }\n      ],\n      \"keywords\": \"Crop, PHP, Set Page Boxes\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Crop PDF with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-php-code\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7857,7858,7859,7860,7861],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2181,"name":2182,"slug":2183,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1935,"name":1936,"slug":1937,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-crop-pdf-with-php-code\u002F","How to Crop PDF with PHP, Tutorial | pdfRest",{"id":7866,"uuid":7867,"title":7868,"slug":7869,"html":7870,"comment_id":7866,"feature_image":48,"featured":284,"visibility":1257,"created_at":7871,"updated_at":7872,"published_at":7871,"custom_excerpt":7873,"codeinjection_head":7874,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7875,"primary_tag":7881,"url":7882,"excerpt":7873,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7883,"meta_description":7873,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6837520c533c9f26b9439940","e2fb4c00-6a00-4a26-a5b7-01fdbe4b2bec","How to Crop PDF with Python","how-to-crop-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Crop PDF Files with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fset-page-boxes\u002F\">Set Page Boxes API Tool\u003C\u002Fa> is a powerful feature that allows you to modify the page boxes of a PDF document, specifically the CropBox, to control the visible content area. This tutorial will guide you through the process of sending an API call to the Set Page Boxes endpoint using Python to \u003Cstrong>crop PDF files\u003C\u002Fstrong>.\u003C\u002Fp>\n\n\u003Cp>Imagine you have a PDF document with excessive white space around the content, or perhaps you only want to focus on a specific region of a page. By using the Set Page Boxes API to adjust the CropBox, you can effectively \u003Cstrong>crop the PDF\u003C\u002Fstrong> to remove these unwanted areas and highlight the essential information for better viewing or printing.\u003C\u002Fp>\n\n\u003Ch2>Crop PDF with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\npdf_with_page_boxes_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-page-boxes-set'\n\n# Define the CropBox settings to crop the first page\ncrop_box_options = {\n    \"boxes\": [\n        {\n            \"box\": \"crop\",\n            \"pages\": [\n                {\n                    \"range\": \"1\",\n                    \"left\": 50,  # Adjust these values to your desired crop\n                    \"top\": 50,\n                    \"bottom\": 50,\n                    \"right\": 50\n                }\n            ]\n        }\n    ]\n}\n\nmp_encoder_setBoxesPDF = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf', 'rb'), 'application\u002Fpdf'), # Replace with your file path\n        'boxes': json.dumps(crop_box_options),\n        'output' : 'cropped_example_out'\n    }\n)\n\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_setBoxesPDF.content_type,\n    'Api-Key': 'YOUR_API_KEY' # Replace with your actual API key\n}\n\nprint(\"Sending POST request to pdf-with-page-boxes-set endpoint to crop PDF...\")\nresponse = requests.post(pdf_with_page_boxes_endpoint_url, data=mp_encoder_setBoxesPDF, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-page-boxes-set.py\">GitHub\u003C\u002Fa> (Note: This example has been modified to focus on cropping)\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code for Cropping\u003C\u002Fh2>\n\n\u003Cp>The code starts by importing the necessary libraries for making API calls and handling data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">pdf_with_page_boxes_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-page-boxes-set'\n\u003C\u002Fpre>\n\n\u003Cp>This line defines the API endpoint URL for setting page boxes.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">crop_box_options = {\n    \"boxes\": [\n        {\n            \"box\": \"crop\",\n            \"pages\": [\n                {\n                    \"range\": \"1\",\n                    \"left\": 50,  # Adjust these values to your desired crop\n                    \"top\": 50,\n                    \"bottom\": 50,\n                    \"right\": 50\n                }\n            ]\n        }\n    ]\n}\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>crop_box_options\u003C\u002Fcode> dictionary is specifically configured to \u003Cstrong>crop the PDF\u003C\u002Fstrong>. Notice that the \u003Ccode>\"box\"\u003C\u002Fcode> key is set to \u003Ccode>\"crop\"\u003C\u002Fcode>. The \u003Ccode>\"pages\"\u003C\u002Fcode> array specifies that this cropping will be applied to the first page (\u003Ccode>\"range\": \"1\"\u003C\u002Fcode>), and the \u003Ccode>\"left\"\u003C\u002Fcode>, \u003Ccode>\"top\"\u003C\u002Fcode>, \u003Ccode>\"bottom\"\u003C\u002Fcode>, and \u003Ccode>\"right\"\u003C\u002Fcode> values define the new boundaries of the visible content area. \u003Cstrong>Adjust these margin values (in points) to achieve your desired cropping effect.\u003C\u002Fstrong>\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_setBoxesPDF = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf', 'rb'), 'application\u002Fpdf'), # Replace with your file path\n        'boxes': json.dumps(crop_box_options),\n        'output' : 'cropped_example_out'\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>Here, we create a \u003Ccode>MultipartEncoder\u003C\u002Fcode> to send the PDF file and the \u003Ccode>crop_box_options\u003C\u002Fcode> as multipart form data. \u003Cstrong>Make sure to replace \u003Ccode>'\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf'\u003C\u002Fcode> with the actual path to your PDF file.\u003C\u002Fstrong>\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_setBoxesPDF.content_type,\n    'Api-Key': 'YOUR_API_KEY' # Replace with your actual API key\n}\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>headers\u003C\u002Fcode> dictionary includes the necessary information for the API request, including your unique API key. \u003Cstrong>Remember to replace \u003Ccode>'YOUR_API_KEY'\u003C\u002Fcode> with your actual pdfRest API key.\u003C\u002Fstrong>\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(pdf_with_page_boxes_endpoint_url, data=mp_encoder_setBoxesPDF, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This line sends the POST request to the pdfRest API endpoint to \u003Cstrong>crop the PDF\u003C\u002Fstrong> using the specified CropBox settings.\u003C\u002Fp>\n\n\u003Ch2>Next Steps for Cropping PDFs\u003C\u002Fh2>\n\n\u003Cp>This tutorial demonstrated how to use Python and the pdfRest Set Page Boxes API to \u003Cstrong>crop PDF files\u003C\u002Fstrong> by setting the CropBox. You can further explore the \u003Ccode>crop_box_options\u003C\u002Fcode> to apply different cropping settings to various page ranges within your PDF. Experiment with different \u003Ccode>left\u003C\u002Fcode>, \u003Ccode>top\u003C\u002Fcode>, \u003Ccode>bottom\u003C\u002Fcode>, and \u003Ccode>right\u003C\u002Fcode> values to achieve the precise cropping you need.\u003C\u002Fp>\n\n\u003Cp>To learn more about the Set Page Boxes API and its capabilities, including setting other page boxes, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for detailed documentation.\u003C\u002Fp>\n\n\u003Cp>Note: This example uses a multipart API call. JSON payload examples for setting page boxes, including the CropBox, can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-page-boxes-set.py\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-05-28T18:12:28.000+00:00","2026-09-02T18:28:25.000+00:00","Learn how to use Set Page Boxes API from pdfRest with Python to crop PDF files by setting the CropBox.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Crop PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-python\u002F\",\n      \"datePublished\": \"2025-05-28T18:12:28.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:16.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use Set Page Boxes API from pdfRest with Python to crop PDF files by setting the CropBox.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Set Page Boxes API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fset-page-boxes\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-page-boxes-set API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fset-page-boxes\"\n        }\n      ],\n      \"keywords\": \"Crop, Python, Set Page Boxes\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Crop PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-crop-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7876,7877,7878,7879,7880],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2181,"name":2182,"slug":2183,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1935,"name":1936,"slug":1937,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-crop-pdf-with-python\u002F","How to Crop PDF with Python, Tutorial | pdfRest",{"id":7885,"uuid":7886,"title":7887,"slug":7888,"html":7889,"comment_id":7885,"feature_image":48,"featured":284,"visibility":1257,"created_at":7890,"updated_at":7891,"published_at":7890,"custom_excerpt":7892,"codeinjection_head":7893,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7894,"primary_tag":7900,"url":7901,"excerpt":7892,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7902,"meta_description":7892,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"68e94cfb533c9f26b943a738","0c204070-602e-48a2-baa7-346d796c92b2","How to Delete Files On-Demand in .NET with C#","how-to-delete-files-on-demand-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Delete pdfRest Files on Demand with C#\u003C\u002Fh2>\n\n\u003Cp>The pdfRest Cloud API automatically removes uploaded and generated files after the retention period associated with the account, which is 30 minutes for most plans. When a .NET application must remove those resources as soon as a workflow finishes, the pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fdelete-files\u002F\">Delete Files API Tool\u003C\u002Fa> provides an explicit \u003Ccode>\u002Fdelete\u003C\u002Fcode> endpoint for permanent, on-demand cleanup.\u003C\u002Fp>\n\n\u003Cp>The endpoint can delete multiple resource IDs in one call, making it suitable for workflows that create an input and several intermediate outputs. Deletion is irreversible, so the application should not treat it as a routine step that runs regardless of state. Every required result must be saved, and every operation that depends on the resource must finish, before its ID is submitted.\u003C\u002Fp>\n\n\u003Cp>For example, a C# claims-processing service can upload a claim package, generate a searchable PDF, extract structured data, and copy the approved outputs into the insurer's system of record. Once those writes are verified, the service can submit the source and intermediate pdfRest resource IDs together for deletion. Centralized tracking prevents an intermediate file from being overlooked and prevents a still-active resource from being removed too early.\u003C\u002Fp>\n\n\u003Cp>This example uses \u003Ccode>HttpClient\u003C\u002Fcode> and \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> to delete a comma-separated list of IDs.\u003C\u002Fp>\n\n\u003Ch2>C# Delete Files Code Example\u003C\u002Fh2>\n\n\u003Cp>Set \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode> in the environment, optionally set \u003Ccode>PDFREST_URL\u003C\u002Fcode> for the processing region, and replace the resource-ID placeholders. The IDs must have been created under the same API key used for the delete request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">\u002F*\n * What this sample does:\n * - Deletes multiple resources by ids.\n * - Routed from Program.cs as: `dotnet run -- batch-delete-multipart id1 [id2] [...]`.\n *\n * Setup (environment):\n * - Copy .env.example to .env\n * - Set PDFREST_API_KEY=your_api_key_here\n * - Optional: set PDFREST_URL to override the API region. For EU\u002FGDPR compliance and proximity, use:\n *     PDFREST_URL=https:\u002F\u002Feu-api.pdfrest.com\n *   For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\n * Usage:\n *   dotnet run -- batch-delete-multipart id1 id2 id3\n *\n * Output:\n * - Prints the JSON response. Validation errors (args\u002Fenv) exit non-zero.\n *\u002F\n\nnamespace Samples.EndpointExamples.MultipartPayload\n{\n    public static class BatchDelete\n    {\n        public static async Task Execute(string[] args)\n        {\n            if (args == null || args.Length \u003C 1)\n            {\n                Console.Error.WriteLine(\"batch-delete-multipart requires id1 [id2] [...]\");\n                Environment.Exit(1);\n                return;\n            }\n\n            var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\n            if (string.IsNullOrWhiteSpace(apiKey))\n            {\n                Console.Error.WriteLine(\"Missing required environment variable: PDFREST_API_KEY\");\n                Environment.Exit(1);\n                return;\n            }\n            var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n\n            using var client = new HttpClient();\n            using var request = new HttpRequestMessage(HttpMethod.Post, baseUrl.TrimEnd('\u002F') + \"\u002Fdelete\");\n            request.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\n            var content = new MultipartFormDataContent();\n            content.Add(new StringContent(string.Join(',', args)), \"ids\");\n            request.Content = content;\n            var response = await client.SendAsync(request);\n            var body = await response.Content.ReadAsStringAsync();\n            Console.WriteLine(body);\n        }\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fdelete.cs\">pdfRest Delete Files multipart C# sample\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Track and Submit Resource IDs\u003C\u002Fh2>\n\n\u003Cp>The sample adds an \u003Ccode>ids\u003C\u002Fcode> form field containing a comma-separated list. A production service can build this list from the IDs recorded during the document job. Include original uploads and generated outputs only after confirming they are no longer needed. Deduplicate values and associate them with the job or tenant that created them so one workflow cannot accidentally submit another workflow's resources.\u003C\u002Fp>\n\n\u003Cp>Use the same regional base URL that created the resources. The default environment setting targets the US Cloud API; \u003Ccode>PDFREST_URL\u003C\u002Fcode> can select the EU API when required. Keeping both the URL and key in deployment configuration prevents credentials and regional decisions from being embedded in source code.\u003C\u002Fp>\n\n\u003Cp>The current official sample sends the request and prints the response. Application code should inspect \u003Ccode>response.IsSuccessStatusCode\u003C\u002Fcode>, parse the JSON only after confirming the status, and retain enough cleanup state to handle partial failure. A repeated cleanup attempt should be recognized and handled without masking the original job outcome.\u003C\u002Fp>\n\n\u003Ch2>Make Cleanup Depend on Successful Delivery\u003C\u002Fh2>\n\n\u003Cp>Resource cleanup belongs after final output delivery, not merely after processing. Confirm that the application has downloaded, validated, and stored every required file. If a later pdfRest call still uses an ID, wait for that operation to complete before deletion. A structured \u003Ccode>try\u003C\u002Fcode>\u002F\u003Ccode>finally\u003C\u002Fcode> flow or a durable cleanup queue can remove abandoned resources after failures while avoiding premature deletion during retries.\u003C\u002Fp>\n\n\u003Cp>Apply suitable request timeouts and cancellation tokens, handle network errors separately from API responses, and do not log document contents or secrets. Record the result needed for operational auditing without retaining unnecessary sensitive filenames.\u003C\u002Fp>\n\n\u003Cp>Applications that prefer JSON can submit the IDs in a JSON body. See the official \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fdelete.cs\">Delete Files JSON-payload C# sample\u003C\u002Fa>. Use \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> for request testing and consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fdelete-files\">Delete Files API reference\u003C\u002Fa> for the current schema.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-10-10T18:14:19.000+00:00","2026-09-10T19:45:59.000+00:00","Discover how to leverage the pdfRest Delete Files API in C# to instantly remove files you’ve uploaded or generated.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Delete Files On-Demand in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-in-net-with-c\u002F\",\n      \"datePublished\": \"2025-10-10T18:14:19.000Z\",\n      \"dateModified\": \"2026-09-10T19:31:23.947Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Discover how to leverage the pdfRest Delete Files API in C# to instantly remove files you’ve uploaded or generated.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Delete Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fdelete-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fdelete API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fdelete-files\"\n        }\n      ],\n      \"keywords\": \".NET, Delete File, Security\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Delete Files On-Demand in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7895,7896,7897,7898,7899],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2025,"name":2026,"slug":2027,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-delete-files-on-demand-in-net-with-c\u002F","How to Delete Files On-Demand in .NET with C#, Tutorial | pdfRest",{"id":7904,"uuid":7905,"title":7906,"slug":7907,"html":7908,"comment_id":7904,"feature_image":48,"featured":284,"visibility":1257,"created_at":7909,"updated_at":7872,"published_at":7909,"custom_excerpt":7910,"codeinjection_head":7911,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7912,"primary_tag":7918,"url":7919,"excerpt":7910,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7920,"meta_description":7910,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"68e94d8f533c9f26b943a74c","47307c06-378f-455f-b00c-61b2c3b56160","How to Delete Files On-Demand with cURL","how-to-delete-files-on-demand-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Delete Files with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fdelete-files\u002F'>Delete Files API Tool\u003C\u002Fa> provides a straightforward way to remove files from your storage using a simple API call. This tutorial will guide you through the process of sending an API call to the Delete Files endpoint using cURL, a command-line tool for transferring data with URLs. By leveraging cURL, you can automate file deletion within your pdfRest workflow, making it an essential tool for developers and system administrators.\u003C\u002Fp>\n\n\u003Cp>Consider a scenario where you have uploaded multiple PDF files to the pdfRest service for processing. Once the processing is complete, you may no longer need these files stored in the cloud. Using the Delete Files API, you can efficiently manage your storage by removing unnecessary files.\u003C\u002Fp>\n\n\u003Ch2>Delete Files with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\ncurl -X POST \"$API_URL\u002Fdelete\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"ids=xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fdelete.sh\">GitHub - pdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by setting the \u003Ccode>API_URL\u003C\u002Fcode> variable to the US-based API service endpoint:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">API_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\u003C\u002Fpre>\n\n\u003Cp>This is the default endpoint for global use. If you need to comply with GDPR or require better performance in Europe, you can switch to the EU-based service by uncommenting the relevant line.\u003C\u002Fp>\n\n\u003Cp>The cURL command is used to send a POST request to the Delete Files endpoint:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"$API_URL\u002Fdelete\"\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>-X POST\u003C\u002Fcode> option specifies that the request method is POST, which is necessary for the Delete Files operation.\u003C\u002Fp>\n\n\u003Cp>Several headers are included in the request:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\n-H \"Content-Type: multipart\u002Fform-data\"\n-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>Accept\u003C\u002Fcode> header indicates that the client expects a JSON response. The \u003Ccode>Content-Type\u003C\u002Fcode> header specifies that the request payload is multipart\u002Fform-data, which is suitable for sending form data. The \u003Ccode>Api-Key\u003C\u002Fcode> header contains your unique API key, which authenticates your request.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>-F\u003C\u002Fcode> option is used to specify form data:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"ids=xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>This line includes the \u003Ccode>ids\u003C\u002Fcode> parameter, which is a comma-separated list of file IDs you wish to delete. These IDs must be valid and correspond to files stored in your pdfRest account.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to send a cURL request to the pdfRest Delete Files API to remove files from the pdfRest Cloud service. This is a powerful way to manage your files programmatically. To explore more functionalities, try out all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on each API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example demonstrates a multipart API call. For code samples using JSON payloads, visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fdelete.sh\">GitHub - JSON Payload Examples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-10-10T18:16:47.000+00:00","Learn how to call the pdfRest Delete Files API with cURL to instantly remove files you’ve uploaded or generated.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-curl\u002F#article\",\n      \"headline\": \"How to Delete Files On-Demand with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-curl\u002F\",\n      \"datePublished\": \"2025-10-10T18:16:47.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:09.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to call the pdfRest Delete Files API with cURL to instantly remove files you’ve uploaded or generated.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Delete Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fdelete-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fdelete API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fdelete-files\"\n        }\n      ],\n      \"keywords\": \"Delete File, Security, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Delete Files On-Demand with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7913,7914,7915,7916,7917],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2025,"name":2026,"slug":2027,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-delete-files-on-demand-with-curl\u002F","How to Delete Files On-Demand with cURL, Tutorial | pdfRest",{"id":7922,"uuid":7923,"title":7924,"slug":7925,"html":7926,"comment_id":7922,"feature_image":48,"featured":284,"visibility":1257,"created_at":7927,"updated_at":7928,"published_at":7927,"custom_excerpt":7929,"codeinjection_head":7930,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7931,"primary_tag":7937,"url":7938,"excerpt":7929,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7939,"meta_description":7929,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"68e9506f533c9f26b943a756","0bbe6c51-8b7e-482c-a70c-9ed96562a60c","How to Delete Files On-Demand with Java","how-to-delete-files-on-demand-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Delete Files with Java?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fdelete-files\u002F'>Delete Files API Tool\u003C\u002Fa> is a powerful utility that allows users to delete files stored on the pdfRest platform. This tutorial will guide you through the process of sending an API call to Delete Files using Java. By integrating this API into your Java application, you can programmatically manage and remove files, ensuring that your files are removed promptly after retrieval.\u003C\u002Fp>\n\n\u003Cp>A user might use the Delete Files API to comply with data compliance policies. For instance, if a company processes PDF documents containing private data, they may prefer to proactively delete files as soon as possible rather than waiting for the entire pdfRest file retention period to end.\u003C\u002Fp>\n\n\u003Ch2>Delete Files with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class Delete {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\n                \"ids\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fdelete\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FDelete.java\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary libraries, such as \u003Ccode>io.github.cdimascio.dotenv.Dotenv\u003C\u002Fcode> for environment variable management, \u003Ccode>okhttp3.*\u003C\u002Fcode> for HTTP requests, and \u003Ccode>org.json.JSONObject\u003C\u002Fcode> for JSON handling.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\u003C\u002Fpre>\n\n\u003Cp>This line sets the API endpoint to the US-based service. There's an option to switch to the EU-based service for GDPR compliance by uncommenting the relevant line.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\u003C\u002Fpre>\n\n\u003Cp>The API key is specified here, which can also be set in an environment variable or a \u003Ccode>.env\u003C\u002Fcode> file. This key is essential for authenticating requests.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">RequestBody requestBody = new MultipartBody.Builder()\n    .setType(MultipartBody.FORM)\n    .addFormDataPart(\"ids\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\")\n    .build();\n\u003C\u002Fpre>\n\n\u003Cp>This snippet constructs the request body. The \u003Ccode>ids\u003C\u002Fcode> parameter contains the file IDs to be deleted, separated by commas. Each ID represents a file stored on the pdfRest platform.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Request request = new Request.Builder()\n    .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n    .url(API_URL + \"\u002Fdelete\")\n    .post(requestBody)\n    .build();\n\u003C\u002Fpre>\n\n\u003Cp>A \u003Ccode>Request\u003C\u002Fcode> object is created, specifying the API key in the header and setting the URL to the \u003Ccode>\u002Fdelete\u003C\u002Fcode> endpoint. The request body is attached using the POST method.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">OkHttpClient client = new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\nResponse response = client.newCall(request).execute();\n\u003C\u002Fpre>\n\n\u003Cp>An \u003Ccode>OkHttpClient\u003C\u002Fcode> is instantiated with a 60-second read timeout. The \u003Ccode>execute()\u003C\u002Fcode> method sends the request and receives a \u003Ccode>Response\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use Java to send a request to the pdfRest Delete Files API, allowing you to programmatically manage files on the platform. To further explore the capabilities of pdfRest, try out all the API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FDelete.java\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-10-10T18:29:03.000+00:00","2026-09-02T18:28:26.000+00:00","Learn how to instantly remove files uploaded or generated by calling the pdfRest Delete Files API with Java.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-java\u002F#article\",\n      \"headline\": \"How to Delete Files On-Demand with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-java\u002F\",\n      \"datePublished\": \"2025-10-10T18:29:03.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:09.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to instantly remove files uploaded or generated by calling the pdfRest Delete Files API with Java.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Delete Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fdelete-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fdelete API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fdelete-files\"\n        }\n      ],\n      \"keywords\": \"Delete File, Java, Security\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Delete Files On-Demand with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7932,7933,7934,7935,7936],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2025,"name":2026,"slug":2027,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-delete-files-on-demand-with-java\u002F","How to Delete Files On-Demand with Java, Tutorial | pdfRest",{"id":7941,"uuid":7942,"title":7943,"slug":7944,"html":7945,"comment_id":7941,"feature_image":48,"featured":284,"visibility":1257,"created_at":7946,"updated_at":7928,"published_at":7946,"custom_excerpt":7947,"codeinjection_head":7948,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7949,"primary_tag":7955,"url":7956,"excerpt":7947,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7957,"meta_description":7947,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"68e94d65533c9f26b943a742","fe1f5dc4-8ad6-4487-94f3-46d06ef073db","How to Delete Files On-Demand with JavaScript in NodeJS","how-to-delete-files-on-demand-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Delete Files with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fdelete-files\u002F'>Delete Files API Tool\u003C\u002Fa> is a powerful feature that allows users to remove files from the pdfRest server efficiently. By using JavaScript, developers can integrate this functionality directly into their web applications, enabling seamless file management. This tutorial will guide you through sending an API call to the Delete Files endpoint using JavaScript, demonstrating how to delete multiple files in one request.\u003C\u002Fp>\n\n\u003Cp>A user might need to delete files to maintain data privacy. For instance, a document management system could use this API to automatically remove outdated or unnecessary files from the server, ensuring that only relevant documents are stored and accessible.\u003C\u002Fp>\n\n\u003Ch2>Delete Files with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to delete multiple files at once\nvar axios = require(\"axios\");\nvar FormData = require(\"form-data\");\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append(\n  \"ids\",\n  \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n);\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: \"post\",\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: \"https:\u002F\u002Fapi.pdfrest.com\u002Fdelete\",\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", \u002F\u002F Replace with your API key\n    ...data.getHeaders(), \u002F\u002F set headers for the request\n  },\n  data: data, \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error);\n  });\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fdelete.js\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing the necessary modules, \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests and \u003Ccode>FormData\u003C\u002Fcode> for constructing form data payloads:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar FormData = require(\"form-data\");\n\u003C\u002Fpre>\n\n\u003Cp>Next, a new \u003Ccode>FormData\u003C\u002Fcode> instance is created, and the IDs of the files to be deleted are appended to it. These IDs are unique identifiers for the files stored on the server:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append(\n  \"ids\",\n  \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n);\n\u003C\u002Fpre>\n\n\u003Cp>The configuration for the \u003Ccode>axios\u003C\u002Fcode> request is defined, specifying the HTTP method as \u003Ccode>post\u003C\u002Fcode>, setting the URL to the Delete File endpoint, and including headers. The \u003Ccode>Api-Key\u003C\u002Fcode> is a required header for authentication:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: \"post\",\n  maxBodyLength: Infinity,\n  url: \"https:\u002F\u002Fapi.pdfrest.com\u002Fdelete\",\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    ...data.getHeaders(),\n  },\n  data: data,\n};\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the request is sent using \u003Ccode>axios\u003C\u002Fcode>, and the response or any errors are handled with \u003Ccode>then\u003C\u002Fcode> and \u003Ccode>catch\u003C\u002Fcode> methods:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error);\n  });\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use JavaScript to call the pdfRest Delete Files API, enabling you to delete multiple files from the server. This functionality is crucial for efficient file management and can be integrated into various applications to automate file deletion processes.\u003C\u002Fp>\n\n\u003Cp>To explore more about pdfRest's capabilities, try out all the API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on each API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. Note that this example demonstrates a multipart API call, and code samples using JSON payloads can be found \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fdelete.js\">here\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-10-10T18:16:05.000+00:00","See how to use the pdfRest Delete Files API with JavaScript to quickly delete files you’ve uploaded or created.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Delete Files On-Demand with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2025-10-10T18:16:05.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:09.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"See how to use the pdfRest Delete Files API with JavaScript to quickly delete files you’ve uploaded or created.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Delete Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fdelete-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fdelete API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fdelete-files\"\n        }\n      ],\n      \"keywords\": \"Delete File, JavaScript, Security\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Delete Files On-Demand with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7950,7951,7952,7953,7954],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2025,"name":2026,"slug":2027,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-delete-files-on-demand-with-javascript-in-nodejs\u002F","How to Delete Files On-Demand with JavaScript in NodeJS, Tutorial | pdfRest",{"id":7959,"uuid":7960,"title":7961,"slug":7962,"html":7963,"comment_id":7959,"feature_image":48,"featured":284,"visibility":1257,"created_at":7964,"updated_at":7928,"published_at":7965,"custom_excerpt":7966,"codeinjection_head":7967,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7968,"primary_tag":7974,"url":7975,"excerpt":7966,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7976,"meta_description":7966,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"68e94c4f533c9f26b943a72e","d16aa45f-47fb-42dc-b24d-58fc1c2a3fa1","How to Delete Files On-Demand with PHP","how-to-delete-files-on-demand-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Delete Files with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fdelete-files\u002F'>Delete Files API Tool\u003C\u002Fa> is a powerful feature that allows users to remove files from the pdfRest service using a simple API call. This tutorial will guide you through the process of sending an API call to the Delete Files endpoint using PHP. By leveraging the capabilities of the Guzzle HTTP client, you can efficiently manage files stored on the pdfRest platform.\u003C\u002Fp>\n\n\u003Cp>A user might use the Delete Files API to ensure that sensitive or outdated documents are removed from the pdfRest service. For example, a company that processes numerous PDF documents daily might need to delete files after processing to comply with data retention policies.\u003C\u002Fp>\n\n\u003Ch2>Delete Files with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">\nrequire 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\n$headers = [\n  'Api-Key' =--> 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'ids',\n      'contents' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n    ]\n  ]\n];\n\n$request = new Request('POST', $apiUrl.'\u002Fdelete', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the result\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fdelete.php\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by requiring the autoload file from Composer, which loads the Guzzle HTTP client. This is essential for making HTTP requests in PHP.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">require 'vendor\u002Fautoload.php';\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\u003C\u002Fpre>\n\n\u003Cp>Next, the code sets the API URL to the US-based endpoint. It also provides an option to switch to the EU-based endpoint for GDPR compliance, which can be uncommented if necessary.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\u003C\u002Fpre>\n\n\u003Cp>A new Guzzle HTTP client instance is created, which will be used to send the API request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$client = new Client();\n\u003C\u002Fpre>\n\n\u003Cp>The headers are defined to include the API key, which authenticates the request. This key should be replaced with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The options for the request include a multipart form-data body, which specifies the 'ids' of the files to be deleted. These IDs should be replaced with the actual file IDs you wish to delete.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$options = [\n  'multipart' => [\n    [\n      'name' => 'ids',\n      'contents' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n    ]\n  ]\n];\n\u003C\u002Fpre>\n\n\u003Cp>A new HTTP POST request is created with the specified endpoint and headers. The request is then sent asynchronously, and the response is awaited.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$request = new Request('POST', $apiUrl.'\u002Fdelete', $headers);\n$res = $client->sendAsync($request, $options)->wait();\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the response body is outputted, which contains the result of the delete operation.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">echo $res->getBody();\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use PHP to send an API call to the pdfRest Delete Files endpoint. This allows you to manage files stored on the pdfRest platform effectively. You are encouraged to explore all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for more detailed information.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fdelete.php\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-10-10T18:11:27.000+00:00","2025-10-10T18:11:28.000+00:00","Learn how to use the pdfRest Delete Files API with PHP to immediately delete uploaded or generated files.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-php\u002F#article\",\n      \"headline\": \"How to Delete Files On-Demand with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-php\u002F\",\n      \"datePublished\": \"2025-10-10T18:11:28.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:09.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use the pdfRest Delete Files API with PHP to immediately delete uploaded or generated files.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Delete Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fdelete-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fdelete API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fdelete-files\"\n        }\n      ],\n      \"keywords\": \"Delete File, PHP, Security\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Delete Files On-Demand with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7969,7970,7971,7972,7973],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2025,"name":2026,"slug":2027,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-delete-files-on-demand-with-php\u002F","How to Delete Files On-Demand with PHP, Tutorial | pdfRest",{"id":7978,"uuid":7979,"title":7980,"slug":7981,"html":7982,"comment_id":7978,"feature_image":48,"featured":284,"visibility":1257,"created_at":7983,"updated_at":7984,"published_at":7983,"custom_excerpt":7985,"codeinjection_head":7986,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":7987,"primary_tag":7993,"url":7994,"excerpt":7985,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":7995,"meta_description":7985,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"68e94c0a533c9f26b943a722","825f0b10-36ad-4617-b094-5f1676c078fa","How to Delete Files On-Demand with Python","how-to-delete-files-on-demand-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Delete pdfRest Resources Immediately with Python\u003C\u002Fh2>\n\n\u003Cp>Files submitted to the pdfRest Cloud API are automatically removed after the retention period for the applicable plan, which is 30 minutes for most plans. Some applications need to remove resources sooner because a workflow has completed or an internal data-handling policy calls for immediate cleanup. The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fdelete-files\u002F\">Delete Files API Tool\u003C\u002Fa> permanently deletes uploaded inputs and generated outputs on demand through the \u003Ccode>\u002Fdelete\u003C\u002Fcode> endpoint.\u003C\u002Fp>\n\n\u003Cp>On-demand deletion gives the application explicit control over the end of a resource's processing lifecycle. It should be used deliberately: once a resource is deleted, its ID cannot be used in another pdfRest call and the file cannot be recovered from pdfRest. The application must save every required output and finish all dependent operations before cleanup begins.\u003C\u002Fp>\n\n\u003Cp>For example, a Python loan-processing service can upload an application package, run OCR and extraction, save the approved results inside the lender's document system, and then delete the source PDF and intermediate resources immediately. Tracking the resource IDs created at each stage lets the service clean up the complete processing set after confirming that the final records were stored successfully.\u003C\u002Fp>\n\n\u003Cp>This example uses \u003Ccode>requests\u003C\u002Fcode> and \u003Ccode>MultipartEncoder\u003C\u002Fcode> to send two resource IDs for deletion in one call.\u003C\u002Fp>\n\n\u003Ch2>Python Delete Files Code Example\u003C\u002Fh2>\n\n\u003Cp>Install \u003Ccode>requests\u003C\u002Fcode> and \u003Ccode>requests-toolbelt\u003C\u002Fcode>, then replace the API-key and sample-ID placeholders with values from earlier API calls made with the same API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\n\ndelete_endpoint_url = api_url+'\u002Fdelete'\n\nmp_encoder_delete = MultipartEncoder(\n    fields={\n        'ids' : 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    }\n)\n\n# Let's set the headers that the delete endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_delete.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to delete endpoint...\")\nresponse = requests.post(delete_endpoint_url, data=mp_encoder_delete, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fdelete.py\">pdfRest Delete Files multipart Python sample\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Submit the Resource IDs to Delete\u003C\u002Fh2>\n\n\u003Cp>The \u003Ccode>ids\u003C\u002Fcode> field accepts a comma-separated list, allowing an application to delete several related resources in one request. These may include original uploads and outputs generated by other pdfRest tools. Each resource must belong to the API key making the delete request; an ID from another account or key cannot be removed by this call.\u003C\u002Fp>\n\n\u003Cp>Build the list from the application's tracked workflow state rather than accepting arbitrary unvalidated IDs. Deduplicate it, exclude any resource still needed by a later operation, and make the cleanup action idempotent at the application level so a retried job can recognize that a resource has already been removed.\u003C\u002Fp>\n\n\u003Cp>\u003Ccode>MultipartEncoder\u003C\u002Fcode> supplies the multipart body and boundary. The headers authenticate the request and ask for a JSON response. The sample's configurable base URL supports the US Cloud API and the EU endpoint; use the same region where the resources were created.\u003C\u002Fp>\n\n\u003Ch2>Confirm Completion Before Cleanup\u003C\u002Fh2>\n\n\u003Cp>Do not delete an input as soon as an earlier call returns if another asynchronous or chained step still references it. Wait for the required operations to finish, verify that every final output has been downloaded or stored, and only then send the cleanup request. For workflows that fail partway through, a \u003Ccode>finally\u003C\u002Fcode> block or background cleanup job can remove resources that are no longer needed while preserving enough state to avoid deleting active work.\u003C\u002Fp>\n\n\u003Cp>Check the HTTP status and response before marking an ID as deleted in the application's records. Production code should set an appropriate timeout, catch connection exceptions, and avoid logging API keys, document names, or sensitive payloads. Treat deletion as a security-relevant and irreversible operation.\u003C\u002Fp>\n\n\u003Cp>The same request can be sent as JSON when that fits the application's request model. See the official \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fdelete.py\">Delete Files JSON-payload Python sample\u003C\u002Fa>. Use \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> to inspect the request and consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fdelete-files\">Delete Files API reference\u003C\u002Fa> for the current input and response fields.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-10-10T18:10:18.000+00:00","2026-09-10T19:45:58.000+00:00","Learn how to immediately delete uploaded or generated files with the pdfRest Delete Files API using Python.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-python\u002F#article\",\n      \"headline\": \"How to Delete Files On-Demand with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-python\u002F\",\n      \"datePublished\": \"2025-10-10T18:10:18.000Z\",\n      \"dateModified\": \"2026-09-10T19:31:23.947Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to immediately delete uploaded or generated files with the pdfRest Delete Files API using Python.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Delete Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fdelete-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fdelete API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fdelete-files\"\n        }\n      ],\n      \"keywords\": \"Delete File, Python, Security\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Delete Files On-Demand with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-files-on-demand-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[7988,7989,7990,7991,7992],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2025,"name":2026,"slug":2027,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-delete-files-on-demand-with-python\u002F","How to Delete Files On-Demand with Python, Tutorial | pdfRest",{"id":7997,"uuid":7998,"title":7999,"slug":8000,"html":8001,"comment_id":7997,"feature_image":48,"featured":284,"visibility":1257,"created_at":8002,"updated_at":8003,"published_at":8002,"custom_excerpt":8004,"codeinjection_head":8005,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8006,"primary_tag":8011,"url":8012,"excerpt":8004,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8013,"meta_description":8004,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65c512be533c9f26b9436120","1b96c00b-4244-40ed-bb2b-0140be280515","How to Delete Pages from PDF Files in .NET with C#","how-to-delete-pages-from-pdf-files-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Split PDF with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F'>Split PDF API Tool\u003C\u002Fa> is a powerful resource that allows developers to programmatically extract pages PDF documents into separate files. This tutorial will guide you through the process of sending an API call to the Split PDF endpoint using C#, to delete page 4 of a given document. \u003C\u002Fp>\n\u003Cp>Splitting PDFs can be useful in various scenarios, such as when you need to distribute individual sections of a large document to different team members or when you want to extract specific pages for separate processing.\u003C\u002Fp>\n\n\u003Ch2>Split PDF with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"split-pdf\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file.pdf\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"1-3,5-last\"));\n        multipartContent.Add(byteArrayOption, \"pages[]\");\n\n        var byteArrayOption3 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"deleted_page_4\"));\n        multipartContent.Add(byteArrayOption3, \"output\");\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source code reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fsplit-pdf.cs\">pdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided code block is a C# example of how to make a multipart\u002Fform-data POST request to the pdfRest Split PDF API endpoint. Let's break down the key parts of this code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>This initializes a new instance of the HttpClient class with the base address set to the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>This line adds your API key to the request headers for authentication with the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n\u003C\u002Fpre>\n\n\u003Cp>This initializes a new instance of MultipartFormDataContent to build the multipart\u002Fform-data request body.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file.pdf\");\n\u003C\u002Fpre>\n\n\u003Cp>Here, the code reads the PDF file as a byte array, wraps it in a ByteArrayContent object, and adds it to the multipart content with the form field name \"file\".\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"1-3,5-last\"));\nmultipartContent.Add(byteArrayOption, \"pages[]\");\n\u003C\u002Fpre>\n\n\u003Cp>This snippet creates a new ByteArrayContent object with the bytes representing the string \"1-3,5-last\", which specifies the page range to include in the final document. In this case, the final document will have all the pages except page 4. The \"pages[]\" field can be repeated to specify multiple output documents having different page ranges.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption3 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"deleted_page_4\"));\nmultipartContent.Add(byteArrayOption3, \"output\");\n\u003C\u002Fpre>\n\n\u003Cp>The \"output\" field specifies the naming convention for the split files, in this case, indicating that it's a version of the document with page 4 deleted.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the tutorial above, you have learned how to use C# to send an API call to the pdfRest Split PDF endpoint. This allows you to split a PDF document into separate files programmatically. You can now demo all of the pdfRest API Tools in the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\u003C\u002Fa> and refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa> for further exploration of the capabilities offered by pdfRest.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fsplit-pdf.cs\">pdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-08T17:43:26.000+00:00","2026-09-02T18:28:27.000+00:00","Learn how to Delete Pages from PDF Files in .NET with C# by calling Split PDF API Tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Delete Pages from PDF Files in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-02-08T17:43:26.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:52.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to Delete Pages from PDF Files in .NET with C# by calling Split PDF API Tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Split PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsplit-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsplit-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Split PDF\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Delete Pages from PDF Files in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8007,8008,8009,8010],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1603,"name":1604,"slug":1605,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-delete-pages-from-pdf-files-in-net-with-c\u002F","How to Delete Pages from PDF Files in .NET with C#, Tutorial | pdfRest",{"id":8015,"uuid":8016,"title":8017,"slug":8018,"html":8019,"comment_id":8015,"feature_image":48,"featured":284,"visibility":1257,"created_at":7325,"updated_at":7326,"published_at":7326,"custom_excerpt":8020,"codeinjection_head":8021,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8022,"primary_tag":8028,"url":8029,"excerpt":8020,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8030,"meta_description":8020,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a9750cc533c9f26b943b767","5c8f44cb-2dd0-4a7a-8b95-a60ce4d4f494","How to Delete Pages from PDF Files with cURL","how-to-delete-pages-from-pdf-files-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Cp>In the following tutorial, you'll use cURL and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F\">Split PDF API Tool\u003C\u002Fa> to delete pages from PDF files. The example keeps authentication, regional routing, file transfer, and operation settings explicit so the request used to delete pages from PDF files is easy to inspect and reuse.\u003C\u002Fp>\n\n\u003Ch2>Why Delete Pages from PDF Files with cURL?\u003C\u002Fh2>\n\n\u003Cp>Scanned packets and assembled reports sometimes contain blank sheets, separator pages, or superseded content that should not appear in the final PDF. Removing those pages programmatically avoids a manual editing step.\u003C\u002Fp>\n\n\u003Cp>Suppose a six-page intake packet includes an unnecessary fourth page. The sample retains pages 1 through 3 and pages 5 through 6, producing a new PDF that omits page 4 while preserving the order of everything else.\u003C\u002Fp>\n\n\u003Cp>Split PDF describes pages to keep, not pages to destroy. Applications working with variable-length documents should calculate the retained ranges from the current page count rather than copying the sample ranges unchanged.\u003C\u002Fp>\n\n\u003Ch2>cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\ncurl -X POST \"$API_URL\u002Fsplit-pdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\" \\\n  -F \"pages[]=1-3,5,6\"\u003C\u002Fpre>\n\n\u003Cp>Source for Delete Pages from PDF: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fsplit-pdf-delete-page.sh\">View the cURL sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Choose the pdfRest service region\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>The Delete Pages from PDF example routes to the US service through the active URL, while the commented hostname provides the EU option. Keep every Delete Pages from PDF input and generated resource ID in the same region.\u003C\u002Fp>\n\n\u003Ch3>Build the authenticated multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"$API_URL\u002Fsplit-pdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\u003C\u002Fpre>\n\n\u003Cp>This POST targets the endpoint used by Delete Pages from PDF. For the Delete Pages from PDF request, \u003Ccode>Accept\u003C\u002Fcode> asks for JSON, \u003Ccode>Content-Type\u003C\u002Fcode> identifies the multipart payload, and \u003Ccode>Api-Key\u003C\u002Fcode> authenticates the call.\u003C\u002Fp>\n\n\u003Ch3>Upload the input file data\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\u003C\u002Fpre>\n\n\u003Cp>The Delete Pages from PDF request reads the local source from the path after \u003Ccode>@\u003C\u002Fcode> and sends its bytes in the multipart \u003Ccode>file\u003C\u002Fcode> field. For Delete Pages from PDF, cURL treats the path as an upload rather than ordinary form text.\u003C\u002Fp>\n\n\u003Ch3>Set the operation-specific fields\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\" \\\n  -F \"pages[]=1-3,5,6\"\u003C\u002Fpre>\n\n\u003Cp>The repeated-array field syntax \u003Ccode>pages[]\u003C\u002Fcode> carries the retained range expression. In this example, \u003Ccode>1-3,5,6\u003C\u002Fcode> excludes page 4.\u003C\u002Fp>\n\n\u003Ch3>Read the generated resource response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"$API_URL\u002Fsplit-pdf\" \\\u003C\u002Fpre>\n\n\u003Cp>A successful Delete Pages from PDF call returns JSON describing the generated resource, including its output ID and download information. Preserve the Delete Pages from PDF result needed by the next workflow step before the configured retention period expires.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial gives you a cURL pattern for producing a cleaned PDF while leaving the uploaded source unchanged.\u003C\u002Fp>\n\n\u003Cp>Keep the original until you verify the retained-page result, especially when page ranges come from user input or another service. Validate that every range is within the document and that no required page was omitted.\u003C\u002Fp>\n\n\u003Cp>Continue exploring the Delete Pages from PDF workflow in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the complete Delete Pages from PDF request contract, accepted values, defaults, and limitations, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsplit-pdf\u002F\">Split PDF API Tool documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: The Delete Pages from PDF example above uploads a file with multipart form data. For source content already stored in pdfRest, the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fsplit-pdf-delete-page.sh\">Delete Pages from PDF JSON payload example\u003C\u002Fa> shows the resource-ID request shape.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Learn how to remove unwanted PDF pages with cURL by defining the page ranges that should remain in the output document.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-curl\u002F#article\",\n      \"headline\": \"How to Delete Pages from PDF Files with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-curl\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to remove unwanted PDF pages with cURL by defining the page ranges that should remain in the output document.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Split PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsplit-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsplit-pdf\"\n        }\n      ],\n      \"keywords\": \"Pages, Split PDF, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Delete Pages from PDF Files with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8023,8024,8025,8026,8027],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1603,"name":1604,"slug":1605,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1607,"name":1608,"slug":1609,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-delete-pages-from-pdf-files-with-curl\u002F","How to Delete Pages from PDF Files with cURL, Tutorial | pdfRest",{"id":8032,"uuid":8033,"title":8034,"slug":8035,"html":8036,"comment_id":8032,"feature_image":48,"featured":284,"visibility":1257,"created_at":8037,"updated_at":8038,"published_at":7158,"custom_excerpt":8039,"codeinjection_head":8040,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8041,"primary_tag":8046,"url":8047,"excerpt":8039,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8048,"meta_description":8039,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c5d533c9f26b943b53f","9294e9af-dd36-49b7-b97e-fb6365df983d","How to Delete Pages from PDF Files with Java","how-to-delete-pages-from-pdf-files-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This step-by-step tutorial explains how a Java application can delete pages from PDF files through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F\">Split PDF API Tool\u003C\u002Fa>. The code uses Split PDF ranges to retain every required page while intentionally omitting pages that should be removed. After reviewing the example, you'll be ready to delete pages from PDF files with your own input.\u003C\u002Fp>\n\n\u003Ch2>Why Delete Pages from PDF Files with Java?\u003C\u002Fh2>\n\n\u003Cp>A scanning workflow may insert separator or blank pages that should not appear in the final case file. Defining retained ranges lets Java produce the cleaned document without editing pages locally.\u003C\u002Fp>\n\n\u003Cp>Split PDF uses each \u003Ccode>pages[]\u003C\u002Fcode> value to define an output range. The tutorial adapts the Java sample to keep pages before and after the page being removed.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class DeletePagesFromPDF {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"pages[]\", \"1-3,5-last\")\n            .addFormDataPart(\"output\", \"pdfrest_pages_deleted\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fsplit-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FSplitPDF.java\">Java sample on GitHub\u003C\u002Fa>. The linked source provides the common request pattern; the code shown here applies it to Delete Pages from PDF.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The sample combines OkHttp networking with dotenv configuration and \u003Ccode>org.json\u003C\u002Fcode> processing.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>The configuration block supports quick local testing while allowing normal callers to provide their own path and \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"pages[]\", \"1-3,5-last\")\n            .addFormDataPart(\"output\", \"pdfrest_pages_deleted\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fsplit-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\u003C\u002Fpre>\n\n\u003Cp>Split PDF uses each \u003Ccode>pages[]\u003C\u002Fcode> value to define an output range. The tutorial adapts the Java sample to keep pages before and after the page being removed. The form-data setup collects the named parts before OkHttp calculates the final multipart header and body encoding.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fsplit-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\u003C\u002Fpre>\n\n\u003Cp>The client request adds the API key header, selects the operation URL, and attaches the prepared body; changing the base constant switches between US and EU service hosts.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>The response check shows the raw outcome for learning purposes; production code can retain output IDs and branch on reported errors.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>The completed example gives you a practical Java starting point for learning how to delete pages from PDF files. With that foundation, you can use range omission to remove cover sheets, blank pages, superseded sections, or accidental scans.\u003C\u002Fp>\n\n\u003Cp>As you apply the pattern to real documents, keep in mind that the API receives ranges to keep, not a list of pages to destroy, so calculate complements carefully when page counts vary. Preserve the original PDF until the retained-page result has been verified, especially when page numbers come from user input or another service.\u003C\u002Fp>\n\n\u003Cp>Before integrating this workflow, test representative documents with the Delete Pages from PDF operation in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. Then use the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsplit-pdf\u002F\">Split PDF API Tool documentation\u003C\u002Fa> to review every available parameter and response field.\u003C\u002Fp>\n\n\u003Cp>Note: The Delete Pages from PDF example above uses multipart form data; to reuse a resource ID, review how the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FSplitPDF.java\">JSON payload example\u003C\u002Fa> constructs the request.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T17:33:17.000+00:00","2026-09-02T18:28:28.000+00:00","Delete unwanted PDF pages with Java by retaining only the required page ranges.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-java\u002F#article\",\n      \"headline\": \"How to Delete Pages from PDF Files with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:37.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:37.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Delete unwanted PDF pages with Java by retaining only the required page ranges.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Split PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsplit-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsplit-pdf\"\n        }\n      ],\n      \"keywords\": \"Java, Split PDF\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Delete Pages from PDF Files with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8042,8043,8044,8045],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1603,"name":1604,"slug":1605,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-delete-pages-from-pdf-files-with-java\u002F","Delete Pages from PDF Files with Java | pdfRest",{"id":8050,"uuid":8051,"title":8052,"slug":8053,"html":8054,"comment_id":8050,"feature_image":48,"featured":284,"visibility":1257,"created_at":8055,"updated_at":8038,"published_at":8055,"custom_excerpt":8056,"codeinjection_head":8057,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8058,"primary_tag":8063,"url":8064,"excerpt":8056,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8065,"meta_description":8056,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65cb8d3e533c9f26b94362bd","e058d70c-7a0e-44df-b8d7-4f941f9e9961","How to Delete Pages from PDF Files with JavaScript in NodeJS","how-to-delete-pages-from-pdf-files-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Delete PDF Pages with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F'>Split PDF API Tool\u003C\u002Fa> is a powerful resource that allows you to programmatically delete pages from a PDF document. This tutorial will guide you through the process of sending an API call to the Split PDF endpoint using JavaScript. \u003C\u002Fp>\n  \n\u003Cp>Imagine you have a large PDF report and you need to remove specific sections prior to distribution. Instead of manually deleting pages, you can automate the process using the Split PDF API, saving time and reducing the risk of errors.\u003C\u002Fp>\n\n\u003Cp>In this tutorial we will be using the pdfRest Split PDF API Tool to generate a new PDF file with your unwanted pages deleted from your original PDF file. We will generate a PDF with a single page deleted.\u003C\u002Fp>\n\n\u003Ch2>Delete PDF Pages with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F**\n * This request demonstrates how to split a PDF document into three files by specifying the pages that will be included in each.\n * pages[] is an optional parameter that accepts page numbers and\u002For ranges separated by commas. In addition, pages[] supports several keywords: even, odd, and last.\n *\u002F\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('pages[]', '1-5,7-last') \u002F\u002F delete page 6\ndata.append('output', 'pdfrest_split_pdf');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fsplit-pdf', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source code reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fsplit-pdf.js\">pdf-rest-api-samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided code uses the Axios library to send an HTTP POST request to the pdfRest API. Here's how it works:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\u003C\u002Fpre>\n\n\u003Cp>This snippet includes the necessary modules: Axios for HTTP requests, FormData to build the multipart\u002Fform-data payload, and fs to read the file system.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('pages[]', '1-5,7-last') \u002F\u002F delete page 6\ndata.append('output', 'pdfrest_split_pdf');\n\u003C\u002Fpre>\n\n\u003Cp>A FormData instance is created, and the PDF file along with the split parameters are appended. The 'pages[]' parameter defines how the PDF should be split. By including pages 1-5 and 7-last, page 6 is deleted from the document.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  \u002F\u002F ... other configurations ...\n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\u003C\u002Fpre>\n\n\u003Cp>The configuration object for Axios includes the API endpoint, headers with the API key, and the form data. Replace 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\u003C\u002Fpre>\n\n\u003Cp>The Axios instance sends the request and handles the response or error. The response data is logged to the console.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you've learned how to delete pages from a PDF using the pdfRest Split PDF API and JavaScript. This can be incredibly useful for a variety of applications where pages need to be removed from PDF documents.\u003C\u002Fp>\n\n\u003Cp>To explore more possibilities and to demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For a deeper understanding and more options, refer to the\u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\"> API Reference documentation\u003C\u002Fa>. \u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fsplit-pdf.js\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-13T15:39:42.000+00:00","Learn how to Delete Pages from PDF Files with JavaScript in NodeJS by calling Split PDF API Tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Delete Pages from PDF Files with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-02-13T15:39:42.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:49.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to Delete Pages from PDF Files with JavaScript in NodeJS by calling Split PDF API Tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Split PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsplit-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsplit-pdf\"\n        }\n      ],\n      \"keywords\": \"JavaScript, Split PDF\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Delete Pages from PDF Files with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8059,8060,8061,8062],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1603,"name":1604,"slug":1605,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-delete-pages-from-pdf-files-with-javascript-in-nodejs\u002F","How to Delete Pages from PDF Files with JavaScript in NodeJS, Tutorial | pdfRest",{"id":8067,"uuid":8068,"title":8069,"slug":8070,"html":8071,"comment_id":8067,"feature_image":48,"featured":284,"visibility":1257,"created_at":8072,"updated_at":8073,"published_at":8072,"custom_excerpt":8074,"codeinjection_head":8075,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8076,"primary_tag":8081,"url":8082,"excerpt":8074,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8083,"meta_description":8074,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65cb8fd1533c9f26b94362ce","bae78d9d-44e9-47a3-8af7-386c7c7051f2","How to Delete Pages from PDF Files with PHP","how-to-delete-pages-from-pdf-files-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Delete PDF Pages with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F'>Split PDF API Tool\u003C\u002Fa> is a powerful resource for developers who need to programmatically delete pages from PDF documents. This tutorial will guide you through the process of sending an API call to the Split PDF endpoint using PHP.\u003C\u002Fp> \n  \n\u003Cp>This can be useful in situations where PDF documents contain sensitive information on certain pages.\u003C\u002Fp> \n\n\u003Ch2>Delete PDF Pages with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">\nrequire 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003CContent-type header>'\n      ]\n    ],\n    [\n      'name' => 'pages[]',\n      'contents' => '1-3,5-last'\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_split_pdf'\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fsplit-pdf', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fsplit-pdf.php\">pdf-rest-api-samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided PHP code uses the Guzzle HTTP client to send a multipart POST request to the Split PDF API endpoint. Here's a breakdown of the key components:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\u003C\u002Fpre>\n\n\u003Cp>This snippet loads the required classes from the Guzzle library and sets up the necessary namespaces.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The API key is passed in the headers for authentication purposes.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$options = [\n  'multipart' => [\n    \u002F\u002F ...multipart form data...\n  ]\n];\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>$options\u003C\u002Fcode> array contains the multipart form data, including the file to split and the splitting criteria. In this example, a single \u003Ccode>pages[]\u003C\u002Fcode> parameter is submitted with a page range value that encompasses all pages except for page 4.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fsplit-pdf', $headers);\n\u003C\u002Fpre>\n\n\u003Cp>A new POST request is created with the API endpoint and the headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$res = $client->sendAsync($request, $options)->wait();\necho $res->getBody();\n\u003C\u002Fpre>\n\n\u003Cp>The request is sent asynchronously, and the response is printed. The response includes the output document's ID and a download link. The result is a single document that includes all but the fourth page from the original file.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you've learned how to delete PDF pages using the pdfRest API and PHP. You can now apply this knowledge to delete pages with your own PHP applications. We encourage you to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\"> API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for further exploration.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fsplit-pdf.php\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-13T15:50:41.000+00:00","2026-09-02T18:28:29.000+00:00","Learn how to Delete Pages from PDF Files with PHP by calling Split PDF API Tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-php\u002F#article\",\n      \"headline\": \"How to Delete Pages from PDF Files with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-php\u002F\",\n      \"datePublished\": \"2024-02-13T15:50:41.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:49.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to Delete Pages from PDF Files with PHP by calling Split PDF API Tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Split PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsplit-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsplit-pdf\"\n        }\n      ],\n      \"keywords\": \"PHP, Split PDF\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Delete Pages from PDF Files with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8077,8078,8079,8080],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1603,"name":1604,"slug":1605,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-delete-pages-from-pdf-files-with-php\u002F","How to Delete Pages from PDF Files with PHP, Tutorial | pdfRest",{"id":8085,"uuid":8086,"title":8087,"slug":8088,"html":8089,"comment_id":8085,"feature_image":48,"featured":284,"visibility":1257,"created_at":8090,"updated_at":8073,"published_at":8090,"custom_excerpt":8091,"codeinjection_head":8092,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8093,"primary_tag":8098,"url":8099,"excerpt":8091,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8100,"meta_description":8091,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65cb9148533c9f26b94362dc","3ba67ce7-9efb-4549-8b18-073cfb3212b8","How to Delete Pages from PDF Files with Python","how-to-delete-pages-from-pdf-files-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Delete PDF Pages with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F'>Split PDF API Tool\u003C\u002Fa> is a powerful resource for developers who need to programmatically delete pages from PDF documents. This could be useful in a variety of scenarios, including removing sensitive content from reports. \u003C\u002Fp>\n\u003Cp>By using Python, a widely-used programming language, developers can easily integrate this functionality into their applications or workflows.\u003C\u002Fp>\n\n\u003Ch2>Delete PDF Pages with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nsplit_pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fsplit-pdf'\n\n# The \u002Fsplit-pdf endpoint can take one PDF file or id as input.\n# This sample takes one PDF file that has at least 5 pages and splits it into two documents when given two page ranges.\n\n# Create a list of tuples for data that will be sent to the request\nsplit_request_data = []\nsplit_request_data.append(('file',('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf')))\nsplit_request_data.append(('pages', '1-3,5-last'))\nsplit_request_data.append(('output', 'example_splitPdf_out'))\n\nmp_encoder_splitPdf = MultipartEncoder(\n    fields=split_request_data\n)\n\n# Let's set the headers that the split-pdf endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_splitPdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to split-pdf endpoint...\")\nresponse = requests.post(split_pdf_endpoint_url, data=mp_encoder_splitPdf, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>This code is sourced from the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fsplit-pdf.py\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code above demonstrates how to use the pdfRest Split PDF API tool with Python. Let's break down the key parts:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">split_request_data.append(('file',('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf')))\n\u003C\u002Fpre>\n\n\u003Cp>This line appends a tuple to the request data list, containing the file to be split. The file is opened in binary read mode ('rb') and is specified to be of 'application\u002Fpdf' MIME type.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">split_request_data.append(('pages', '1-3,5-last'))\n\u003C\u002Fpre>\n\n\u003Cp>This line appends page ranges to the request data list. The API will split the PDF into a single document containing all pages except page 4, which has the effect of deleting page 4.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">split_request_data.append(('output', 'example_splitPdf_out'))\n\u003C\u002Fpre>\n\n\u003Cp>This line specifies the base name for the output files that will be generated by the split operation.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_splitPdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\n\u003C\u002Fpre>\n\n\u003Cp>The headers include the 'Accept' header, which indicates that the client expects a JSON response. The 'Content-Type' is set automatically by the MultipartEncoder. The 'Api-Key' should be replaced with your actual API key from pdfRest.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(split_pdf_endpoint_url, data=mp_encoder_splitPdf, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This sends a POST request to the split-pdf endpoint with the encoded data and headers. The response is then checked for success and printed out.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you've learned how to send an API call to the pdfRest Split PDF tool using Python. This allows you to automate the process for deleting pages from a PDF and could be integrated into larger systems for document management or processing.\u003C\u002Fp>\n\n\u003Cp>To further explore the capabilities of pdfRest API Tools, you can demo all of them in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">the API Lab\u003C\u002Fa>. For more detailed information, visit the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note that this is an example of a multipart API call. Code samples using JSON payloads for the same operation can be found in our \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fsplit-pdf.py\">GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-13T15:56:56.000+00:00","Learn how to Delete Pages from PDF Files with Python by calling Split PDF API Tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-python\u002F#article\",\n      \"headline\": \"How to Delete Pages from PDF Files with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-python\u002F\",\n      \"datePublished\": \"2024-02-13T15:56:56.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:49.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to Delete Pages from PDF Files with Python by calling Split PDF API Tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Split PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsplit-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsplit-pdf\"\n        }\n      ],\n      \"keywords\": \"Python, Split PDF\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Delete Pages from PDF Files with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-delete-pages-from-pdf-files-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8094,8095,8096,8097],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1603,"name":1604,"slug":1605,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-delete-pages-from-pdf-files-with-python\u002F","How to Delete Pages from PDF Files with Python, Tutorial | pdfRest",{"id":8102,"uuid":8103,"title":8104,"slug":8105,"html":8106,"comment_id":8102,"feature_image":48,"featured":284,"visibility":1257,"created_at":8107,"updated_at":8108,"published_at":8107,"custom_excerpt":8109,"codeinjection_head":8110,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8111,"primary_tag":8118,"url":8119,"excerpt":8109,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8120,"meta_description":8109,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"687a75c7533c9f26b9439e3e","0bf6f29d-4710-4734-af78-e4c38aacecb5","How to Digitally Sign PDF Files in .NET with C#","how-to-digitally-sign-pdf-files-in-net-with-c-code","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Digitally Sign PDFs with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsign-pdf\u002F'>Sign PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to programmatically sign PDF documents. This tutorial will guide you through the process of sending an API call to the Sign PDF endpoint using C#. By leveraging this tool, you can automate the signing process, ensuring that your PDFs are authenticated and secure.\u003C\u002Fp>\n\n\u003Cp>A business might need to sign multiple documents daily, such as contracts or agreements. Using the Sign PDF tool, a developer can integrate this functionality into their application, allowing for seamless and automated document signing, reducing manual effort and increasing efficiency.\u003C\u002Fp>\n\n\u003Ch2>Sign PDF with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using Newtonsoft.Json;\nusing Newtonsoft.Json.Linq;\nusing System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"signed-pdf\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var inputByteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Finput.pdf\");\n        var inputByteArrayContent = new ByteArrayContent(inputByteArray);\n        multipartContent.Add(inputByteArrayContent, \"file\", \"input.pdf\");\n        inputByteArrayContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var credByteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Fcredentials.pfx\");\n        var credByteArrayContent = new ByteArrayContent(credByteArray);\n        multipartContent.Add(credByteArrayContent, \"pfx_credential_file\", \"credentials.pfx\");\n        credByteArrayContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fx-pkcs12\");\n\n        var passphraseByteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Fpassphrase.txt\");\n        var passphraseByteArrayContent = new ByteArrayContent(passphraseByteArray);\n        multipartContent.Add(passphraseByteArrayContent, \"pfx_passphrase_file\", \"passphrase.txt\");\n        passphraseByteArrayContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"text\u002Fplain\");\n\n        var logoByteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Flogo.jpg\");\n        var logoByteArrayContent = new ByteArrayContent(logoByteArray);\n        multipartContent.Add(logoByteArrayContent, \"logo_file\", \"logo.jpg\");\n        logoByteArrayContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"image\u002Fjpeg\");\n\n        var signatureConfiguration = new JObject\n        {\n            [\"type\"] = \"new\",\n            [\"name\"] = \"esignature\",\n            [\"logo_opacity\"] = \"0.5\",\n            [\"location\"] = new JObject\n            {\n                [\"bottom_left\"] = new JObject\n                {\n                    [\"x\"] = \"0\",\n                    [\"y\"] = \"0\"\n                },\n                [\"top_right\"] = new JObject\n                {\n                    [\"x\"] = \"216\",\n                    [\"y\"] = \"72\"\n                },\n                [\"page\"] = \"1\"\n            },\n            [\"display\"] = new JObject\n            {\n                [\"include_distinguished_name\"] = \"true\",\n                [\"include_datetime\"] = \"true\",\n                [\"contact\"] = \"My contact information\",\n                [\"location\"] = \"My signing location\",\n                [\"name\"] = \"John Doe\",\n                [\"reason\"] = \"My reason for signing\"\n            }\n        };\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(signatureConfiguration.ToString(Formatting.None)));\n        multipartContent.Add(byteArrayOption, \"signature_configuration\");\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fsigned-pdf.cs\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by setting up an \u003Ccode>HttpClient\u003C\u002Fcode> with a base address pointing to the pdfRest API. It then creates a \u003Ccode>HttpRequestMessage\u003C\u002Fcode> for a POST request to the \"signed-pdf\" endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>This line adds the API key to the request headers, which is necessary for authentication.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var inputByteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Finput.pdf\");\n\u003C\u002Fpre>\n\n\u003Cp>The input PDF file is read into a byte array and added to the multipart form data. The content type is set to \"application\u002Fpdf\".\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var credByteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Fcredentials.pfx\");\n\u003C\u002Fpre>\n\n\u003Cp>Similarly, the PFX credential file is read and added to the form data, with the content type \"application\u002Fx-pkcs12\". This file is used for signing the PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var passphraseByteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Fpassphrase.txt\");\n\u003C\u002Fpre>\n\n\u003Cp>The passphrase for the PFX file is read and added to the form data, with the content type \"text\u002Fplain\".\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var logoByteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Flogo.jpg\");\n\u003C\u002Fpre>\n\n\u003Cp>An optional logo file is added for the signature's visual representation, with the content type \"image\u002Fjpeg\".\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var signatureConfiguration = new JObject\n\u003C\u002Fpre>\n\n\u003Cp>This JSON object defines the signature configuration, including its type, display settings, and location on the page. The \u003Ccode>location\u003C\u002Fcode> object specifies the coordinates and page number for the signature.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to send an API call to the pdfRest Sign PDF endpoint using C#. This allows you to automate the process of signing PDF documents programmatically. To further explore pdfRest API tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for more detailed information.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found on \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fsigned-pdf.cs\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-07-18T16:26:47.000+00:00","2026-09-02T18:28:30.000+00:00","Learn how to use pdfRest's Sign PDF API Tool with C# to digitally sign PDF files.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-in-net-with-c-code\u002F#article\",\n      \"headline\": \"How to Digitally Sign PDF Files in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-in-net-with-c-code\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-in-net-with-c-code\u002F\",\n      \"datePublished\": \"2025-07-18T16:26:47.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:12.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest's Sign PDF API Tool with C# to digitally sign PDF files.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Sign PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsign-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsigned-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsign-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Digital Signature, Security, Sign PDF\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Digitally Sign PDF Files in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-in-net-with-c-code\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8112,8113,8114,8115,8116,8117],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2017,"name":2018,"slug":2019,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2021,"name":2022,"slug":2023,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-digitally-sign-pdf-files-in-net-with-c-code\u002F","How to Digitally Sign PDF Files in .NET with C# , Tutorial | pdfRest",{"id":8122,"uuid":8123,"title":8124,"slug":8125,"html":8126,"comment_id":8122,"feature_image":48,"featured":284,"visibility":1257,"created_at":8127,"updated_at":8128,"published_at":8127,"custom_excerpt":8129,"codeinjection_head":8130,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8131,"primary_tag":8138,"url":8139,"excerpt":8129,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8140,"meta_description":8129,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"687a77ba533c9f26b9439e55","ca60e115-7aaa-4adc-ad41-0c3017901e40","How to Digitally Sign PDF Files with cURL","how-to-digitally-sign-pdf-files-with-curl-code","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Digitally Sign PDFs with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsign-pdf\u002F'>Sign PDF API Tool\u003C\u002Fa> is a powerful resource that allows users to digitally sign PDF documents programmatically. This tutorial will guide you through the process of sending an API call to the Sign PDF endpoint using cURL, a command-line tool for transferring data with URLs. By leveraging cURL, users can automate the signing process, integrate it into scripts, and handle multiple files efficiently.\u003C\u002Fp>\n\n\u003Cp>Businesses and individuals often need to sign PDF documents for contracts, agreements, or official communications. For instance, a company might need to sign hundreds of contracts with clients or partners. Automating this process with the Sign PDF API can save time and reduce errors, ensuring that all documents are signed consistently and securely.\u003C\u002Fp>\n\n\u003Ch2>Sign PDF with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">SIGNATURE_CONFIG='{\"type\": \"new\",\"name\": \"esignature\",\"logo_opacity\": \"0.25\",\"location\": {\"bottom_left\": { \"x\": \"0\", \"y\": \"0\" },\"top_right\": { \"x\": \"216\", \"y\": \"72\" },\"page\": 1},\"display\": {\"include_distinguished_name\": \"true\",\"include_datetime\": \"true\",\"contact\": \"My contact info\",\"location\": \"My location\",\"name\": \"John Doe\",\"reason\": \"My reason for signing\"}}'\n\ncurl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fsigned-pdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"pfx_credential_file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"pfx_passphrase_file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"logo_file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"signature_configuration=$SIGNATURE_CONFIG\" \\\n  -F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fsigned-pdf.sh\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by defining a \u003Ccode>SIGNATURE_CONFIG\u003C\u002Fcode> variable, which is a JSON string specifying the signature's properties. It includes details such as the signature type, name, logo opacity, location on the page, and display options like the signer's name and reason for signing.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">SIGNATURE_CONFIG='{\"type\": \"new\",\"name\": \"esignature\",\"logo_opacity\": \"0.25\",\"location\": {\"bottom_left\": { \"x\": \"0\", \"y\": \"0\" },\"top_right\": { \"x\": \"216\", \"y\": \"72\" },\"page\": 1},\"display\": {\"include_distinguished_name\": \"true\",\"include_datetime\": \"true\",\"contact\": \"My contact info\",\"location\": \"My location\",\"name\": \"John Doe\",\"reason\": \"My reason for signing\"}}'\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>curl\u003C\u002Fcode> command is used to make a POST request to the \u003Ccode>https:\u002F\u002Fapi.pdfrest.com\u002Fsigned-pdf\u003C\u002Fcode> endpoint. The \u003Ccode>-X POST\u003C\u002Fcode> option specifies the HTTP method, while the \u003Ccode>-H\u003C\u002Fcode> flags set the request headers. The \u003Ccode>Accept\u003C\u002Fcode> header indicates that the response should be in JSON format, and the \u003Ccode>Content-Type\u003C\u002Fcode> header specifies that the request body is multipart\u002Fform-data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fsigned-pdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>-F\u003C\u002Fcode> flags are used to specify the form data being sent in the request. Each \u003Ccode>-F\u003C\u002Fcode> option corresponds to a different part of the request:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Ccode>file=@\u002Fpath\u002Fto\u002Ffile\u003C\u002Fcode>: The PDF file to be signed.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>pfx_credential_file=@\u002Fpath\u002Fto\u002Ffile\u003C\u002Fcode>: The PFX credential file for signing.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>pfx_passphrase_file=@\u002Fpath\u002Fto\u002Ffile\u003C\u002Fcode>: The passphrase for the PFX file.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>logo_file=@\u002Fpath\u002Fto\u002Ffile\u003C\u002Fcode>: The logo file to be used in the signature.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>signature_configuration=$SIGNATURE_CONFIG\u003C\u002Fcode>: The signature configuration JSON defined earlier.\u003C\u002Fli>\n  \u003Cli>\u003Ccode>output=example_out\u003C\u002Fcode>: The name of the output file.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use cURL to send a request to the pdfRest Sign PDF API, allowing you to digitally sign PDF documents programmatically. This process can be integrated into larger workflows to automate document signing.\u003C\u002Fp>\n\n\u003Cp>To explore more, try out all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. Additionally, note that this example uses a multipart API call, and code samples using JSON payloads can be found \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fsigned-pdf.sh\">here\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-07-18T16:35:06.000+00:00","2026-09-02T18:28:31.000+00:00","Learn how to apply digital signatures to PDF files using cURL with pdfRest's Sign PDF API Tool.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-curl-code\u002F#article\",\n      \"headline\": \"How to Digitally Sign PDF Files with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-curl-code\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-curl-code\u002F\",\n      \"datePublished\": \"2025-07-18T16:35:06.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:12.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to apply digital signatures to PDF files using cURL with pdfRest's Sign PDF API Tool.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Sign PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsign-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsigned-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsign-pdf\"\n        }\n      ],\n      \"keywords\": \"Digital Signature, Security, Sign PDF, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Digitally Sign PDF Files with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-curl-code\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8132,8133,8134,8135,8136,8137],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2017,"name":2018,"slug":2019,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2021,"name":2022,"slug":2023,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-digitally-sign-pdf-files-with-curl-code\u002F","How to Digitally Sign PDF Files with cURL, Tutorial | pdfRest",{"id":8142,"uuid":8143,"title":8144,"slug":8145,"html":8146,"comment_id":8142,"feature_image":48,"featured":284,"visibility":1257,"created_at":8147,"updated_at":8148,"published_at":8147,"custom_excerpt":8149,"codeinjection_head":8150,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8151,"primary_tag":8158,"url":8159,"excerpt":8149,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8160,"meta_description":8149,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"687a77dd533c9f26b9439e5f","04a4e3fa-dbae-40e6-a66f-314d6ac8cbc1","How to Digitally Sign PDF Files with Java","how-to-digitally-sign-pdf-files-with-java-code","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Digitally Sign PDFs with Java?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsign-pdf\u002F'>Sign PDF API Tool\u003C\u002Fa> provides a convenient way to digitally sign PDF documents programmatically. This tutorial will guide you through the process of sending an API call to the Sign PDF endpoint using Java. By leveraging this tool, developers can automate the signing of PDF documents, ensuring authenticity and integrity.\u003C\u002Fp>\n\n\u003Cp>A business might use the Sign PDF API to streamline its document signing process. For example, a company could automatically sign contracts, invoices, or other legal documents before sending them to clients. This not only saves time but also reduces the risk of human error in the signing process.\u003C\u002Fp>\n\n\u003Ch2>Sign PDF with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">\nimport io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class SignedPDF {\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile, credentialFile, passphraseFile, logoFile;\n    if (args.length > 3) {\n      inputFile = new File(args[0]);\n      credentialFile = new File(args[1]);\n      passphraseFile = new File(args[2]);\n      logoFile = new File(args[3]);\n    } else {\n      inputFile = new File(\"\u002Fpath\u002Fto\u002Finput.pdf\");\n      credentialFile = new File(\"\u002Fpath\u002Fto\u002Fcredentials.pfx\");\n      passphraseFile = new File(\"\u002Fpath\u002Fto\u002Fpassphrase.txt\");\n      logoFile = new File(\"\u002Fpath\u002Fto\u002Flogo.png\");\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    JSONObject bottomLeft = new JSONObject();\n    bottomLeft.put(\"x\", \"0\");\n    bottomLeft.put(\"y\", \"0\");\n\n    JSONObject topRight = new JSONObject();\n    topRight.put(\"x\", \"216\");\n    topRight.put(\"y\", \"72\");\n\n    JSONObject location = new JSONObject();\n    location.put(\"bottom_left\", bottomLeft);\n    location.put(\"top_right\", topRight);\n    location.put(\"page\", \"1\");\n\n    JSONObject display = new JSONObject();\n    display.put(\"include_distinguished_name\", \"true\");\n    display.put(\"include_datetime\", \"true\");\n    display.put(\"contact\", \"My contact information\");\n    display.put(\"location\", \"My signing location\");\n    display.put(\"name\", \"John Doe\");\n    display.put(\"reason\", \"My reason for signing\");\n\n    JSONObject signatureConfig = new JSONObject();\n    signatureConfig.put(\"type\", \"new\");\n    signatureConfig.put(\"name\", \"esignature\");\n    signatureConfig.put(\"logo_opacity\", \"0.5\");\n    signatureConfig.put(\"location\", location);\n    signatureConfig.put(\"display\", display);\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    final RequestBody credentialFileRequestBody =\n        RequestBody.create(credentialFile, MediaType.parse(\"application\u002Fx-pkcs12\"));\n    final RequestBody passphraseFileRequestBody =\n        RequestBody.create(passphraseFile, MediaType.parse(\"text\u002Fplain\"));\n    final RequestBody logoFileRequestBody =\n        RequestBody.create(logoFile, MediaType.parse(\"image\u002Fpng\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\n                \"pfx_credential_file\", credentialFile.getName(), credentialFileRequestBody)\n            .addFormDataPart(\n                \"pfx_passphrase_file\", passphraseFile.getName(), passphraseFileRequestBody)\n            .addFormDataPart(\"logo_file\", logoFile.getName(), logoFileRequestBody)\n            .addFormDataPart(\"signature_configuration\", signatureConfig.toString())\n            .addFormDataPart(\"output\", \"example_out.pdf\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fsigned-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FSignedPDF.java\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The Java code begins by importing necessary libraries and setting up environment variables. The \u003Ccode>DEFAULT_API_KEY\u003C\u002Fcode> is defined for authentication purposes. The \u003Ccode>main\u003C\u002Fcode> method handles input files, which include the PDF to be signed, the credential file, the passphrase file, and a logo file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">\nFile inputFile, credentialFile, passphraseFile, logoFile;\nif (args.length > 3) {\n  inputFile = new File(args[0]);\n  credentialFile = new File(args[1]);\n  passphraseFile = new File(args[2]);\n  logoFile = new File(args[3]);\n} else {\n  inputFile = new File(\"\u002Fpath\u002Fto\u002Finput.pdf\");\n  credentialFile = new File(\"\u002Fpath\u002Fto\u002Fcredentials.pfx\");\n  passphraseFile = new File(\"\u002Fpath\u002Fto\u002Fpassphrase.txt\");\n  logoFile = new File(\"\u002Fpath\u002Fto\u002Flogo.png\");\n}\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>Dotenv\u003C\u002Fcode> library is used to load environment variables, which include the API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">\nfinal Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\u003C\u002Fpre>\n\n\u003Cp>Next, JSON objects are created to define the signature's location and display settings on the PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">\nJSONObject bottomLeft = new JSONObject();\nbottomLeft.put(\"x\", \"0\");\nbottomLeft.put(\"y\", \"0\");\n\nJSONObject topRight = new JSONObject();\ntopRight.put(\"x\", \"216\");\ntopRight.put(\"y\", \"72\");\n\nJSONObject location = new JSONObject();\nlocation.put(\"bottom_left\", bottomLeft);\nlocation.put(\"top_right\", topRight);\nlocation.put(\"page\", \"1\");\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>RequestBody\u003C\u002Fcode> objects are created for each file, specifying the media type. These are then added to a \u003Ccode>MultipartBody\u003C\u002Fcode> for the API request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">\nRequestBody requestBody =\n    new MultipartBody.Builder()\n        .setType(MultipartBody.FORM)\n        .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n        .addFormDataPart(\n            \"pfx_credential_file\", credentialFile.getName(), credentialFileRequestBody)\n        .addFormDataPart(\n            \"pfx_passphrase_file\", passphraseFile.getName(), passphraseFileRequestBody)\n        .addFormDataPart(\"logo_file\", logoFile.getName(), logoFileRequestBody)\n        .addFormDataPart(\"signature_configuration\", signatureConfig.toString())\n        .addFormDataPart(\"output\", \"example_out.pdf\")\n        .build();\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>Request\u003C\u002Fcode> object is configured with the API key and the URL for the Sign PDF endpoint. The \u003Ccode>OkHttpClient\u003C\u002Fcode> is used to execute the request, and the response is printed.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">\nRequest request =\n    new Request.Builder()\n        .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n        .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fsigned-pdf\")\n        .post(requestBody)\n        .build();\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to send an API request to the pdfRest Sign PDF endpoint using Java. This example demonstrates how to automate the signing of PDF documents, which can be a valuable tool in various business applications.\u003C\u002Fp>\n\n\u003Cp>To explore more, try out all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed documentation, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FSignedPDF.java\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-07-18T16:35:41.000+00:00","2026-09-02T18:28:32.000+00:00","Learn how to apply digital signatures to PDF files with Java using pdfRest's Sign PDF API Tool.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-java-code\u002F#article\",\n      \"headline\": \"How to Digitally Sign PDF Files with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-java-code\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-java-code\u002F\",\n      \"datePublished\": \"2025-07-18T16:35:41.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:11.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to apply digital signatures to PDF files with Java using pdfRest's Sign PDF API Tool.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Sign PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsign-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsigned-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsign-pdf\"\n        }\n      ],\n      \"keywords\": \"Digital Signature, Java, Security, Sign PDF\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Digitally Sign PDF Files with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-java-code\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8152,8153,8154,8155,8156,8157],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2017,"name":2018,"slug":2019,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2021,"name":2022,"slug":2023,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-digitally-sign-pdf-files-with-java-code\u002F","How to Digitally Sign PDF Files with Java, Tutorial | pdfRest",{"id":8162,"uuid":8163,"title":8164,"slug":8165,"html":8166,"comment_id":8162,"feature_image":48,"featured":284,"visibility":1257,"created_at":8167,"updated_at":8148,"published_at":8167,"custom_excerpt":8168,"codeinjection_head":8169,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8170,"primary_tag":8177,"url":8178,"excerpt":8168,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8179,"meta_description":8168,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"687a765b533c9f26b9439e48","e5ed4778-178b-4530-83ea-b233d287897c","How to Digitally Sign PDF Files with JavaScript in NodeJS","how-to-digitally-sign-pdf-files-with-javascript-code-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Digitally Sign PDFs with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsign-pdf\u002F'>Sign PDF API Tool\u003C\u002Fa> is an efficient solution for digitally signing PDF documents using JavaScript. This tutorial will guide you through the process of sending an API call to the Sign PDF endpoint using JavaScript. By leveraging this tool, you can automate the process of applying digital signatures to your PDF files, ensuring authenticity and integrity.\u003C\u002Fp>\n\n\u003Cp>An example of using the Sign PDF tool might involve a company that needs to sign contracts or official documents digitally. By using this API, they can streamline their workflow, reduce the need for manual signatures, and maintain a secure and verifiable record of signed documents. This is particularly useful for businesses that manage a large volume of documents and require a reliable method of authentication.\u003C\u002Fp>\n\n\u003Ch2>Sign PDF with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F**\n * This request demonstrates how to apply a digital signature to a PDF using PFX credentials.\n *\u002F\nvar axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\ndata.append(\"pfx_credential_file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Fcredentials.pfx\"));\ndata.append(\"pfx_passphrase_file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Fpassphrase.txt\"));\ndata.append(\"logo_file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Flogo.png\"));\nconst signature_config = {\n    type: \"new\",\n    name: \"esignature\",\n    logo_opacity: \"0.5\",\n    location: {\n        bottom_left: { x: \"0\", y: \"0\" },\n        top_right: { x: \"216\", y: \"72\" },\n        page: 1\n    },\n    display: {\n        include_distinguished_name: \"true\",\n        include_datetime: \"true\",\n        contact: \"My contact information\",\n        location: \"My signing location\",\n        name: \"John Doe\",\n        reason: \"My reason for signing\"\n    }\n};\ndata.append(\"signature_configuration\", JSON.stringify(signature_config));\ndata.append(\"output\", \"example_out\");\n\nvar signed_pdf_config = {\n    method: \"post\",\n    maxBodyLength: Infinity,\n    url: \"https:\u002F\u002Fapi.pdfrest.com\u002Fsigned-pdf\",\n    headers: {\n        \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", \u002F\u002F Replace with your API key\n        ...data.getHeaders(), \u002F\u002F set headers for the request\n    },\n    data: data,\n};\n\n\u002F\u002F send request and handle response or error\naxios(signed_pdf_config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error);\n  });\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fsigned-pdf.js\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary modules: \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests, \u003Ccode>form-data\u003C\u002Fcode> for handling form submissions, and \u003Ccode>fs\u003C\u002Fcode> for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\n\u003C\u002Fpre>\n\n\u003Cp>This snippet creates a new \u003Ccode>FormData\u003C\u002Fcode> instance and appends the PDF file to be signed. The path to the file is specified using \u003Ccode>fs.createReadStream()\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">data.append(\"pfx_credential_file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Fcredentials.pfx\"));\ndata.append(\"pfx_passphrase_file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Fpassphrase.txt\"));\n\u003C\u002Fpre>\n\n\u003Cp>These lines append the PFX credential file and passphrase file, which are necessary for the digital signature process. The PFX file contains the certificate and private key, while the passphrase file secures it.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">const signature_config = {\n    type: \"new\",\n    name: \"esignature\",\n    ...\n};\ndata.append(\"signature_configuration\", JSON.stringify(signature_config));\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>signature_config\u003C\u002Fcode> object defines the signature's appearance and placement. It includes parameters like \u003Ccode>type\u003C\u002Fcode>, \u003Ccode>name\u003C\u002Fcode>, \u003Ccode>logo_opacity\u003C\u002Fcode>, and \u003Ccode>location\u003C\u002Fcode>. This configuration is converted to a JSON string and appended to the form data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var signed_pdf_config = {\n    method: \"post\",\n    ...\n    url: \"https:\u002F\u002Fapi.pdfrest.com\u002Fsigned-pdf\",\n    headers: { \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", ...data.getHeaders() },\n    data: data,\n};\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>signed_pdf_config\u003C\u002Fcode> object sets up the API request, specifying the HTTP method, URL, headers (including the API key), and the form data. Ensure to replace \u003Ccode>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\u003C\u002Fcode> with your actual API key.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to apply a digital signature to a PDF using the pdfRest Sign PDF API Tool with JavaScript. This process involves setting up the necessary files and configurations, and sending an API request to the pdfRest endpoint.\u003C\u002Fp>\n\n\u003Cp>To explore more, try demoing all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further details, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. Note that this is an example of a multipart API call, and code samples using JSON payloads can be found \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fsigned-pdf.js\">here\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-07-18T16:29:15.000+00:00","Learn how to use pdfRest's Sign PDF API Tool with JavaScript to digitally sign PDF files.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-javascript-code-in-nodejs\u002F#article\",\n      \"headline\": \"How to Digitally Sign PDF Files with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-javascript-code-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-javascript-code-in-nodejs\u002F\",\n      \"datePublished\": \"2025-07-18T16:29:15.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:12.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest's Sign PDF API Tool with JavaScript to digitally sign PDF files.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Sign PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsign-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsigned-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsign-pdf\"\n        }\n      ],\n      \"keywords\": \"Digital Signature, JavaScript, Security, Sign PDF\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Digitally Sign PDF Files with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-javascript-code-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8171,8172,8173,8174,8175,8176],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2017,"name":2018,"slug":2019,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2021,"name":2022,"slug":2023,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-digitally-sign-pdf-files-with-javascript-code-in-nodejs\u002F","How to Digitally Sign PDF Files with JavaScript in NodeJS, Tutorial | pdfRest",{"id":8181,"uuid":8182,"title":8183,"slug":8184,"html":8185,"comment_id":8181,"feature_image":48,"featured":284,"visibility":1257,"created_at":8186,"updated_at":8187,"published_at":8186,"custom_excerpt":8188,"codeinjection_head":8189,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8190,"primary_tag":8197,"url":8198,"excerpt":8188,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8199,"meta_description":8188,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"687a74cc533c9f26b9439e34","d0d3da53-fca1-4fe5-99fc-189283d1d07b","How to Digitally Sign PDF Files with PHP","how-to-digitally-sign-pdf-files-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Digitally Sign PDFs with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsign-pdf\u002F'>Sign PDF API Tool\u003C\u002Fa> is a powerful solution for digitally signing PDF documents programmatically. This tutorial will guide you on how to use PHP to send an API call to the Sign PDF endpoint, enabling you to automate the process of adding digital signatures to your PDFs. By leveraging the pdfRest API, you can integrate PDF signing capabilities into your PHP applications, ensuring that your documents are authenticated and secure.\u003C\u002Fp>\n\n\u003Cp>A business might need to send out contracts or agreements that require digital signatures. Using the Sign PDF API, a company can automate the process of signing these documents, saving time and reducing the risk of human error. For example, a legal firm could use this API to automatically sign and send legal documents to clients, ensuring that all signatures are verified and legally binding.\u003C\u002Fp>\n\n\u003Ch2>Sign PDF with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">\nrequire 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\n$headers = [\n  'Api-Key' =--> 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => 'filename.pdf', \u002F\u002F Set the filename for the file to be processed, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => 'application\u002Fpdf' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'pfx_credential_file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => 'filename.pfx', \u002F\u002F Set the filename for the file to be processed, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => 'application\u002Fx-pkcs12' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'pfx_passphrase_file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => 'filename.txt', \u002F\u002F Set the filename for the file to be processed, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => 'text\u002Fplain' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'logo_file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => 'filename.png', \u002F\u002F Set the filename for the file to be processed, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => 'image\u002Fpng' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'signature_configuration', \u002F\u002F Specify the field name for the digital signature config.\n      'contents' => '{\"type\":\"new\",\"name\":\"esignature\",\"logo_opacity\":\"0.25\",\"location\":{\"bottom_left\":{ \"x\":\"0\", \"y\":\"0\" },\"top_right\":{ \"x\":\"216\", \"y\":\"72\" },\"page\":1},\"display\":{\"include_distinguished_name\":\"true\",\"include_datetime\":\"true\",\"contact\":\"My contact info\",\"location\":\"My location\",\"name\":\"John Doe\",\"reason\":\"My reason for signing\"}}' \u002F\u002F Set the value for the signature configuration. This is a JSON-formatted string.\n    ],\n    [\n      'name' => 'output', \u002F\u002F Specify the field name for the output option.\n      'contents' => 'pdfrest_signed_pdf' \u002F\u002F Set the value for the output option (in this case, 'pdfrest_signed_pdf').\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fsigned-pdf', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the signed PDF.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fsigned-pdf.php\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by requiring the autoload file to load the Guzzle HTTP client, which is necessary for making HTTP requests in PHP. The \u003Ccode>Client\u003C\u002Fcode>, \u003Ccode>Request\u003C\u002Fcode>, and \u003Ccode>Utils\u003C\u002Fcode> classes from the Guzzle library are imported to facilitate the HTTP request process.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$client = new Client();\n\u003C\u002Fpre>\n\n\u003Cp>This line creates a new instance of the Guzzle HTTP client, which will be used to send the API request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$headers = [\n  'Api-Key' => 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>$headers\u003C\u002Fcode> array sets the API key required for authentication with the pdfRest API. Replace the placeholder with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$options = [\n  'multipart' => [\n    \u002F\u002F File fields and configurations\n  ]\n];\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>$options\u003C\u002Fcode> array defines the multipart form data that will be sent with the request. Each element in the \u003Ccode>multipart\u003C\u002Fcode> array represents a different part of the form data, including the PDF file, PFX credential file, passphrase file, logo file, and signature configuration.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fsigned-pdf', $headers);\n\u003C\u002Fpre>\n\n\u003Cp>This line creates a new HTTP POST request to the Sign PDF endpoint, including the headers for authentication.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$res = $client->sendAsync($request, $options)->wait();\n\u003C\u002Fpre>\n\n\u003Cp>The asynchronous request is sent using the \u003Ccode>sendAsync\u003C\u002Fcode> method, and the script waits for the response. The response contains the signed PDF document.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">echo $res->getBody();\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the response body, which contains the signed PDF, is output to the console or browser.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you have learned how to use PHP to send an API call to the pdfRest Sign PDF endpoint, automating the process of digitally signing PDF documents. This powerful capability can be integrated into your PHP applications to streamline document workflows and ensure document authenticity.\u003C\u002Fp>\n\n\u003Cp>To explore more features and capabilities of the pdfRest API, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> to demo all available tools. For detailed information on each endpoint and parameter, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example demonstrates a multipart API call. For code samples using JSON payloads, visit the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fsigned-pdf.php\">GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-07-18T16:22:36.000+00:00","2026-09-02T18:28:33.000+00:00","Learn how to apply digital signatures to PDFs with PHP using pdfRest's Sign PDF API Tool.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-php\u002F#article\",\n      \"headline\": \"How to Digitally Sign PDF Files with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-php\u002F\",\n      \"datePublished\": \"2025-07-18T16:22:36.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:12.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to apply digital signatures to PDFs with PHP using pdfRest's Sign PDF API Tool.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Sign PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsign-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsigned-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsign-pdf\"\n        }\n      ],\n      \"keywords\": \"Digital Signature, PHP, Security, Sign PDF\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Digitally Sign PDF Files with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8191,8192,8193,8194,8195,8196],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2017,"name":2018,"slug":2019,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2021,"name":2022,"slug":2023,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-digitally-sign-pdf-files-with-php\u002F","How to Digitally Sign PDF Files with PHP, Tutorial | pdfRest",{"id":8201,"uuid":8202,"title":8203,"slug":8204,"html":8205,"comment_id":8201,"feature_image":48,"featured":284,"visibility":1257,"created_at":8206,"updated_at":8187,"published_at":8206,"custom_excerpt":8207,"codeinjection_head":8208,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8209,"primary_tag":8216,"url":8217,"excerpt":8207,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8218,"meta_description":8207,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"687a7470533c9f26b9439e28","92070c06-2896-46a8-8ff7-e59a03530d46","How to Digitally Sign PDF Files with Python","how-to-digitally-sign-pdf-files-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Digitally Sign PDFs with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsign-pdf\u002F'>Sign PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to automate the process of digitally signing PDF documents. By integrating this tool with Python, developers can streamline workflows, enhance document security, and ensure compliance with digital signature standards. This tutorial will guide you through the process of sending an API call to the Sign PDF endpoint using Python, making it easy to incorporate digital signatures into your applications.\u003C\u002Fp>\n\n\u003Cp>Digital signatures are essential for businesses and individuals who need to verify the authenticity and integrity of their documents. For example, a company may use the Sign PDF API to automatically sign contracts or agreements before sending them to clients, ensuring that the documents are tamper-proof and legally binding. This not only saves time but also reduces the risk of human error in the document signing process.\u003C\u002Fp>\n\n\u003Ch2>Sign PDF with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nsigned_pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fsigned-pdf'\n\nsignature_config = {\n    \"type\": \"new\",\n    \"name\": \"esignature\",\n    \"logo_opacity\": \"0.5\",\n    \"location\": {\n        \"bottom_left\": { \"x\": \"0\", \"y\": \"0\" },\n        \"top_right\": { \"x\": \"216\", \"y\": \"72\" },\n        \"page\": 1\n    },\n    \"display\": {\n        \"include_distinguished_name\": \"true\",\n        \"include_datetime\": \"true\",\n        \"contact\": \"My contact information\",\n        \"location\": \"My signing location\",\n        \"name\": \"John Doe\",\n        \"reason\": \"My reason for signing\"\n    }\n}\n\nmp_encoder_signPDF = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'pfx_credential_file': ('file_name.pfx', open('\u002Fpath\u002Fto\u002Ffile_name.pfx', 'rb'), 'application\u002Fx-pkcs12'),\n        'pfx_passphrase_file': ('file_name.txt', open('\u002Fpath\u002Fto\u002Ffile_name.txt', 'rb'), 'text\u002Fplain'),\n        'logo_file': ('file_name.jpg', open('\u002Fpath\u002Fto\u002Ffile_name.jpg', 'rb'), 'image\u002Fjpeg'),\n        'signature_configuration': json.dumps(signature_config),\n        'output' : 'example_out'\n    }\n)\n\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_signPDF.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to signed-pdf endpoint...\")\nresponse = requests.post(signed_pdf_endpoint_url, data=mp_encoder_signPDF, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fsigned-pdf.py\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing the necessary libraries: \u003Ccode>requests_toolbelt\u003C\u002Fcode>, \u003Ccode>requests\u003C\u002Fcode>, and \u003Ccode>json\u003C\u002Fcode>. The \u003Ccode>signed_pdf_endpoint_url\u003C\u002Fcode> is defined as the URL for the Sign PDF API endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">signature_config = {\n    \"type\": \"new\",\n    \"name\": \"esignature\",\n    ...\n}\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>signature_config\u003C\u002Fcode> dictionary configures the signature's appearance and metadata. It includes the signature type, name, logo opacity, and display options such as contact information and signing reason.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_signPDF = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        ...\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>MultipartEncoder\u003C\u002Fcode> is used to construct the multipart form data payload. It includes the PDF file, PFX credential file, passphrase file, logo file, and the JSON string of the signature configuration.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_signPDF.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>headers\u003C\u002Fcode> dictionary specifies the request headers, including the \u003Ccode>Content-Type\u003C\u002Fcode> set to the multipart encoder's content type and the \u003Ccode>Api-Key\u003C\u002Fcode> for authentication.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(signed_pdf_endpoint_url, data=mp_encoder_signPDF, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>requests.post\u003C\u002Fcode> method sends the POST request to the API endpoint with the multipart data and headers. The response is then checked for success, and the JSON response is printed if successful.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use Python to send a request to the pdfRest Sign PDF API, allowing you to digitally sign PDF documents programmatically. You can explore other pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for more detailed information.\u003C\u002Fp>\n\n\u003Cp>Note: This example demonstrates a multipart API call. For code samples using JSON payloads, visit the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fsigned-pdf.py\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-07-18T16:21:04.000+00:00","Learn how to apply digital signatures to PDFs using pdfRest's Sign PDF API Tool with Python.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-python\u002F#article\",\n      \"headline\": \"How to Digitally Sign PDF Files with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-python\u002F\",\n      \"datePublished\": \"2025-07-18T16:21:04.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:12.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to apply digital signatures to PDFs using pdfRest's Sign PDF API Tool with Python.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Sign PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsign-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsigned-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsign-pdf\"\n        }\n      ],\n      \"keywords\": \"Digital Signature, Python, Security, Sign PDF\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Digitally Sign PDF Files with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-digitally-sign-pdf-files-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8210,8211,8212,8213,8214,8215],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2017,"name":2018,"slug":2019,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2021,"name":2022,"slug":2023,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-digitally-sign-pdf-files-with-python\u002F","How to Digitally Sign PDF Files with Python, Tutorial | pdfRest",{"id":8220,"uuid":8221,"title":8222,"slug":8223,"html":8224,"comment_id":8225,"feature_image":48,"featured":284,"visibility":1257,"created_at":8226,"updated_at":8227,"published_at":8226,"custom_excerpt":8228,"codeinjection_head":8229,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8230,"primary_tag":8235,"url":8236,"excerpt":8228,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8237,"meta_description":8228,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1380","9c4dd359-5667-4524-a225-768468be2969","How to Encrypt PDF Files in .NET with C#","how-to-encrypt-pdf-files-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Encrypt PDF with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F'>Encrypt PDF API Tool\u003C\u002Fa> allows developers to secure their PDF files by encrypting them with a password. This tutorial will demonstrate how to send an API call to Encrypt PDF with C#.\u003C\u002Fp>\n\u003Cp>Encrypting a PDF can be crucial in scenarios where sensitive information, such as financial reports, legal documents, or personal data, needs to be transmitted or stored securely. By encrypting the PDF, you can ensure that only authorized individuals with the password can access the content of the document.\u003C\u002Fp>\n\n\u003Ch2>Encrypt PDF with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"encrypted-pdf\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"password\"));\n        multipartContent.Add(byteArrayOption, \"new_open_password\");\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source code reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fencrypted-pdf.cs\">pdfRest Encrypt PDF API C# Sample\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the C# Code\u003C\u002Fh2>\n\n\u003Cp>The above code snippet demonstrates how to make a multipart\u002Fform-data POST request to the pdfRest Encrypt PDF API endpoint using C#. Let's break down the key parts of this code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>This initializes a new instance of the HttpClient class and sets the base address for the API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>This line adds your API key to the request headers, which is necessary for authentication with the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n\u003C\u002Fpre>\n\n\u003Cp>Here, the PDF file is read into a byte array, wrapped in a ByteArrayContent object, and added to the multipart form data content with the name \"file\". The \"file_name\" is the name of the file as it will appear in the form data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"password\"));\nmultipartContent.Add(byteArrayOption, \"new_open_password\");\n\u003C\u002Fpre>\n\n\u003Cp>This part creates another ByteArrayContent object containing the password for encrypting the PDF. It is then added to the multipart content with the name \"new_open_password\".\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\n\u003C\u002Fpre>\n\n\u003Cp>The HttpClient sends the POST request asynchronously and awaits the response from the server.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the response content is read as a string, which contains the result of the API call.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've learned how to encrypt a PDF file using the pdfRest Encrypt PDF API and C#. This process involves sending a multipart\u002Fform-data request with the file and encryption password. After the API call, the server responds with the encrypted PDF or an error message if something went wrong.\u003C\u002Fp>\n\n\u003Cp>To further explore the capabilities of pdfRest and test the API tools, you can visit the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For comprehensive documentation on all available endpoints and parameters, refer to the API Reference at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">Cloud API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fencrypted-pdf.cs\">JSON Payload Example\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","65a46a332d4014c9499b3e2b","2024-01-14T23:11:47.000+00:00","2026-09-02T18:28:34.000+00:00","Learn how to encrypt PDF Files with a password using C# and the Encrypt PDF API Tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-files-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Encrypt PDF Files in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-files-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-files-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-01-14T23:11:47.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:54.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to encrypt PDF Files with a password using C# and the Encrypt PDF API Tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Encrypt PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fencrypted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fencrypt-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Encrypt PDF\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Encrypt PDF Files in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-files-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8231,8232,8233,8234],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1997,"name":1998,"slug":1999,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-encrypt-pdf-files-in-net-with-c\u002F","How to Encrypt PDF Files in .NET with C#, Tutorial | pdfRest",{"id":8239,"uuid":8240,"title":8241,"slug":8242,"html":8243,"comment_id":8244,"feature_image":48,"featured":284,"visibility":1257,"created_at":8245,"updated_at":8227,"published_at":8245,"custom_excerpt":8246,"codeinjection_head":8247,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8248,"primary_tag":8253,"url":8254,"excerpt":8246,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8255,"meta_description":8246,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1381","d85661b9-1e1a-48f5-89ea-ba18b1f1d475","How to Encrypt PDF Files with JavaScript in NodeJS","how-to-encrypt-pdf-files-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Encrypt PDF with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F'>Encrypt PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to secure their PDF documents. By encrypting a PDF, you can restrict access to the document's content, ensuring that only those with the correct password can view it.\u003C\u002Fp>\n\u003Cp>This tutorial will guide you through the process of sending an API call to encrypt a PDF using JavaScript. Imagine you have a sensitive document, such as a financial report or a legal contract, that you need to share electronically. To protect this document from unauthorized access, you would use the Encrypt PDF API to secure it with a password.\u003C\u002Fp>\n\n\u003Ch2>Encrypt PDF with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to apply 256-bit AES encryption with a 32-bit key. Encrypted PDFs cannot be viewed without first providing the open password.\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('new_open_password', 'new_example_pw');\ndata.append('output', 'pdfrest_encrypted_pdf');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\nmaxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fencrypted-pdf',\n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error);\n});\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fencrypted-pdf.js\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the JavaScript Code\u003C\u002Fh2>\n\n\u003Cp>The provided code uses Node.js modules to send a multipart\u002Fform-data request to the pdfRest API to encrypt a PDF file. Here's a breakdown of the key parts:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\u003C\u002Fpre>\n\n\u003Cp>This initializes the required modules: \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests, \u003Ccode>FormData\u003C\u002Fcode> to create a form-data payload, and \u003Ccode>fs\u003C\u002Fcode> to interact with the file system.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('new_open_password', 'new_example_pw');\ndata.append('output', 'pdfrest_encrypted_pdf');\n\u003C\u002Fpre>\n\n\u003Cp>Here, a new \u003Ccode>FormData\u003C\u002Fcode> instance is created, and the file to be encrypted is appended along with the new password and output file name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\nmaxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fencrypted-pdf',\n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>config\u003C\u002Fcode> object contains the request configuration, including the API endpoint, headers (with your API key), and the data payload.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error);\n});\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>axios\u003C\u002Fcode> library sends the request and processes the response or error. The response will contain information about the encrypted PDF, such as its URL or resource ID.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you've learned how to encrypt a PDF using JavaScript and the pdfRest API. Now you can secure your PDF documents and control who can view them. To explore more capabilities and try out different API tools, visit the pdfRest API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on the API, refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">Cloud API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. For code samples using JSON payloads, visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fencrypted-pdf.js\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","65a46a9b2d4014c9499b3e35","2024-01-14T23:13:31.000+00:00","Learn how to use JavaScript to Encrypt PDF files with a password using Encrypt PDF API Tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-files-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Encrypt PDF Files with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-files-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-files-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-01-14T23:13:31.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:54.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use JavaScript to Encrypt PDF files with a password using Encrypt PDF API Tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Encrypt PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fencrypted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fencrypt-pdf\"\n        }\n      ],\n      \"keywords\": \"Encrypt PDF, JavaScript\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Encrypt PDF Files with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-files-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8249,8250,8251,8252],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1997,"name":1998,"slug":1999,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-encrypt-pdf-files-with-javascript-in-nodejs\u002F","How to Encrypt PDF Files with JavaScript in NodeJS, Tutorial | pdfRest",{"id":8257,"uuid":8258,"title":8259,"slug":8260,"html":8261,"comment_id":8257,"feature_image":48,"featured":284,"visibility":1257,"created_at":8262,"updated_at":8227,"published_at":8262,"custom_excerpt":8263,"codeinjection_head":8264,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8265,"primary_tag":8270,"url":8271,"excerpt":8263,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8272,"meta_description":8263,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65eb6f57533c9f26b9436835","1e3f9e9c-c4eb-49f8-a7d2-7d46d9878c92","How to Encrypt PDF with cURL","how-to-encrypt-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Encrypt PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F'>Encrypt PDF API Tool\u003C\u002Fa> is a powerful feature that allows users to secure their PDF documents by adding password protection. This tutorial will guide you through the process of sending an API call to Encrypt PDF using cURL, which is a versatile command-line tool used for transferring data with URLs. By using cURL, you can easily integrate PDF encryption into your workflow or application, ensuring that sensitive information within your PDFs remains confidential.\u003C\u002Fp>\n\n\u003Cp>There are numerous scenarios where encrypting a PDF document is essential. For instance, a financial institution might need to send confidential reports to clients, or a healthcare provider may need to protect patient records. By encrypting these documents, they ensure that only individuals with the correct password can access the sensitive information, thus complying with privacy regulations and safeguarding against unauthorized access.\u003C\u002Fp>\n\n\u003Ch2>Encrypt PDF with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fencrypted-pdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\" \\\n  -F \"new_open_password=password\"\n\u003C\u002Fpre>\n\n\u003Cp>Reference to the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fencrypted-pdf.sh\">pdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The cURL command provided is used to make an API request to the pdfRest Encrypt PDF endpoint. Let's break down the command:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-X POST\n\u003C\u002Fpre>\n\n\u003Cp>This specifies the HTTP method for the request, which is POST, indicating that you are sending data to create or update a resource.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">\"https:\u002F\u002Fapi.pdfrest.com\u002Fencrypted-pdf\"\n\u003C\u002Fpre>\n\n\u003Cp>This is the URL of the API endpoint that performs the encryption of the PDF file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\n\u003C\u002Fpre>\n\n\u003Cp>This header tells the server that the client expects a response in JSON format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\n\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the data being sent in the request is multipart form data, which is necessary for uploading files.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>This header includes your unique API key for authentication with the pdfRest service.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\n\u003C\u002Fpre>\n\n\u003Cp>This form field specifies the path to the PDF file you want to encrypt. The '@' symbol indicates that a file is being uploaded.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>This form field sets the name of the output file that will be created once the PDF is encrypted.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"new_open_password=password\"\n\u003C\u002Fpre>\n\n\u003Cp>This form field sets the password that will be required to open the encrypted PDF.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you have learned how to encrypt a PDF document using the pdfRest API and cURL. This allows you to add an extra layer of security to your PDFs by requiring a password to open them. You can now integrate this functionality into your own applications or automate the encryption process for batches of PDF documents.\u003C\u002Fp>\n\n\u003Cp>To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information and additional parameters, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. For code samples using JSON payloads, visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fencrypted-pdf.sh\">pdf-rest-api-samples with JSON payloads\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-08T20:04:39.000+00:00","Learn how to use Encrypt PDF API Tool by pdfRest with cURL to password-protect a PDF","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Encrypt PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-with-curl\u002F\",\n      \"datePublished\": \"2024-03-08T20:04:39.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:43.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use Encrypt PDF API Tool by pdfRest with cURL to password-protect a PDF\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Encrypt PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fencrypted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fencrypt-pdf\"\n        }\n      ],\n      \"keywords\": \"Encrypt PDF, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Encrypt PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8266,8267,8268,8269],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1997,"name":1998,"slug":1999,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-encrypt-pdf-with-curl\u002F","How to Encrypt PDF with cURL, Tutorial | pdfRest",{"id":8274,"uuid":8275,"title":8276,"slug":8277,"html":8278,"comment_id":8274,"feature_image":48,"featured":284,"visibility":1257,"created_at":8279,"updated_at":8280,"published_at":8279,"custom_excerpt":8281,"codeinjection_head":8282,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8283,"primary_tag":8288,"url":8289,"excerpt":8281,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8290,"meta_description":8281,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65eb6fcc533c9f26b943683f","faa0fea1-aa0c-4d82-adc7-bd33564ea66d","How to Encrypt PDF with Java","how-to-encrypt-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Encrypt PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F'>Encrypt PDF API Tool\u003C\u002Fa> is a powerful resource that allows developers to secure their PDF documents by adding a password. This tutorial will demonstrate how to make an API call to the Encrypt PDF endpoint using Java, ensuring that sensitive information contained within a PDF can be protected from unauthorized access. Encrypting a PDF is a crucial step in maintaining the confidentiality and integrity of the document's contents.\u003C\u002Fp>\n\n\u003Cp>You might need to encrypt PDFs to protect client reports, confidential business plans, or personal documents such as legal contracts before sharing them over the internet. By encrypting the PDF files, you ensure that only individuals with the correct password can view or modify the document, thereby safeguarding the information against potential breaches or unauthorized disclosures.\u003C\u002Fp>\n\n\u003Ch2>Encrypt PDF with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class EncryptedPDF {\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"new_open_password\", \"password\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fencrypted-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    return new JSONObject(json).toString(4);\n  }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Code source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FEncryptedPDF.java\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided Java code demonstrates how to encrypt a PDF file using the pdfRest API. Let's break down the key components of this code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\u003C\u002Fpre>\n\n\u003Cp>This line initializes the Dotenv library to load environment variables, which can include the API key needed to authenticate with the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody = RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n\u003C\u002Fpre>\n\n\u003Cp>Here, a RequestBody object is created from the PDF file that needs to be encrypted, specifying the media type as \"application\u002Fpdf\".\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">RequestBody requestBody = new MultipartBody.Builder()\n    .setType(MultipartBody.FORM)\n    .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n    .addFormDataPart(\"new_open_password\", \"password\")\n    .build();\n\u003C\u002Fpre>\n\n\u003Cp>This snippet constructs the multipart request body with two parts: the PDF file and the new password for opening the encrypted PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Request request = new Request.Builder()\n    .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n    .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fencrypted-pdf\")\n    .post(requestBody)\n    .build();\n\u003C\u002Fpre>\n\n\u003Cp>The Request object is built with the API key header, the URL of the Encrypt PDF endpoint, and the previously constructed request body.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Response response = client.newCall(request).execute();\n\u003C\u002Fpre>\n\n\u003Cp>This line sends the request to the pdfRest API and waits for the response. The response includes the status code and, if successful, the encrypted PDF content.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we have successfully called the Encrypt PDF API endpoint using Java to encrypt a PDF file with a password. This process enhances the security of the document by ensuring that only authorized individuals with the password can access the content.\u003C\u002Fp>\n\n\u003Cp>To further explore the capabilities of the pdfRest API, users are encouraged to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for additional details and examples.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FEncryptedPDF.java\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-08T20:06:36.000+00:00","2026-09-02T18:28:35.000+00:00","Learn how to password-protect a PDF with Encrypt PDF API Tool by pdfRest using Java","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Encrypt PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-with-java\u002F\",\n      \"datePublished\": \"2024-03-08T20:06:36.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:43.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to password-protect a PDF with Encrypt PDF API Tool by pdfRest using Java\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Encrypt PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fencrypted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fencrypt-pdf\"\n        }\n      ],\n      \"keywords\": \"Encrypt PDF, Java\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Encrypt PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8284,8285,8286,8287],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1997,"name":1998,"slug":1999,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-encrypt-pdf-with-java\u002F","How to Encrypt PDF with Java, Tutorial | pdfRest",{"id":8292,"uuid":8293,"title":8294,"slug":8295,"html":8296,"comment_id":8297,"feature_image":48,"featured":284,"visibility":1257,"created_at":8298,"updated_at":6916,"published_at":8298,"custom_excerpt":8299,"codeinjection_head":8300,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8301,"primary_tag":8306,"url":8307,"excerpt":8299,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8308,"meta_description":8299,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b135b","af9a4548-2c2a-45d7-994d-ed5c9c3f9408","How to Encrypt PDF with PHP","how-to-encrypt-pdf-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Encrypt PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\">Encrypt PDF API Tool\u003C\u002Fa> allows developers to secure PDF documents by encrypting them with a password. By using this API, you can ensure that sensitive information within a PDF is protected and can only be accessed by individuals with the correct password.\u003C\u002Fp>\n\n\u003Cp>This tutorial will guide you through the process of sending an API call to Encrypt PDF with PHP. A real-world example of using Encrypt PDF might involve a company that needs to send confidential financial reports to its stakeholders. By encrypting the documents, the company can safeguard the data and maintain privacy.\u003C\u002Fp>\n\n\u003Ch2>Encrypt PDF with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'new_open_password',\n      'contents' => 'new_example_pw'\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_encrypted_pdf'\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fencrypted-pdf', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source of the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fencrypted-pdf.php\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the PHP Code\u003C\u002Fh2>\n\n\u003Cp>The provided PHP code makes use of the Guzzle HTTP client to send a multipart\u002Fform-data request to the pdfRest Encrypt PDF API endpoint. Here's a breakdown of the key components:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\u003C\u002Fpre>\n\n\u003Cp>This line includes the Composer autoload file, which is necessary for loading the Guzzle HTTP client and other dependencies.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$client = new Client();\n\u003C\u002Fpre>\n\n\u003Cp>Here, we instantiate a new Guzzle HTTP client object.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The 'Api-Key' header is required for authentication with the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$options = [\n  'multipart' => [\n    \u002F\u002F ... multipart form fields ...\n  ]\n];\n\u003C\u002Fpre>\n\n\u003Cp>The 'multipart' array within the '$options' array contains the form fields and files to be sent with the request:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>'file': The file to be encrypted.\u003C\u002Fli>\n  \u003Cli>'new_open_password': The password to encrypt the PDF with.\u003C\u002Fli>\n  \u003Cli>'output': The desired name for the output file.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-php\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fencrypted-pdf', $headers);\n\u003C\u002Fpre>\n\n\u003Cp>A new HTTP POST request is created with the API endpoint and the headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$res = $client->sendAsync($request, $options)->wait();\n\u003C\u002Fpre>\n\n\u003Cp>The request is sent asynchronously, and the script waits for the response, which contains the encrypted PDF content.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've successfully sent an API call to encrypt a PDF document using PHP. The encrypted PDF can now be securely shared, knowing that only individuals with the password can open it. I encourage you to demo all of the pdfRest API Tools in the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for more details.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fencrypted-pdf.php\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","658de9b42d4014c9499b3b3b","2023-12-28T21:33:40.000+00:00","Learn how to encrypt PDF documents using PHP to call the pdfRest Encrypt PDF API Tool.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-with-php\u002F#article\",\n      \"headline\": \"How to Encrypt PDF with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-with-php\u002F\",\n      \"datePublished\": \"2023-12-28T21:33:40.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:58.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to encrypt PDF documents using PHP to call the pdfRest Encrypt PDF API Tool.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Encrypt PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fencrypted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fencrypt-pdf\"\n        }\n      ],\n      \"keywords\": \"Encrypt PDF, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Encrypt PDF with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8302,8303,8304,8305],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1997,"name":1998,"slug":1999,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-encrypt-pdf-with-php\u002F","How to Encrypt a PDF with PHP, Tutorial | pdfRest",{"id":8310,"uuid":8311,"title":8312,"slug":8313,"html":8314,"comment_id":8315,"feature_image":48,"featured":284,"visibility":1257,"created_at":8316,"updated_at":8317,"published_at":8316,"custom_excerpt":8318,"codeinjection_head":8319,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8320,"primary_tag":8325,"url":8326,"excerpt":8318,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8327,"meta_description":8318,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b135a","6d7e566e-73c3-482d-80be-314f86f63724","How to Encrypt PDF with Python","how-to-encrypt-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Encrypt PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F'>Encrypt PDF API Tool\u003C\u002Fa> is a powerful resource for securing PDF documents by adding password protection. This tutorial will guide you through the process of sending an API call to encrypt a PDF using Python.\u003C\u002Fp>\n\u003Cp>Encrypting PDFs is essential in scenarios where sensitive information needs to be shared securely, such as sending confidential business reports, legal documents, or personal information that requires protection from unauthorized access.\u003C\u002Fp>\n\n\u003Ch2>Encrypt PDF with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nencrypted_pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fencrypted-pdf'\n\n# The \u002Fencrypted-pdf endpoint can take a single PDF file or id as input.\n# This sample demonstrates encryption of a PDF with the password 'password'.\nmp_encoder_encryptedPdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_encryptedPdf_out',\n        'new_open_password': 'password',\n    }\n)\n\n# Let's set the headers that the encrypted-pdf endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_encryptedPdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to encrypted-pdf endpoint...\")\nresponse = requests.post(encrypted_pdf_endpoint_url, data=mp_encoder_encryptedPdf, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source code reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fencrypted-pdf.py\">pdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided Python code demonstrates how to encrypt a PDF using the pdfRest API. Let's break down the key parts of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\u003C\u002Fpre>\n\n\u003Cp>This imports the necessary libraries. \u003Ccode>MultipartEncoder\u003C\u002Fcode> is used for creating a multipart\u002Fform-data payload, \u003Ccode>requests\u003C\u002Fcode> for making HTTP requests, and \u003Ccode>json\u003C\u002Fcode> for handling JSON data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_encryptedPdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_encryptedPdf_out',\n        'new_open_password': 'password',\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>This sets up the multipart\u002Fform-data payload with the file to be encrypted, the desired output name, and the new password for opening the PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_encryptedPdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\n\u003C\u002Fpre>\n\n\u003Cp>These are the HTTP headers required by the API, including the API key for authentication.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(encrypted_pdf_endpoint_url, data=mp_encoder_encryptedPdf, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This sends the POST request to the API endpoint with the data and headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>This checks if the request was successful and prints the JSON response; otherwise, it prints the error text.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, we've successfully encrypted a PDF using the pdfRest API and Python. You can now explore and demo all of the pdfRest API Tools in the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">Cloud API Reference Guide\u003C\u002Fa> for further details and capabilities.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fencrypted-pdf.py\">pdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","658de7c92d4014c9499b3b31","2023-12-28T21:25:29.000+00:00","2026-09-02T18:28:36.000+00:00","Learn how to use Python to call the Encrypt PDF API tool from pdfRest to secure your documents.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Encrypt PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-with-python\u002F\",\n      \"datePublished\": \"2023-12-28T21:25:29.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:58.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use Python to call the Encrypt PDF API tool from pdfRest to secure your documents.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Encrypt PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fencrypted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fencrypt-pdf\"\n        }\n      ],\n      \"keywords\": \"Encrypt PDF, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Encrypt PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-encrypt-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8321,8322,8323,8324],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1997,"name":1998,"slug":1999,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-encrypt-pdf-with-python\u002F","How to Encrypt a PDF with Python, Tutorial | pdfRest",{"id":8329,"uuid":8330,"title":8331,"slug":8332,"html":8333,"comment_id":8334,"feature_image":48,"featured":284,"visibility":1257,"created_at":8335,"updated_at":8317,"published_at":8335,"custom_excerpt":48,"codeinjection_head":8336,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8337,"primary_tag":8342,"url":8343,"excerpt":8344,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8345,"meta_description":8346,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1348","f46a5095-901d-49ac-bfe6-225d597edd92","How to Export PDF Form Data with .NET C#","how-to-export-pdf-form-data-with-dot-net-c-sharp","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Export PDF Form Data with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fexport-form-data\u002F\">Export Form Data API Tool\u003C\u002Fa> is designed to extract data from fillable PDF forms and return the data in formats appropriate for the PDF form type, including XML, FDF, XFDF, XFD, or XDP. This tutorial will demonstrate how to make an API call to the Export Form Data endpoint using C# to programmatically retrieve data from a PDF form. This functionality can be useful in scenarios where you need to automate the extraction of form data for processing, such as collecting survey results or processing registration forms.\u003C\u002Fp>\n\n\u003Ch2>C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"exported-form-data\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"xml\"));\n        multipartContent.Add(byteArrayOption, \"data_format\");\n\n        var byteArrayOption2 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"extracted\"));\n        multipartContent.Add(byteArrayOption2, \"output\");\n\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fexported-form-data.cs\">pdf-rest-api-samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the C# Code\u003C\u002Fh2>\n\n\u003Cp>The sample uses the framework \u003Ccode>HttpClient\u003C\u002Fcode> APIs, so no separate HTTP package is required. \u003Ccode>HttpClient\u003C\u002Fcode> is assigned the pdfRest base URL, and the request targets \u003Ccode>exported-form-data\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\nusing (var request = new HttpRequestMessage(HttpMethod.Post, \"exported-form-data\"))\u003C\u002Fpre>\n\n\u003Cp>The relative request path combines with the base address to call \u003Ccode>https:\u002F\u002Fapi.pdfrest.com\u002Fexported-form-data\u003C\u002Fcode>. In a long-running application, reuse a managed \u003Ccode>HttpClient\u003C\u002Fcode> rather than creating one for every request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\n    \"Api-Key\",\n    \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n);\nrequest.Headers.Accept.Add(new(\"application\u002Fjson\"));\nvar multipartContent = new MultipartFormDataContent();\u003C\u002Fpre>\n\n\u003Cp>The API key authenticates the request, and the Accept header requests the standard JSON resource response. \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> generates the multipart boundary used for the file and text fields.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\u003C\u002Fpre>\n\n\u003Cp>The PDF becomes the \u003Ccode>file\u003C\u002Fcode> multipart part. Supplying a filename and \u003Ccode>application\u002Fpdf\u003C\u002Fcode> content type gives the service the metadata it needs to validate the uploaded document.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var formatContent = new ByteArrayContent(Encoding.UTF8.GetBytes(\"xml\"));\nmultipartContent.Add(formatContent, \"data_format\");\n\nvar outputContent = new ByteArrayContent(Encoding.UTF8.GetBytes(\"extracted\"));\nmultipartContent.Add(outputContent, \"output\");\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>data_format\u003C\u002Fcode> must match the PDF form type: AcroForms support \u003Ccode>fdf\u003C\u002Fcode>, \u003Ccode>xfdf\u003C\u002Fcode>, and \u003Ccode>xml\u003C\u002Fcode>; XFA forms support \u003Ccode>xdp\u003C\u002Fcode>, \u003Ccode>xfd\u003C\u002Fcode>, and \u003Ccode>xml\u003C\u002Fcode>. The \u003Ccode>output\u003C\u002Fcode> value is a filename without an extension, not an output-type selector.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Content = multipartContent;\nvar response = await httpClient.SendAsync(request);\nvar apiResult = await response.Content.ReadAsStringAsync();\nConsole.WriteLine(apiResult);\u003C\u002Fpre>\n\n\u003Cp>The response body contains generated-resource JSON when the export succeeds or an API error when validation fails. Production code should check \u003Ccode>response.IsSuccessStatusCode\u003C\u002Fcode> before deserializing the success shape so server validation messages remain visible during integration.\u003C\u002Fp>\n\n\u003Ch2>API Reference, Labs, Github, and More\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've covered how to use C# to send an API call to the pdfRest Export Form Data endpoint. By following the steps outlined, you can extract data from PDF forms and use it in your applications. To explore all the pdfRest API Tools, visit the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\u003C\u002Fa>, and for further documentation, refer to the API Reference at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>\u003Cem>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fexported-form-data.cs\">https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fexported-form-data.cs\u003C\u002Fa>.\u003C\u002Fem>\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","657bbdcf2d4014c9499b386c","2023-12-15T02:45:35.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-dot-net-c-sharp\u002F#article\",\n      \"headline\": \"How to Export PDF Form Data with .NET C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-dot-net-c-sharp\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-dot-net-c-sharp\u002F\",\n      \"datePublished\": \"2023-12-15T02:45:35.000Z\",\n      \"dateModified\": \"2026-09-01T14:52:13.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to export data from PDF form fields in .NET via the Export Form Data API Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Export Form Data API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fexport-form-data\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fexported-form-data API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-form-data\"\n        }\n      ],\n      \"keywords\": \".NET, Export Form Data\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Export PDF Form Data with .NET C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-dot-net-c-sharp\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8338,8339,8340,8341],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1802,"name":1803,"slug":1804,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-export-pdf-form-data-with-dot-net-c-sharp\u002F","\n\n\n\n\nWhy Export PDF Form Data with C#?\n\n\n\nThe pdfRest Export Form Data API Tool is designed to extract data from fillable PDF forms and return the data in formats appropriate for the PDF form type, including XML, FDF, XFDF, XFD, or XDP. This tutorial will demonstrate how to make an API call to the Export Form Data endpoint using C# to programmatically retrieve data from a PDF form. This functionality can be useful in scenarios where you need to automate the extraction of form data for processing","How to Export PDF Form Data with .NET C#, Tutorial | pdfRest","Learn how to export data from PDF form fields in .NET via the Export Form Data API Tool from pdfRest.",{"id":8348,"uuid":8349,"title":8350,"slug":8351,"html":8352,"comment_id":8348,"feature_image":48,"featured":284,"visibility":1257,"created_at":8353,"updated_at":8317,"published_at":8353,"custom_excerpt":8354,"codeinjection_head":8355,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8356,"primary_tag":8364,"url":8365,"excerpt":8354,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8366,"meta_description":8354,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"672bcba7533c9f26b9438c1e","c2615ada-222f-4419-990e-5a110acf9708","How to Export PDF Form Data with cURL","how-to-export-pdf-form-data-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Export Form Data with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fexport-form-data\u002F'>Export Form Data API Tool\u003C\u002Fa> is a powerful utility that allows users to extract form data from PDF documents. By using cURL, a command-line tool for transferring data with URLs, you can automate and streamline the process of sending requests to this API endpoint. This tutorial will guide you through the process of making an API call to export form data using cURL, demonstrating how to set up and execute the request effectively.\u003C\u002Fp>\n\n\u003Cp>You might have a large number of PDF forms that need to be processed to extract data for analysis or record-keeping. For example, a company might collect customer feedback through PDF forms and need to export this data into a structured format like XML for further processing. Using the Export Form Data API with cURL simplifies this task by allowing you to automate data extraction, saving time and reducing the potential for human error.\u003C\u002Fp>\n\n\u003Ch2>Export Form Data with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fexported-form-data\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"data_format=xml\" \\\n  -F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fexported-form-data.sh\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided cURL command sends a POST request to the \u003Ccode>https:\u002F\u002Fapi.pdfrest.com\u002Fexported-form-data\u003C\u002Fcode> endpoint. Let's break down each part of the command:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fexported-form-data\"\u003C\u002Fpre>\n\n\u003Cp>This specifies that we are making a POST request to the Export Form Data endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\u003C\u002Fpre>\n\n\u003Cp>This header tells the server that the client expects the response to be in JSON format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the request body will contain multiple parts, such as files and form fields. This is necessary for uploading files.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\u003C\u002Fpre>\n\n\u003Cp>The API key is a unique identifier used to authenticate the request. Replace the placeholder with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\u003C\u002Fpre>\n\n\u003Cp>This option uploads the file specified by the path. The '@' symbol is used to denote that the content of the file should be uploaded.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"data_format=xml\"\u003C\u002Fpre>\n\n\u003Cp>This form field specifies the format of the exported data. In this case, it is set to 'xml'.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\u003C\u002Fpre>\n\n\u003Cp>This specifies the name of the output file where the exported data will be saved.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we successfully demonstrated how to use cURL to make an API call to pdfRest's Export Form Data endpoint. This allows you to automate the extraction of form data from PDF files, which can be particularly useful for processing large volumes of documents efficiently.\u003C\u002Fp>\n\n\u003Cp>To further explore the capabilities of the pdfRest API, you can try out all of the available tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example showcases a multipart API call. For code samples using JSON payloads, visit the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fexported-form-data.sh\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-06T20:03:51.000+00:00","Learn how to extract PDF form field values with pdfRest Export Form Data using cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-curl\u002F#article\",\n      \"headline\": \"How to Export PDF Form Data with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-curl\u002F\",\n      \"datePublished\": \"2024-11-06T20:03:51.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:22.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to extract PDF form field values with pdfRest Export Form Data using cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Export Form Data API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fexport-form-data\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fexported-form-data API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-form-data\"\n        }\n      ],\n      \"keywords\": \"Data, Export Form Data, Extract, Forms, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Export PDF Form Data with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8357,8358,8359,8360,8361,8362,8363],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1802,"name":1803,"slug":1804,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1782,"name":1783,"slug":1784,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-export-pdf-form-data-with-curl\u002F","How to Export PDF Form Data with cURL, Tutorial | pdfRest",{"id":8368,"uuid":8369,"title":8370,"slug":8371,"html":8372,"comment_id":8368,"feature_image":48,"featured":284,"visibility":1257,"created_at":8037,"updated_at":8373,"published_at":8374,"custom_excerpt":8375,"codeinjection_head":8376,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8377,"primary_tag":8385,"url":8386,"excerpt":8375,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8387,"meta_description":8375,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c5d533c9f26b943b548","ecb3c7d9-0bdd-4a03-b13e-ba3e67c16076","How to Export PDF Form Data with Java","how-to-export-pdf-form-data-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>By the end of this tutorial, you'll know how to export PDF form data with Java and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fexport-form-data\u002F\">Export Form Data API Tool\u003C\u002Fa>. The example sends a completed form to \u003Ccode>\u002Fexported-form-data\u003C\u002Fcode> and receives its field values as a separate structured resource for downstream processing. We'll explain the important request pieces so you can use the sample as the foundation for an integration that can export PDF form data.\u003C\u002Fp>\n\n\u003Ch2>Why Export PDF Form Data with Java?\u003C\u002Fh2>\n\n\u003Cp>A permit portal may receive filled forms that humans can read but backend systems still need as structured field data. Exporting the form values avoids manually transcribing submissions.\u003C\u002Fp>\n\n\u003Cp>The Java request sends the PDF to \u003Ccode>\u002Fexported-form-data\u003C\u002Fcode> and selects an export format. The output resource contains the form data rather than a modified PDF.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class ExportedFormData {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"data_format\", \"xml\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fexported-form-data\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FExportedFormData.java\">Java sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The supporting code relies on OkHttp to send the call, dotenv to resolve credentials, and \u003Ccode>org.json\u003C\u002Fcode> to inspect or format JSON.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>This setup shows where the input comes from and keeps the credential outside the request-building logic.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"data_format\", \"xml\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fexported-form-data\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The Java request sends the PDF to \u003Ccode>\u002Fexported-form-data\u003C\u002Fcode> and selects an export format. The output resource contains the form data rather than a modified PDF. The body construction sets \u003Ccode>MultipartBody.FORM\u003C\u002Fcode>, allowing OkHttp to generate the matching boundary automatically.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fexported-form-data\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>This builder chain joins authentication, routing, and payload in one place while leaving regional service selection in the API URL constant.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>This completion path makes success and failure information available to the caller, including any temporary resources that must be saved or reused before expiration.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By working through this example, you now have a Java pattern you can use to export PDF form data. With that foundation, exported data can feed databases, validation services, workflow routing, and audit records.\u003C\u002Fp>\n\n\u003Cp>When this becomes part of an application, keep in mind that field names are the durable link between the PDF and downstream systems, so preserve them when forms are revised. Confirm the form technology and chosen export representation with real submissions before using exported values for validation, routing, or database updates.\u003C\u002Fp>\n\n\u003Cp>\u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> lets you try the Export PDF Form Data operation without first building an application. When you are ready to implement it, see the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-form-data\u002F\">Export Form Data API Tool documentation\u003C\u002Fa> for the complete API contract.\u003C\u002Fp>\n\n\u003Cp>Note: The Export PDF Form Data example above uses multipart form data; for callers that have already uploaded the source, see the request shape in the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FExportedFormData.java\">JSON payload example\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-02T18:28:37.000+00:00","2026-09-01T21:57:38.000+00:00","Export completed PDF form values with Java for downstream data processing.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-java\u002F#article\",\n      \"headline\": \"How to Export PDF Form Data with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:38.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:38.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Export completed PDF form values with Java for downstream data processing.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Export Form Data API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fexport-form-data\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fexported-form-data API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-form-data\"\n        }\n      ],\n      \"keywords\": \"Data, Export Form Data, Extract, Forms, Java\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Export PDF Form Data with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8378,8379,8380,8381,8382,8383,8384],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1802,"name":1803,"slug":1804,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1782,"name":1783,"slug":1784,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-export-pdf-form-data-with-java\u002F","Export PDF Form Data with Java | pdfRest",{"id":8389,"uuid":8390,"title":8391,"slug":8392,"html":8393,"comment_id":8394,"feature_image":48,"featured":284,"visibility":1257,"created_at":8395,"updated_at":8373,"published_at":8395,"custom_excerpt":48,"codeinjection_head":8396,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8397,"primary_tag":8402,"url":8403,"excerpt":8404,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8405,"meta_description":8406,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1349","3a27ba8b-ade8-47f2-8a04-fccdba506295","How to Export PDF Form Data with JavaScript","how-to-export-pdf-form-data-with-javascript","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Export PDF Form Data with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fexport-form-data\u002F\">Export Form Data API Tool\u003C\u002Fa> allows users to extract form data from a PDF and convert it into a specified format such as XML, FDF, or XFDF. This tutorial will guide you through the process of sending an API call to Export Form Data using JavaScript. This can be particularly useful when you need to programmatically extract form data from a large number of PDFs for data analysis or migration to another system.\u003C\u002Fp>\n\n\u003Ch2>JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to export PDF form data as XML.\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('data_format', 'xml');\ndata.append('output', 'pdfrest_exported_form_data');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fexported-form-data',\n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error);\n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fexported-form-data.js\">pdf-rest-api-samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the JavaScript Code\u003C\u002Fh2>\n\n\u003Cp>The NodeJS sample uses \u003Ccode>axios\u003C\u002Fcode> for HTTP, \u003Ccode>form-data\u003C\u002Fcode> for multipart construction, and the built-in \u003Ccode>fs\u003C\u002Fcode> module for the input stream. Install the external dependencies with \u003Ccode>npm install axios form-data\u003C\u002Fcode> when adapting this file outside the samples project.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\u003C\u002Fpre>\n\n\u003Cp>These modules let the request stream a PDF rather than loading the entire file into a JSON object or encoding it as text.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('data_format', 'xml');\ndata.append('output', 'pdfrest_exported_form_data');\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>file\u003C\u002Fcode> is the fillable PDF. \u003Ccode>data_format\u003C\u002Fcode> is required and must match the form technology: AcroForms support \u003Ccode>fdf\u003C\u002Fcode>, \u003Ccode>xfdf\u003C\u002Fcode>, and \u003Ccode>xml\u003C\u002Fcode>, while XFA forms support \u003Ccode>xdp\u003C\u002Fcode>, \u003Ccode>xfd\u003C\u002Fcode>, and \u003Ccode>xml\u003C\u002Fcode>. If the form type is unknown, Query PDF can check \u003Ccode>contains_acroforms\u003C\u002Fcode> and \u003Ccode>contains_xfa\u003C\u002Fcode>. \u003Ccode>output\u003C\u002Fcode> names the exported data file without its extension.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fexported-form-data',\n  headers: {\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data: data\n};\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>data.getHeaders()\u003C\u002Fcode> contributes the multipart content type and boundary generated by \u003Ccode>form-data\u003C\u002Fcode>. Spreading those headers into the Axios configuration is important; manually setting only \u003Ccode>multipart\u002Fform-data\u003C\u002Fcode> would omit the boundary that separates the fields.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error);\n});\u003C\u002Fpre>\n\n\u003Cp>The success handler prints the generated resource information. The error handler exposes transport or API failures; production code can inspect \u003Ccode>error.response\u003C\u002Fcode> to distinguish an HTTP response from a client-side failure.\u003C\u002Fp>\n\n\u003Ch2>Next Steps with pdfRest\u003C\u002Fh2>\n\n\u003Cp>This tutorial explained how to use JavaScript to call the pdfRest Export Form Data API to extract data from a PDF file. By following the steps outlined, you can programmatically export form data from PDFs into various formats.\u003C\u002Fp>\n\n\u003Cp>Feel free to demo all of the pdfRest API Tools in the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\u003C\u002Fa> and refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa> for more details.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fexported-form-data.js\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","657bbe022d4014c9499b3876","2023-12-15T02:46:26.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-javascript\u002F#article\",\n      \"headline\": \"How to Export PDF Form Data with JavaScript\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-javascript\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-javascript\u002F\",\n      \"datePublished\": \"2023-12-15T02:46:26.000Z\",\n      \"dateModified\": \"2026-09-01T14:25:29.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to export data from PDF form fields using JavaScript with the Export Form Data API Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Export Form Data API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fexport-form-data\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fexported-form-data API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-form-data\"\n        }\n      ],\n      \"keywords\": \"Export Form Data, JavaScript\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Export PDF Form Data with JavaScript\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-javascript\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8398,8399,8400,8401],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1802,"name":1803,"slug":1804,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-export-pdf-form-data-with-javascript\u002F","\n\n\n\n\nWhy Export PDF Form Data with JavaScript?\n\n\n\nThe pdfRest Export Form Data API Tool allows users to extract form data from a PDF and convert it into a specified format such as XML, FDF, or XFDF. This tutorial will guide you through the process of sending an API call to Export Form Data using JavaScript. This can be particularly useful when you need to programmatically extract form data from a large number of PDFs for data analysis or migration to another system.\n\n\n\n\nJavaScript Code Example\n\n","How to Export PDF Form Data with JavaScript, Tutorial | pdfRest","Learn how to export data from PDF form fields using JavaScript with the Export Form Data API Tool from pdfRest.",{"id":8408,"uuid":8409,"title":8410,"slug":8411,"html":8412,"comment_id":8413,"feature_image":48,"featured":284,"visibility":1257,"created_at":8414,"updated_at":8415,"published_at":8414,"custom_excerpt":48,"codeinjection_head":8416,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8417,"primary_tag":8422,"url":8423,"excerpt":8424,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8425,"meta_description":8426,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1347","cfeeb757-14a8-4933-91cf-35c15feaa92d","How to Export PDF Form Data with PHP","how-to-export-pdf-form-data-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Export PDF Form Data with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fexport-form-data\u002F\">Export Form Data API Tool\u003C\u002Fa> allows users to extract form data from PDF forms fields. This can be particularly useful in scenarios where you need to automate the collection of data from a large number of submitted forms, such as applications, surveys, or registrations. In this tutorial, we will show how to send an API call to the Export Form Data endpoint using PHP to programmatically retrieve form data from PDFs.\u003C\u002Fp>\n\n\u003Ch2>PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile', \u002F\u002F Set the filename for the file to be processed, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'data_format', \u002F\u002F Specify the field name for the data file format.\n      'contents' => 'xml' \u002F\u002F Set the value for the data file format (in this case, 'xml').\n    ],\n    [\n      'name' => 'output', \u002F\u002F Specify the field name for the output option.\n      'contents' => 'pdfrest_exported_form_data' \u002F\u002F Set the value for the output option (in this case, 'pdfrest_exported_form_data').\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fexported-form-data', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the exported form data content.\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fexported-form-data.php\">GitHub - datalogics\u002Fpdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the PHP\u003C\u002Fh2>\n\n\u003Cp>The code starts by loading the necessary classes from the Guzzle HTTP client library, which is a PHP HTTP client that makes it easy to send HTTP requests and trivial to integrate with web services.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">use GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\u003C\u002Fpre>\n\n\u003Cp>Next, we set up the headers for the request, including the 'Api-Key' which is used for authentication with the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The options array is then configured with the 'multipart' content. This includes:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>'file': The file to be processed, with its path and content type.\u003C\u002Fli>\n\u003Cli>'data_format': The format in which the form data should be exported (e.g., 'xml').\u003C\u002Fli>\n\u003Cli>'output': The name of the output option, which determines the naming convention of the exported data.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-php\">$options = [\n  \u002F\u002F ...multipart array configuration...\n];\n\u003C\u002Fpre>\n\n\u003Cp>A new HTTP POST request is created with the specified endpoint and headers, and the request is sent asynchronously. The response is then retrieved and the body of the response, which contains the exported form data, is outputted.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fexported-form-data', $headers);\n$res = $client->sendAsync($request, $options)->wait();\necho $res->getBody();\n\u003C\u002Fpre>\n\n\u003Ch2>Documentation, API Labs, and So Much More\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we have explored how to use PHP to call the pdfRest Export Form Data API. By sending a properly constructed API call, we can programmatically extract form data from PDFs and use it for further processing or analysis.\u003C\u002Fp>\n\n\u003Cp>Feel free to demo all of the pdfRest API Tools in the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\u003C\u002Fa> and refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa> for more information.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fexported-form-data.php\">GitHub - datalogics\u002Fpdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","657bbd962d4014c9499b3862","2023-12-15T02:44:38.000+00:00","2026-09-10T20:19:16.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-php\u002F#article\",\n      \"headline\": \"How to Export PDF Form Data with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-php\u002F\",\n      \"datePublished\": \"2023-12-15T02:44:38.000Z\",\n      \"dateModified\": \"2026-09-01T14:24:01.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to export data from PDF form fields in PHP using the Export Form Data API Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Export Form Data API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fexport-form-data\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fexported-form-data API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-form-data\"\n        }\n      ],\n      \"keywords\": \"Export Form Data, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Export PDF Form Data with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8418,8419,8420,8421],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1802,"name":1803,"slug":1804,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-export-pdf-form-data-with-php\u002F","\n\n\n\n\nWhy Export PDF Form Data with PHP?\n\n\n\nThe pdfRest Export Form Data API Tool allows users to extract form data from PDF forms fields. This can be particularly useful in scenarios where you need to automate the collection of data from a large number of submitted forms, such as applications, surveys, or registrations. In this tutorial, we will show how to send an API call to the Export Form Data endpoint using PHP to programmatically retrieve form data from PDFs.\n\n\n\n\nPHP Code Example\n\n\n\nrequir","How to Export PDF Form Data with PHP, Tutorial | pdfRest","Learn how to export data from PDF form fields in PHP using the Export Form Data API Tool from pdfRest.",{"id":8428,"uuid":8429,"title":8430,"slug":8431,"html":8432,"comment_id":8433,"feature_image":48,"featured":284,"visibility":1257,"created_at":8434,"updated_at":8435,"published_at":8434,"custom_excerpt":48,"codeinjection_head":8436,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8437,"primary_tag":8442,"url":8443,"excerpt":8444,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8445,"meta_description":8446,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1346","76f07aee-8007-4d59-a2d3-6c8ddc26bede","How to Export PDF Form Data with Python","how-to-export-pdf-form-data-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Export PDF Form Data with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fexport-form-data\u002F'>Export Form Data API Tool\u003C\u002Fa> is designed to extract data from fillable forms within a PDF document. This functionality is particularly useful for automating the collection of form data for analysis or integration into other systems. For instance, an organization might use this API to extract survey responses or application form data without manual data entry.\u003C\u002Fp>\n\n\u003Cp>In this tutorial, we will demonstrate how to send an API call to the Export Form Data endpoint using Python. We will walk through the code to understand how it works and how to set up the necessary parameters for the API request.\u003C\u002Fp>\n\n\u003Ch2>Python Code Sample for Form Export\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nexported_form_data_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fexported-form-data'\n\nmp_encoder_exportedFormData = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_exportedFormData_out',\n        'data_format': 'xml',\n    }\n)\n\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_exportedFormData.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\n\nprint(\"Sending POST request to exported-form-data endpoint...\")\nresponse = requests.post(exported_form_data_endpoint_url, data=mp_encoder_exportedFormData, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>The source of the provided code is available at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fexported-form-data.py\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Python\u003C\u002Fh2>\n\n\u003Cp>The code snippet above demonstrates how to call the Export Form Data API endpoint:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\u003C\u002Fpre>\n\n\u003Cp>This imports the necessary libraries: \u003Ccode>MultipartEncoder\u003C\u002Fcode> for creating multipart\u002Fform-data payloads, \u003Ccode>requests\u003C\u002Fcode> for making HTTP requests, and \u003Ccode>json\u003C\u002Fcode> for handling JSON data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">exported_form_data_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fexported-form-data'\n\u003C\u002Fpre>\n\n\u003Cp>This sets the URL of the Export Form Data API endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_exportedFormData = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_exportedFormData_out',\n        'data_format': 'xml',\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>This creates a \u003Ccode>MultipartEncoder\u003C\u002Fcode> object with the fields required by the API:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Ccode>file\u003C\u002Fcode>: The PDF file to be processed. It should be opened in binary read mode.\u003C\u002Fli>\n\u003Cli>\u003Ccode>output\u003C\u002Fcode>: The desired name for the output file.\u003C\u002Fli>\n\u003Cli>\u003Ccode>data_format\u003C\u002Fcode>: The format in which to export the form data, which can be 'xml', 'json', or 'csv'.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_exportedFormData.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\n\u003C\u002Fpre>\n\n\u003Cp>These are the headers for the HTTP request, including the API key for authentication.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(exported_form_data_endpoint_url, data=mp_encoder_exportedFormData, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This sends a POST request to the API endpoint with the multipart form data and headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>If the request is successful, it prints the JSON response. Otherwise, it prints the error text.\u003C\u002Fp>\n\n\u003Ch2>Next Steps with pdfRest\u003C\u002Fh2>\n\n\u003Cp>We've gone through the process of setting up and making an API call to the pdfRest Export Form Data endpoint using Python. By following this tutorial, you should be able to extract form data from PDFs programmatically.\u003C\u002Fp>\n\n\u003Cp>Feel free to demo all of the pdfRest API Tools in the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\u003C\u002Fa> and refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fexported-form-data.py\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","657bbd4b2d4014c9499b3858","2023-12-15T02:43:23.000+00:00","2026-09-02T18:28:38.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-python\u002F#article\",\n      \"headline\": \"How to Export PDF Form Data with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-python\u002F\",\n      \"datePublished\": \"2023-12-15T02:43:23.000Z\",\n      \"dateModified\": \"2026-09-01T14:24:01.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to export data from PDF form fields with Python via the Export Form Data API Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Export Form Data API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fexport-form-data\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fexported-form-data API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-form-data\"\n        }\n      ],\n      \"keywords\": \"Export Form Data, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Export PDF Form Data with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-export-pdf-form-data-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8438,8439,8440,8441],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1802,"name":1803,"slug":1804,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-export-pdf-form-data-with-python\u002F","\n\n\n\n\nWhy Export PDF Form Data with Python?\n\n\n\nThe pdfRest Export Form Data API Tool is designed to extract data from fillable forms within a PDF document. This functionality is particularly useful for automating the collection of form data for analysis or integration into other systems. For instance, an organization might use this API to extract survey responses or application form data without manual data entry.\n\n\n\nIn this tutorial, we will demonstrate how to send an API call to the Export Form","How to Export PDF Form Data with Python, Tutorial | pdfRest","Learn how to export data from PDF form fields with Python via the Export Form Data API Tool from pdfRest.",{"id":8448,"uuid":8449,"title":8450,"slug":8451,"html":8452,"comment_id":8448,"feature_image":48,"featured":284,"visibility":1257,"created_at":8453,"updated_at":8435,"published_at":8453,"custom_excerpt":8454,"codeinjection_head":8455,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8456,"primary_tag":8464,"url":8465,"excerpt":8454,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8466,"meta_description":8454,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"673ec949533c9f26b9438fdd","6bb9e3dc-4064-4e4c-bf0a-3158e85e4f7f","How to Extract Images from PDF Files in .NET with C#","how-to-extract-images-from-pdf-files-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Extract PDF Images with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-images\u002F'>Extract Images API Tool\u003C\u002Fa> is a powerful resource that allows developers to extract images from PDF files programmatically. This tutorial will guide you through the process of sending an API call to extract images using C#. By integrating this API into your C# application, you can automate the extraction of images from PDFs, making it easier to handle large volumes of documents or integrate this functionality into a larger document processing workflow.\u003C\u002Fp>\n\n\u003Cp>Extracting images from PDFs can be incredibly useful. For example, a company might receive numerous PDF reports containing graphs and charts that need to be analyzed separately. By using the Extract Images API, they can automate the extraction of these visual elements, allowing for more efficient data processing and analysis. This can save time and reduce the potential for errors compared to manual extraction.\u003C\u002Fp>\n\n\u003Ch2>Extract PDF Images with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"extracted-images\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"1-last\"));\n        multipartContent.Add(byteArrayOption, \"pages\");\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fextracted-images.cs\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by setting up an \u003Ccode>HttpClient\u003C\u002Fcode> with the base address of the pdfRest API:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>Next, an \u003Ccode>HttpRequestMessage\u003C\u002Fcode> is created to send a POST request to the \"extracted-images\" endpoint:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var request = new HttpRequestMessage(HttpMethod.Post, \"extracted-images\"))\n\u003C\u002Fpre>\n\n\u003Cp>The API key is added to the request headers for authentication:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>The request is set to accept JSON responses:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n\u003C\u002Fpre>\n\n\u003Cp>A \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> is prepared to hold the PDF file and additional options. The file is read into a byte array and added to the content:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\u003C\u002Fpre>\n\n\u003Cp>The \"pages\" parameter specifies which pages to extract images from, in this case, all pages from 1 to the last:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"1-last\"));\nmultipartContent.Add(byteArrayOption, \"pages\");\n\u003C\u002Fpre>\n\n\u003Cp>The request content is set, and the request is sent asynchronously. The response is read and printed to the console:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\nvar apiResult = await response.Content.ReadAsStringAsync();\nConsole.WriteLine(\"API response received.\");\nConsole.WriteLine(apiResult);\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use C# to send a request to the pdfRest Extract Images API and handle the response. This allows you to automate the process of extracting images from PDF documents efficiently. To explore more functionalities, try out all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on each API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example demonstrates a multipart API call. For code samples using JSON payloads, visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fextracted-images.cs\">this GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-21T05:46:49.000+00:00","Learn how to extract all images from PDFs with C# using pdfRest Extract Images API tool","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Extract Images from PDF Files in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-11-21T05:46:49.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:21.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to extract all images from PDFs with C# using pdfRest Extract Images API tool\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Extract Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fextracted-images API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-images\"\n        }\n      ],\n      \"keywords\": \".NET, Extract Images, JPG, PNG, TIFF\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Extract Images from PDF Files in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8457,8458,8459,8460,8461,8462,8463],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1496,"name":1497,"slug":1498,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1542,"name":1543,"slug":1544,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1554,"name":1555,"slug":1556,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1546,"name":1547,"slug":1548,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-extract-images-from-pdf-files-in-net-with-c\u002F","How to Extract Images from PDF Files in .NET with C#, Tutorial | pdfRest",{"id":8468,"uuid":8469,"title":8470,"slug":8471,"html":8472,"comment_id":8468,"feature_image":48,"featured":284,"visibility":1257,"created_at":8473,"updated_at":8474,"published_at":8473,"custom_excerpt":8475,"codeinjection_head":8476,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8477,"primary_tag":8485,"url":8486,"excerpt":8475,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8487,"meta_description":8475,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"673ec9b1533c9f26b9438ff1","d538bb87-4d80-472c-8cfe-aa0cd4c890d6","How to Extract Images from PDF Files with cURL","how-to-extract-images-from-pdf-files-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Extract PDF Images with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-images\u002F'>Extract Images API Tool\u003C\u002Fa> is a powerful resource for developers and users who need to extract images from PDF documents efficiently. By leveraging this tool, you can automate the process of pulling images from PDFs, which can be particularly useful for batch processing or integrating into larger workflows. This tutorial will demonstrate how to send an API call using cURL to extract images from a PDF document.\u003C\u002Fp>\n\n\u003Cp>Imagine you are working for a company that receives numerous PDF reports daily, each containing valuable images that need to be archived separately. Instead of manually extracting each image, you can use the Extract Images API Tool to automate this task, saving time and reducing the potential for human error. This automation can streamline workflows and ensure that image assets are efficiently managed and stored.\u003C\u002Fp>\n\n\u003Ch2>Extract PDF Images with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fextracted-images\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\" \\\n  -F \"pages=1-last\"\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fextracted-images.sh\">GitHub - pdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>Let's break down the provided cURL command to understand each component:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fextracted-images\"\u003C\u002Fpre>\n\n\u003Cp>This line initiates a POST request to the Extract Images endpoint of the pdfRest API. The POST method is used here because we are sending data to the server to process.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the client expects the server to respond with JSON-formatted data. JSON is a lightweight data interchange format that is easy for humans to read and write.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\u003C\u002Fpre>\n\n\u003Cp>This header specifies that the request body will be sent as multipart\u002Fform-data. This is necessary when uploading files because it allows the file to be sent as binary data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\u003C\u002Fpre>\n\n\u003Cp>The API key is a unique identifier used to authenticate the request. You must replace the placeholder with your actual API key to authorize your request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\u003C\u002Fpre>\n\n\u003Cp>This form field specifies the file to be uploaded. The '@' symbol tells cURL to read the file from the specified path. Replace '\u002Fpath\u002Fto\u002Ffile' with the actual path to your PDF document.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\u003C\u002Fpre>\n\n\u003Cp>This form field sets the name of the output file. In this example, the extracted images will be saved with a prefix 'example_out'.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"pages=1-last\"\u003C\u002Fpre>\n\n\u003Cp>This field defines the range of pages from which images will be extracted. '1-last' means that images will be extracted from the first page to the last page of the PDF.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use cURL to make an API call to the pdfRest Extract Images endpoint. This process allows you to extract images from PDF files efficiently. To explore more functionalities, consider experimenting with all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further details, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fextracted-images.sh\">GitHub - JSON Payload Examples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-21T05:48:33.000+00:00","2026-09-02T18:28:39.000+00:00","Learn how to use pdfRest Extract Images API tool to extract all images from PDFs with cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-curl\u002F#article\",\n      \"headline\": \"How to Extract Images from PDF Files with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-curl\u002F\",\n      \"datePublished\": \"2024-11-21T05:48:33.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:21.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Extract Images API tool to extract all images from PDFs with cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Extract Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fextracted-images API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-images\"\n        }\n      ],\n      \"keywords\": \"Extract Images, JPG, PNG, TIFF, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Extract Images from PDF Files with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8478,8479,8480,8481,8482,8483,8484],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1496,"name":1497,"slug":1498,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1546,"name":1547,"slug":1548,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1542,"name":1543,"slug":1544,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1554,"name":1555,"slug":1556,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-extract-images-from-pdf-files-with-curl\u002F","How to Extract Images from PDF Files with cURL, Tutorial | pdfRest",{"id":8489,"uuid":8490,"title":8491,"slug":8492,"html":8493,"comment_id":8489,"feature_image":48,"featured":284,"visibility":1257,"created_at":8494,"updated_at":8495,"published_at":8494,"custom_excerpt":8496,"codeinjection_head":8497,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8498,"primary_tag":8506,"url":8507,"excerpt":8496,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8508,"meta_description":8496,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"673ec9e3533c9f26b9438ffb","97e4c812-9856-4bee-a352-70e10cb2466a","How to Extract Images from PDF Files with Java","how-to-extract-images-from-pdf-files-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Extract Embedded Images from a PDF in Java\u003C\u002Fh2>\n\n\u003Cp>When an application needs the photographs, diagrams, logos, or other assets inside a PDF, rendering whole pages adds surrounding text and layout that the asset workflow does not need. The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-images\u002F\">Extract Images API Tool\u003C\u002Fa> retrieves the embedded image objects themselves, preserving their native formats and properties whenever possible.\u003C\u002Fp>\n\n\u003Cp>That makes the output useful for digital asset management, publishing, content reuse, and visual-analysis pipelines without forcing every asset through an additional rendering or conversion process. Targeted page ranges and resource-ID input support both one-off uploads and multi-step document workflows.\u003C\u002Fp>\n\n\u003Cp>For example, a Java-based publishing system can extract figures from submitted technical papers and route them to an editorial review queue. Page-aware filenames help editors trace each figure back to the document location where it first appeared, while native-format extraction preserves the image for later print or digital use.\u003C\u002Fp>\n\n\u003Cp>This example uses OkHttp to upload a local PDF as multipart form data and \u003Ccode>org.json\u003C\u002Fcode> to format the response.\u003C\u002Fp>\n\u003Ch2>Java Extract Images Code Example\u003C\u002Fh2>\n\n\u003Cp>Add OkHttp, java-dotenv, and JSON-java to the project, then set \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode> in the environment or a local \u003Ccode>.env\u003C\u002Fcode> file. Pass the PDF path as the first command-line argument or replace \u003Ccode>DEFAULT_FILE_PATH\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONObject;\n\npublic class ExtractedImages {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  private static final String PAGES = \"1-last\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"pages\", PAGES)\n            .addFormDataPart(\"output\", \"pdfrest_extracted_images\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fextracted-images\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FExtractedImages.java\">pdfRest Extract Images multipart Java sample\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Cp>If the source PDF already has a pdfRest resource ID, send a JSON payload instead of uploading it again as multipart data. See the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FExtractedImages.java\">Extract Images JSON-payload sample for Java\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Build the OkHttp Multipart Request\u003C\u002Fh2>\n\n\u003Cp>The sample creates a file request body with the \u003Ccode>application\u002Fpdf\u003C\u002Fcode> media type, then adds it to a \u003Ccode>MultipartBody\u003C\u002Fcode> under the \u003Ccode>file\u003C\u002Fcode> field. The \u003Ccode>pages\u003C\u002Fcode> value of \u003Ccode>1-last\u003C\u002Fcode> tells pdfRest to inspect the complete document. To limit processing, use individual pages and ranges such as \u003Ccode>1,2,5-10,12-last\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>output\u003C\u002Fcode> value establishes a base name for every extracted asset. pdfRest adds an image sequence and the source page number to each name, producing results such as \u003Ccode>pdfrest_extracted_images-img001-page002\u003C\u002Fcode>. Predictable naming helps downstream code associate an asset with its location in the document even when one request returns several files.\u003C\u002Fp>\n\n\u003Cp>The request reads the API key through \u003Ccode>Dotenv\u003C\u002Fcode> and posts to \u003Ccode>API_URL + \"\u002Fextracted-images\"\u003C\u002Fcode>. The default base URL uses the US Cloud API; the alternate constant shown in the code selects EU-based processing when required.\u003C\u002Fp>\n\n\u003Ch2>Process Results and Empty Responses\u003C\u002Fh2>\n\n\u003Cp>A successful extraction can return multiple output URLs and resource IDs. Parse these collections and handle each image rather than assuming a single output. Download URLs support retrieving the files, while resource IDs let another pdfRest operation use an image without an intermediate download and re-upload.\u003C\u002Fp>\n\n\u003Cp>Not every PDF contains extractable image objects. When none are found, pdfRest can return \u003Ccode>200 OK\u003C\u002Fcode> with a warning and empty \u003Ccode>outputUrl\u003C\u002Fcode> and \u003Ccode>outputId\u003C\u002Fcode> arrays. The application should distinguish this valid outcome from an error and decide whether no images is expected, reportable, or a reason to use a different operation such as rendering complete pages.\u003C\u002Fp>\n\n\u003Ch2>Strengthen Response Handling for Production\u003C\u002Fh2>\n\n\u003Cp>The example sets a 60-second read timeout and prints the status code and formatted response body. Production Java code should also verify \u003Ccode>response.isSuccessful()\u003C\u002Fcode>, parse the expected fields only after a successful status, and handle network failures separately from API validation errors. Use try-with-resources around the OkHttp \u003Ccode>Response\u003C\u002Fcode> so its body is always closed, especially in a service that processes many requests.\u003C\u002Fp>\n\n\u003Cp>Keep the API key out of source control and prevent sensitive document data from entering application logs. Apply the application's input-path and file policies before constructing the request, then use the returned collections to handle varied image formats and output counts consistently.\u003C\u002Fp>\n\n\u003Cp>You can generate requests in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and review the current request and response schema in the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-images\">Extract Images API reference\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-21T05:49:23.000+00:00","2026-09-22T19:02:57.000+00:00","Learn how to use pdfRest Extract Images API tool to extract all images from PDFs with Java","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-java\u002F#article\",\n      \"headline\": \"How to Extract Images from PDF Files with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-java\u002F\",\n      \"datePublished\": \"2024-11-21T05:49:23.000Z\",\n      \"dateModified\": \"2026-09-22T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Extract Images API tool to extract all images from PDFs with Java\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Extract Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fextracted-images API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-images\"\n        }\n      ],\n      \"keywords\": \"Extract Images, JPG, Java, PNG, TIFF\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Extract Images from PDF Files with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8499,8500,8501,8502,8503,8504,8505],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1496,"name":1497,"slug":1498,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1546,"name":1547,"slug":1548,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1554,"name":1555,"slug":1556,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1542,"name":1543,"slug":1544,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-extract-images-from-pdf-files-with-java\u002F","How to Extract Images from PDF Files with Java, Tutorial | pdfRest",{"id":8510,"uuid":8511,"title":8512,"slug":8513,"html":8514,"comment_id":8510,"feature_image":48,"featured":284,"visibility":1257,"created_at":8515,"updated_at":8516,"published_at":8515,"custom_excerpt":8517,"codeinjection_head":8518,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8519,"primary_tag":8527,"url":8528,"excerpt":8517,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8529,"meta_description":8517,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"673ec98e533c9f26b9438fe7","92cde534-b851-431a-9bab-6ace0e326b57","How to Extract Images from PDF Files with JavaScript in NodeJS","how-to-extract-images-from-pdf-files-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Extract Embedded PDF Images with Node.js\u003C\u002Fh2>\n\n\u003Cp>A PDF can contain photographs, logos, diagrams, screenshots, and other image assets that need to be reused or analyzed separately from the document. Rendering each PDF page as a new image is not the same operation: page rendering creates a picture of the entire page, while the pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-images\u002F\">Extract Images API Tool\u003C\u002Fa> retrieves the images embedded inside the PDF.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>\u002Fextracted-images\u003C\u002Fcode> endpoint preserves the native image format and original image properties whenever possible, including common JPEG, PNG, and TIFF assets. This avoids an unnecessary conversion step and helps retain resolution, color accuracy, and compression properties for digital asset management, content repurposing, publishing, or image-analysis workflows.\u003C\u002Fp>\n\n\u003Cp>For example, a Node.js product-ingestion service can receive a supplier's PDF catalog, extract the embedded product photographs, and associate the returned files with catalog records. The service can associate each returned native image with its catalog record without manually opening the PDF or rendering every page into a new bitmap.\u003C\u002Fp>\n\n\u003Cp>This Node.js example streams a local PDF into a multipart request with Axios and FormData, processes all pages, and prints the JSON response.\u003C\u002Fp>\n\u003Ch2>JavaScript Extract Images Code Example\u003C\u002Fh2>\n\n\u003Cp>Install \u003Ccode>axios\u003C\u002Fcode> and \u003Ccode>form-data\u003C\u002Fcode>, then replace the PDF path and API-key placeholders. The built-in \u003Ccode>fs\u003C\u002Fcode> module supplies a readable stream, so the application does not have to load the complete PDF into memory before sending it.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to extract embedded images from a PDF.\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('pages', '1-last');\ndata.append('output', 'pdfrest_extracted_images');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: apiUrl + '\u002Fextracted-images',\n  headers: {\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error);\n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fextracted-images.js\">pdfRest Extract Images multipart JavaScript sample\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Cp>If the source PDF already has a pdfRest resource ID, send a JSON payload instead of uploading it again as multipart data. See the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fextracted-images.js\">Extract Images JSON-payload sample for JavaScript\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Select the PDF Pages to Process\u003C\u002Fh2>\n\n\u003Cp>The \u003Ccode>pages\u003C\u002Fcode> field determines where pdfRest looks for embedded images. The sample uses \u003Ccode>1-last\u003C\u002Fcode> to process the entire PDF. Applications can target only the relevant pages with individual numbers, ranges, or a combination such as \u003Ccode>1,2,5-10,12-last\u003C\u002Fcode>. Limiting the request is useful when a long document contains appendices or other sections that do not need image extraction.\u003C\u002Fp>\n\n\u003Cp>The optional \u003Ccode>output\u003C\u002Fcode> field supplies the base name for the extracted files. pdfRest appends image and page numbers so each result remains distinct. For example, an output value of \u003Ccode>test\u003C\u002Fcode> produces names such as \u003Ccode>test-img001-page002\u003C\u002Fcode>. Including both values makes it easier to connect each extracted asset with the page where it first appeared.\u003C\u002Fp>\n\n\u003Ch2>Work with Multiple Output Files\u003C\u002Fh2>\n\n\u003Cp>One PDF can produce many extracted images, so the success response uses output collections rather than a single file value. Iterate over the available output URLs or resource IDs, then route each asset to the next application step. Resource IDs can continue through compatible pdfRest operations without intermediate transfers, while output URLs support storage in the application's own asset repository.\u003C\u002Fp>\n\n\u003Cp>A PDF may also contain no embedded images. In that case, the endpoint can return \u003Ccode>200 OK\u003C\u002Fcode> with a warning and empty \u003Ccode>outputUrl\u003C\u002Fcode> and \u003Ccode>outputId\u003C\u002Fcode> arrays. Treat that as a valid no-results outcome rather than assuming every successful HTTP response contains at least one file.\u003C\u002Fp>\n\u003Ch2>Make the Axios Request Production-Ready\u003C\u002Fh2>\n\n\u003Cp>\u003Ccode>data.getHeaders()\u003C\u002Fcode> supplies the correct multipart \u003Ccode>Content-Type\u003C\u002Fcode> value and boundary. The sample adds the API key and sets \u003Ccode>maxBodyLength\u003C\u002Fcode> to \u003Ccode>Infinity\u003C\u002Fcode> so Axios does not reject the upload based on its client-side body limit. Keep the API key in an environment variable or secret manager rather than source code.\u003C\u002Fp>\n\n\u003Cp>The example logs either the response or the error. In an application, set an appropriate timeout, distinguish HTTP errors from connection failures, and avoid logging document content or credentials. Apply the application's file-type and size policies before submission, then use the returned collection to route every extracted asset into the next workflow step.\u003C\u002Fp>\n\n\u003Cp>Use the configurable base URL to select the US or EU Cloud API. You can try different page ranges in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and review the current parameters and response schema in the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-images\">Extract Images API reference\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-21T05:47:58.000+00:00","2026-09-22T19:02:56.000+00:00","Learn how to extract all images from PDFs with pdfRest Extract Images API tool using JavaScript","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Extract Images from PDF Files with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-11-21T05:47:58.000Z\",\n      \"dateModified\": \"2026-09-22T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to extract all images from PDFs with pdfRest Extract Images API tool using JavaScript\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Extract Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fextracted-images API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-images\"\n        }\n      ],\n      \"keywords\": \"Extract Images, JPG, JavaScript, PNG, TIFF\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Extract Images from PDF Files with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8520,8521,8522,8523,8524,8525,8526],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1496,"name":1497,"slug":1498,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1546,"name":1547,"slug":1548,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1542,"name":1543,"slug":1544,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1554,"name":1555,"slug":1556,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-extract-images-from-pdf-files-with-javascript-in-nodejs\u002F","How to Extract Images from PDF Files with JavaScript in NodeJS, Tutorial | pdfRest",{"id":8531,"uuid":8532,"title":8533,"slug":8534,"html":8535,"comment_id":8531,"feature_image":48,"featured":284,"visibility":1257,"created_at":8536,"updated_at":8537,"published_at":8536,"custom_excerpt":8538,"codeinjection_head":8539,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8540,"primary_tag":8548,"url":8549,"excerpt":8538,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8550,"meta_description":8538,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"673ec913533c9f26b9438fd3","bd357f09-625e-43df-a67d-6725f3c6d4c8","How to Extract Images from PDF Files with PHP","how-to-extract-images-from-pdf-files-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Extract PDF Images with PHP and Guzzle\u003C\u002Fh2>\n\n\u003Cp>PDFs often package photographs, illustrations, charts, logos, and scanned content inside a larger document. When an application needs those assets independently, rendering each complete page creates extra content and can change the asset's characteristics. The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-images\u002F\">Extract Images API Tool\u003C\u002Fa> retrieves the embedded image objects directly from the PDF.\u003C\u002Fp>\n\n\u003Cp>Extracted assets retain native formats and properties whenever possible, including common JPEG, PNG, and TIFF images. PHP applications can use that output to populate a digital asset system, repurpose publication graphics, or pass visual data to another workflow without building and maintaining a local PDF image parser.\u003C\u002Fp>\n\n\u003Cp>For example, a PHP content-management portal can accept a press kit as a PDF, extract its embedded logos and photographs, and make those assets available to an editor for selection. Automating that step reduces repetitive file handling and keeps the PDF and its extracted assets connected within the same intake workflow.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>\u002Fextracted-images\u003C\u002Fcode> example uses Guzzle to send a PDF and parameters as multipart form data. The response identifies every extracted output so the application can retrieve or reuse the files.\u003C\u002Fp>\n\u003Ch2>PHP Extract Images Code Example\u003C\u002Fh2>\n\n\u003Cp>Install Guzzle with Composer, load Composer's autoloader, and replace the file path and API-key placeholders. The corrected example identifies the uploaded file as \u003Ccode>application\u002Fpdf\u003C\u002Fcode> and uses valid PHP array syntax.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n$client = new Client();\n$filePath = '\u002Fpath\u002Fto\u002Ffile.pdf';\n\n$headers = [\n  'Api-Key' =--> 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen($filePath, 'r'),\n      'filename' => basename($filePath),\n      'headers' => [\n        'Content-Type' => 'application\u002Fpdf'\n      ]\n    ],\n    [\n      'name' => 'pages',\n      'contents' => '1-last'\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_extracted_images'\n    ]\n  ]\n];\n\n$request = new Request('POST', $apiUrl . '\u002Fextracted-images', $headers);\n$response = $client->sendAsync($request, $options)->wait();\n\necho $response->getBody();\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fextracted-images.php\">pdfRest Extract Images multipart PHP sample\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Cp>If the source PDF already has a pdfRest resource ID, send a JSON payload instead of uploading it again as multipart data. See the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fextracted-images.php\">Extract Images JSON-payload sample for PHP\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Configure the Multipart Fields\u003C\u002Fh2>\n\n\u003Cp>Guzzle's \u003Ccode>multipart\u003C\u002Fcode> option accepts an array of form parts. The \u003Ccode>file\u003C\u002Fcode> part opens the local PDF as a stream, supplies a filename, and declares its media type. Streaming is more suitable than reading the complete file into a PHP string when input sizes vary.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>pages\u003C\u002Fcode> part controls which pages pdfRest examines. The sample uses \u003Ccode>1-last\u003C\u002Fcode> for the entire document, but applications can combine individual pages and ranges, such as \u003Ccode>1,2,5-10,12-last\u003C\u002Fcode>. The \u003Ccode>output\u003C\u002Fcode> part supplies a base name. pdfRest appends an image sequence and the page where the asset first appeared, producing names such as \u003Ccode>pdfrest_extracted_images-img001-page002\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cp>The request posts to \u003Ccode>$apiUrl . '\u002Fextracted-images'\u003C\u002Fcode>. The sample defaults to the US Cloud API and includes the EU base URL as a configuration option. Keep both the base URL and API key in environment-specific configuration so credentials and data-residency choices do not have to be edited in application code.\u003C\u002Fp>\n\n\u003Ch2>Handle Every Extracted Image\u003C\u002Fh2>\n\n\u003Cp>An extraction request can return more than one image, so parse the output URL and resource ID collections rather than reading only the first value. Download URLs can be used to store the files in your own system. Resource IDs can be passed directly to another pdfRest API Tool, eliminating unnecessary transfer of intermediate files within a multi-step workflow.\u003C\u002Fp>\n\n\u003Cp>If the PDF contains no embedded images, the endpoint can still return \u003Ccode>200 OK\u003C\u002Fcode> with a warning and empty \u003Ccode>outputUrl\u003C\u002Fcode> and \u003Ccode>outputId\u003C\u002Fcode> arrays. Handle this as a no-results condition. If the requirement is to create an image of every complete page rather than retrieve embedded assets, use the PDF to Images tool instead.\u003C\u002Fp>\n\n\u003Ch2>Add Production Error Handling\u003C\u002Fh2>\n\n\u003Cp>The sample uses \u003Ccode>sendAsync(...)->wait()\u003C\u002Fcode> and prints the response body. In a production application, catch Guzzle request and connection exceptions, inspect the HTTP status, and validate the JSON structure before using the output fields. Set timeouts appropriate to the application's file sizes and processing expectations. Avoid echoing sensitive response content into public pages or shared logs.\u003C\u002Fp>\n\n\u003Cp>Store the API key in an environment variable or secret manager, validate the source path before calling \u003Ccode>Utils::tryFopen\u003C\u002Fcode>, and close or release resources according to the surrounding application framework. The response collections support varied image formats, page ranges, and valid no-image outcomes, giving large batch workflows one consistent handling pattern.\u003C\u002Fp>\n\n\u003Cp>Use \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> to try the endpoint without writing code, and consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-images\">Extract Images API reference\u003C\u002Fa> for the current parameters and response fields.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-21T05:45:55.000+00:00","2026-09-22T19:02:58.000+00:00","Learn how to extract all images from PDFs with pdfRest Extract Images API tool using PHP","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-php\u002F#article\",\n      \"headline\": \"How to Extract Images from PDF Files with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-php\u002F\",\n      \"datePublished\": \"2024-11-21T05:45:55.000Z\",\n      \"dateModified\": \"2026-09-22T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to extract all images from PDFs with pdfRest Extract Images API tool using PHP\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Extract Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fextracted-images API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-images\"\n        }\n      ],\n      \"keywords\": \"Extract Images, JPG, PHP, PNG, TIFF\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Extract Images from PDF Files with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8541,8542,8543,8544,8545,8546,8547],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1496,"name":1497,"slug":1498,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1542,"name":1543,"slug":1544,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1554,"name":1555,"slug":1556,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1546,"name":1547,"slug":1548,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-extract-images-from-pdf-files-with-php\u002F","How to Extract Images from PDF Files with PHP, Tutorial | pdfRest",{"id":8552,"uuid":8553,"title":8554,"slug":8555,"html":8556,"comment_id":8552,"feature_image":48,"featured":284,"visibility":1257,"created_at":8557,"updated_at":8558,"published_at":8557,"custom_excerpt":8559,"codeinjection_head":8560,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8561,"primary_tag":8569,"url":8570,"excerpt":8559,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8571,"meta_description":8559,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"673ec8f1533c9f26b9438fc9","78e1cb2f-7518-42d5-bc43-e8a3ad816a75","How to Extract Images from PDF Files with Python","how-to-extract-images-from-pdf-files-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Extract PDF Images with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-images\u002F'>Extract Images API Tool\u003C\u002Fa> is a powerful resource for developers who need to extract images from PDF documents programmatically. By leveraging this tool, users can automate the process of extracting images from PDFs, which can be particularly useful in scenarios where manual extraction would be too time-consuming or cumbersome. This tutorial will guide you through the process of making an API call to extract images using Python.\u003C\u002Fp>\n\n\u003Cp>Imagine you are working for a digital marketing agency that frequently receives PDF reports from clients. These reports often contain valuable images that need to be used in presentations or social media posts. Instead of manually extracting each image, you can use the pdfRest Extract Images API to automate this process, saving time and reducing the risk of errors.\u003C\u002Fp>\n\n\u003Ch2>Extract PDF Images with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nextracted_images_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fextracted-images'\n\n# The \u002Fextracted-images endpoint can take a single PDF file or id as input.\n# This sample demonstrates image extraction from all pages of a document.\nmp_encoder_extractedImages = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_extractedImages_out',\n        'pages': '1-last',\n    }\n)\n\n# Let's set the headers that the extracted-images endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_extractedImages.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to extracted-images endpoint...\")\nresponse = requests.post(extracted_images_endpoint_url, data=mp_encoder_extractedImages, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fextracted-images.py\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided code begins by importing necessary libraries: \u003Ccode>requests_toolbelt\u003C\u002Fcode> for handling multipart form data, \u003Ccode>requests\u003C\u002Fcode> for making HTTP requests, and \u003Ccode>json\u003C\u002Fcode> for handling JSON data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">extracted_images_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fextracted-images'\n\u003C\u002Fpre>\n\n\u003Cp>This line sets the endpoint URL for the Extract Images API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_extractedImages = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_extractedImages_out',\n        'pages': '1-last',\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>This snippet creates a \u003Ccode>MultipartEncoder\u003C\u002Fcode> object, which is used to encode the fields for the multipart form data. The fields include:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Ccode>file\u003C\u002Fcode>: The PDF file to be processed. It is opened in binary read mode.\u003C\u002Fli>\n\u003Cli>\u003Ccode>output\u003C\u002Fcode>: The desired name for the output file.\u003C\u002Fli>\n\u003Cli>\u003Ccode>pages\u003C\u002Fcode>: Specifies the range of pages to extract images from, here set to '1-last' to extract from all pages.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_extractedImages.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>headers\u003C\u002Fcode> dictionary includes:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Ccode>Accept\u003C\u002Fcode>: Specifies that the client expects a JSON response.\u003C\u002Fli>\n\u003Cli>\u003Ccode>Content-Type\u003C\u002Fcode>: Set automatically by \u003Ccode>MultipartEncoder\u003C\u002Fcode> to 'multipart\u002Fform-data'.\u003C\u002Fli>\n\u003Cli>\u003Ccode>Api-Key\u003C\u002Fcode>: A placeholder for your API key, which authenticates your request.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-python\">response = requests.post(extracted_images_endpoint_url, data=mp_encoder_extractedImages, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This line sends a POST request to the API endpoint with the encoded data and headers. The response is stored in the \u003Ccode>response\u003C\u002Fcode> variable.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>If the response is successful, the JSON response is printed in a formatted manner. Otherwise, the error message is printed.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to extract images from a PDF document using the pdfRest Extract Images API with Python. This process can be a great time-saver when dealing with multiple PDFs or large documents. To explore more functionalities, consider trying out all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on each API endpoint, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. For code samples using JSON payloads, visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fextracted-images.py\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-21T05:45:21.000+00:00","2026-09-02T18:28:41.000+00:00","Learn how to use pdfRest Extract Images API tool to extract all images from PDFs with Python","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-python\u002F#article\",\n      \"headline\": \"How to Extract Images from PDF Files with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-python\u002F\",\n      \"datePublished\": \"2024-11-21T05:45:21.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:21.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Extract Images API tool to extract all images from PDFs with Python\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Extract Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fextracted-images API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-images\"\n        }\n      ],\n      \"keywords\": \"Extract Images, JPG, PNG, Python, TIFF\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Extract Images from PDF Files with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-images-from-pdf-files-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8562,8563,8564,8565,8566,8567,8568],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1496,"name":1497,"slug":1498,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1546,"name":1547,"slug":1548,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1542,"name":1543,"slug":1544,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1554,"name":1555,"slug":1556,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-extract-images-from-pdf-files-with-python\u002F","How to Extract Images from PDF Files with Python, Tutorial | pdfRest",{"id":8573,"uuid":8574,"title":8575,"slug":8576,"html":8577,"comment_id":8573,"feature_image":48,"featured":284,"visibility":1257,"created_at":8578,"updated_at":8558,"published_at":8578,"custom_excerpt":8579,"codeinjection_head":8580,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8581,"primary_tag":8588,"url":8589,"excerpt":8579,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8590,"meta_description":8579,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65cce86a533c9f26b943637a","1478b362-7285-452b-811f-ffe252091c4c","How to Extract Pages from PDF Files in .NET with C#","how-to-extract-pages-from-pdf-files-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Extract PDF Pages with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F'>Split PDF API Tool\u003C\u002Fa> is a powerful resource for developers who need to programmatically extract pages from PDF documents. This API provides a simple way to extract specific pages from a PDF and create new documents from those pages.\u003C\u002Fp>\n\u003Cp>Imagine a lengthy legal contract where different departments need specific clauses.  Extracting pages to new documents lets you create separate PDFs containing only the relevant sections for each team, streamlining internal communication and reducing unnecessary document sharing.\u003C\u002Fp>\n\n\u003Ch2>Extract PDF Pages with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"split-pdf\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile_name.pdf\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"1\"));\n        multipartContent.Add(byteArrayOption, \"pages[]\");\n\n        var byteArrayOption2 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"2-last\"));\n        multipartContent.Add(byteArrayOption2, \"pages[]\");\n\n        var byteArrayOption3 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"split\"));\n        multipartContent.Add(byteArrayOption3, \"output\");\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fsplit-pdf.cs\">pdf-rest-api-samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided code demonstrates how to make an API call to the pdfRest Split PDF endpoint using C#. Let's break down each part of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>This creates an instance of \u003Ccode>HttpClient\u003C\u002Fcode> with the base address set to the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var request = new HttpRequestMessage(HttpMethod.Post, \"split-pdf\"))\n\u003C\u002Fpre>\n\n\u003Cp>A new \u003Ccode>HttpRequestMessage\u003C\u002Fcode> is created for making a POST request to the \"split-pdf\" endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>The API key is added to the request headers. You must replace the placeholder with your actual pdfRest API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n\u003C\u002Fpre>\n\n\u003Cp>This initializes a new multipart\u002Fform-data content to send files and data in the request body.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile_name.pdf\");\n\u003C\u002Fpre>\n\n\u003Cp>Reads the PDF file from the specified path and converts it into a byte array.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">multipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n\u003C\u002Fpre>\n\n\u003Cp>Adds the PDF content to the multipart form data with the key \"file\". The \"file_name.pdf\" should be the name of the PDF file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"1\"));\nmultipartContent.Add(byteArrayOption, \"pages[]\");\n\u003C\u002Fpre>\n\n\u003Cp>Adds the page range \"1\" to the request, indicating that the first page should be split into a separate PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption2 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"2-last\"));\nmultipartContent.Add(byteArrayOption2, \"pages[]\");\n\u003C\u002Fpre>\n\n\u003Cp>Adds the page range \"2-last\" to the request, indicating that all pages from the second to the last should be split into another separate PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption3 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"split\"));\nmultipartContent.Add(byteArrayOption3, \"output\");\n\u003C\u002Fpre>\n\n\u003Cp>Specifies the output format, in this case, \"split\" which indicates that the output should be separate PDF files.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\n\u003C\u002Fpre>\n\n\u003Cp>Sends the request to the pdfRest API and awaits the response.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>Reads the response content as a string, which contains the result of the split operation.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you have learned how to extract pages from a PDF using the pdfRest Split PDF API with C#. You can now apply this knowledge to automate document processing tasks within your applications. To explore more capabilities and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further details on the API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fsplit-pdf.cs\">GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-14T16:20:58.000+00:00","Learn how to extract certain pages from a PDF when calling the Split PDF API Tool in .NET, part of the pdfRest Cloud API Toolkit.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Extract Pages from PDF Files in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-02-14T16:20:58.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:47.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to extract certain pages from a PDF when calling the Split PDF API Tool in .NET, part of the pdfRest Cloud API Toolkit.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Split PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsplit-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsplit-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Extract, Pages, Split PDF\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Extract Pages from PDF Files in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8582,8583,8584,8585,8586,8587],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1603,"name":1604,"slug":1605,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1607,"name":1608,"slug":1609,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-extract-pages-from-pdf-files-in-net-with-c\u002F","How to Extract Pages from PDF Files in .NET with C#, Tutorial | pdfRest",{"id":8592,"uuid":8593,"title":8594,"slug":8595,"html":8596,"comment_id":8592,"feature_image":48,"featured":284,"visibility":1257,"created_at":8597,"updated_at":8558,"published_at":8597,"custom_excerpt":8598,"codeinjection_head":8599,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8600,"primary_tag":8607,"url":8608,"excerpt":8598,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8609,"meta_description":8598,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"66184359533c9f26b94370d6","a4739196-be67-4d98-9260-eacfe382cde4","How to Extract Pages from PDF Files with cURL","how-to-extract-pages-from-pdf-files-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Extract PDF Pages with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F'>Split PDF API Tool\u003C\u002Fa> is a powerful resource for developers who need to programmatically extract PDF pages into separate documents. This tool can be accessed via an API, allowing for automation and integration into various workflows. This tutorial will show how to send an API call to Split PDF with cURL, a command-line tool used for transferring data with URLs. cURL is a popular choice for interacting with APIs due to its flexibility and wide support across different platforms.\u003C\u002Fp>\n\n\u003Cp>A user might need to extract PDF pages when dealing with large documents that need to be distributed in smaller sections. For instance, a user might have a PDF containing multiple invoices or reports that they want to separate into individual files for each client or department. Using the Split PDF API, this can be done programmatically, saving time and reducing the potential for human error that comes with manual page extraction\u003C\u002Fp>\n\n\u003Ch2>Extract PDF Pages with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fsplit-pdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>Source of the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fsplit-pdf.sh\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The above cURL command is used to split a PDF document by making a POST request to the pdfRest API. Let's break down each part of the command:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-X POST\n\u003C\u002Fpre>\n\n\u003Cp>This specifies the request method, which in this case is POST, indicating that you are creating or updating resources on the server.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">\"https:\u002F\u002Fapi.pdfrest.com\u002Fsplit-pdf\"\n\u003C\u002Fpre>\n\n\u003Cp>This is the endpoint URL to which the request is sent. It is specific to the Split PDF functionality of the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\n\u003C\u002Fpre>\n\n\u003Cp>This header tells the server that the client expects a response in JSON format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\n\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the request body contains form data, allowing you to send files as part of the request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>This header includes your API key, which is required for authentication with the pdfRest API. Replace the placeholder with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\n\u003C\u002Fpre>\n\n\u003Cp>The '-F' flag is used to specify each field to be sent as part of the multipart\u002Fform-data. In this case, it specifies the file to be uploaded. The '@' symbol is followed by the file path of the PDF you want to split.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>This is another field in the form data. It specifies the prefix for the output files that will be generated after the split operation.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps outlined in this tutorial, you have learned how to make a multipart API call to split a PDF document using cURL. This is just one of the many features offered by the pdfRest API. To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For a comprehensive guide on how to use the API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads for the Split PDF API can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fsplit-pdf.sh\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-04-11T20:08:57.000+00:00","Learn how to use pdfRest Split PDF API Tool to extract pages from PDF files with cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-curl\u002F#article\",\n      \"headline\": \"How to Extract Pages from PDF Files with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-curl\u002F\",\n      \"datePublished\": \"2024-04-11T20:08:57.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:33.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Split PDF API Tool to extract pages from PDF files with cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Split PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsplit-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsplit-pdf\"\n        }\n      ],\n      \"keywords\": \"Extract, Pages, Split PDF, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Extract Pages from PDF Files with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8601,8602,8603,8604,8605,8606],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1603,"name":1604,"slug":1605,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1607,"name":1608,"slug":1609,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-extract-pages-from-pdf-files-with-curl\u002F","How to Extract Pages from PDF Files with cURL, Tutorial | pdfRest",{"id":8611,"uuid":8612,"title":8613,"slug":8614,"html":8615,"comment_id":8611,"feature_image":48,"featured":284,"visibility":1257,"created_at":8037,"updated_at":8616,"published_at":8374,"custom_excerpt":8617,"codeinjection_head":8618,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8619,"primary_tag":8626,"url":8627,"excerpt":8617,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8628,"meta_description":8617,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c5d533c9f26b943b554","09ff09eb-6788-4c96-a6bb-851864d3c118","How to Extract Pages from PDF Files with Java","how-to-extract-pages-from-pdf-files-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>In this tutorial, we'll walk through how to extract pages from PDF files with Java using the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F\">Split PDF API Tool\u003C\u002Fa>. The request expresses the desired pages as a Split PDF range and produces a new PDF containing only that selection. You'll see how the request is assembled and how to work with the response returned when you extract pages from PDF files.\u003C\u002Fp>\n\n\u003Ch2>Why Extract Pages from PDF Files with Java?\u003C\u002Fh2>\n\n\u003Cp>A case packet may contain many sections while a reviewer needs only the signed agreement and supporting schedule. Page-range extraction produces a smaller PDF without exposing unrelated pages.\u003C\u002Fp>\n\n\u003Cp>The tutorial adapts Split PDF by sending the desired range in \u003Ccode>pages[]\u003C\u002Fcode>. Each range defines an output document, so multiple values can create several extracts in one request.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class ExtractPagesFromPDF {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"pages[]\", \"2-4\")\n            .addFormDataPart(\"output\", \"pdfrest_extracted_pages\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fsplit-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FSplitPDF.java\">Java sample on GitHub\u003C\u002Fa>. For this tutorial, the general Java source has been tailored to the Extract Pages from PDF input or task.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The import block assigns a clear role to each library: HTTP communication, credential lookup, or JSON handling.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>The constants section keeps a visible default path, accepts an override from the command line, and reads the API key through dotenv.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"pages[]\", \"2-4\")\n            .addFormDataPart(\"output\", \"pdfrest_extracted_pages\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fsplit-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\u003C\u002Fpre>\n\n\u003Cp>The tutorial adapts Split PDF by sending the desired range in \u003Ccode>pages[]\u003C\u002Fcode>. Each range defines an output document, so multiple values can create several extracts in one request. This payload builder packages fields and files together without hard-coding a \u003Ccode>Content-Type\u003C\u002Fcode> boundary.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fsplit-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\u003C\u002Fpre>\n\n\u003Cp>The outbound call reads the credential through dotenv and targets the endpoint shown in the source, with the EU hostname documented beside the default US value.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>The returned-data block checks the server result before treating the body as output and exposes diagnostic JSON when the operation cannot be completed.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we walked through how to extract pages from PDF files with Java. With that foundation, you can use page extraction for document packets, evidence subsets, chapter exports, and customer-specific deliverables.\u003C\u002Fp>\n\n\u003Cp>As you adapt this example for production, keep in mind that multiple range values can produce several output documents, which is useful when one packet must be separated by recipient or section. Validate ranges against the current page count and retain the source until every expected extract has been created successfully.\u003C\u002Fp>\n\n\u003Cp>To continue exploring the Extract Pages from PDF operation, visit \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For complete request fields, defaults, and limitations, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsplit-pdf\u002F\">Split PDF API Tool documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: The Extract Pages from PDF example above uses multipart form data; when a prior API call returned the input ID, follow the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FSplitPDF.java\">JSON payload example\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-02T18:28:42.000+00:00","Extract selected page ranges from a PDF with Java.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-java\u002F#article\",\n      \"headline\": \"How to Extract Pages from PDF Files with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:38.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:38.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Extract selected page ranges from a PDF with Java.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Split PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsplit-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsplit-pdf\"\n        }\n      ],\n      \"keywords\": \"Extract, Java, Pages, Split PDF\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Extract Pages from PDF Files with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8620,8621,8622,8623,8624,8625],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1603,"name":1604,"slug":1605,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1607,"name":1608,"slug":1609,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-extract-pages-from-pdf-files-with-java\u002F","Extract Pages from PDF Files with Java | pdfRest",{"id":8630,"uuid":8631,"title":8632,"slug":8633,"html":8634,"comment_id":8630,"feature_image":48,"featured":284,"visibility":1257,"created_at":8635,"updated_at":8616,"published_at":8635,"custom_excerpt":8636,"codeinjection_head":8637,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8638,"primary_tag":8645,"url":8646,"excerpt":8636,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8647,"meta_description":8636,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65cb9385533c9f26b94362ea","dad80efb-129e-49fe-aa61-19552471d9ba","How to Extract Pages from PDF Files with JavaScript in NodeJS","how-to-extract-pages-from-pdf-files-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Extract PDF Pages with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F'>Split PDF API Tool\u003C\u002Fa> is a powerful utility for developers who need to programmatically extract PDF pages into separate files. This tutorial will guide you through the process of extracting pages by sending an API call to the Split PDF endpoint using JavaScript. \u003C\u002Fp>\u003Cp>For instance, a user might want to split a PDF report into individual chapters, or extract only certain pages from a large document for targeted distribution.\u003C\u002Fp>\n\n\u003Ch2>Extract PDF Pages with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F**\n * This request demonstrates how to extract pages from a PDF document into three files by specifying the pages that will be included in each.\n * pages[] is an optional parameter that accepts page numbers and\u002For ranges separated by commas. In addition, pages[] supports several keywords: even, odd, and last.\n *\u002F\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile.pdf'));\ndata.append('pages[]', 'even');\ndata.append('pages[]', 'odd');\ndata.append('pages[]', '1,3,4-6');\ndata.append('output', 'pdfrest_split_pdf');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fsplit-pdf', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fsplit-pdf.js\">pdf-rest-api-samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This JavaScript code snippet uses the Axios library for HTTP requests and the FormData library to create multipart\u002Fform-data payloads. Here's how each part of the code works:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\u003C\u002Fpre>\n\n\u003Cp>This section imports the required modules for making HTTP requests, handling form data, and interacting with the file system.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile.pdf'));\ndata.append('pages[]', 'even');\ndata.append('pages[]', 'odd');\ndata.append('pages[]', '1,3,4-6');\ndata.append('output', 'pdfrest_split_pdf');\n\u003C\u002Fpre>\n\n\u003Cp>Here, a new FormData instance is created, and the PDF file along with the split parameters are appended to it. The 'pages[]' parameter specifies the pages to include in each split file, and 'output' names the resulting files.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fsplit-pdf', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\n\u003C\u002Fpre>\n\n\u003Cp>The Axios request configuration is set up, including the HTTP method, endpoint URL, headers (including the API key), and the data payload.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\u003C\u002Fpre>\n\n\u003Cp>The Axios library sends the HTTP request with the provided configuration. The response is logged to the console on success, and any errors are caught and logged.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've learned how to use JavaScript to call the pdfRest Split PDF API to extract pages from a PDF into separate files. You can now apply this knowledge to split PDFs in your own applications. To experiment with all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for more information.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. For code samples using JSON payloads, visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fsplit-pdf.js\">pdf-rest-api-samples with JSON Payload\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-13T16:06:29.000+00:00","Learn how to Extract Pages from PDF Files with JavaScript in NodeJS by calling Split PDF API Tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Extract Pages from PDF Files with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-02-13T16:06:29.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:49.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to Extract Pages from PDF Files with JavaScript in NodeJS by calling Split PDF API Tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Split PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsplit-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsplit-pdf\"\n        }\n      ],\n      \"keywords\": \"Extract, JavaScript, Pages, Split PDF\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Extract Pages from PDF Files with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8639,8640,8641,8642,8643,8644],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1603,"name":1604,"slug":1605,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1607,"name":1608,"slug":1609,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-extract-pages-from-pdf-files-with-javascript-in-nodejs\u002F","How to Extract Pages from PDF Files with JavaScript in NodeJS, Tutorial | pdfRest",{"id":8649,"uuid":8650,"title":8651,"slug":8652,"html":8653,"comment_id":8649,"feature_image":48,"featured":284,"visibility":1257,"created_at":8654,"updated_at":8655,"published_at":8654,"custom_excerpt":8656,"codeinjection_head":8657,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8658,"primary_tag":8665,"url":8666,"excerpt":8656,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8667,"meta_description":8656,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65cbf657533c9f26b9436350","617186bb-0535-4076-ba57-b18f14db2319","How to Extract Pages from PDF Files with PHP","how-to-extract-pages-from-pdf-files-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Extract PDF Pages with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F'>Split PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to programmatically extract PDF pages into separate documents. Whether you need to extract specific pages for reporting, distribute parts of a document to different team members, or simply organize large PDFs into manageable sections, the Split PDF API provides a straightforward solution.\u003C\u002Fp> \u003Cp>This tutorial will guide you through making an API call to the Split PDF tool using PHP, a popular server-side scripting language.\u003C\u002Fp>\n\n\u003Ch2>Extract PDF Pages with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">\nrequire 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile', \u002F\u002F Set the filename for the file to be processed, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'pages[]', \u002F\u002F Specify the field name for the pages option as an array.\n      'contents' => 'even' \u002F\u002F Set the value for the pages option to 'even'.\n    ],\n    [\n      'name' => 'pages[]', \u002F\u002F Specify the field name for the pages option as an array.\n      'contents' => 'odd' \u002F\u002F Set the value for the pages option to 'odd'.\n    ],\n    [\n      'name' => 'pages[]', \u002F\u002F Specify the field name for the pages option as an array.\n      'contents' => '1,3,4-6' \u002F\u002F Set the value for the pages option to '1,3,4-6' (a combination of specific pages and page ranges).\n    ],\n    [\n      'name' => 'output', \u002F\u002F Specify the field name for the output option.\n      'contents' => 'pdfrest_split_pdf' \u002F\u002F Set the value for the output option to generate split PDFs.\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fsplit-pdf', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the split PDFs.\n\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source code reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fsplit-pdf.php\">pdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The above code is a PHP script that uses the Guzzle HTTP client to send a multipart POST request to the pdfRest Split PDF API endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>$headers\u003C\u002Fcode> array includes the 'Api-Key' required for authentication with the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$options = [\n  'multipart' => [\n    \u002F\u002F ...multipart form data...\n  ]\n];\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>$options\u003C\u002Fcode> array contains the multipart form data, which includes the file to split and the split options such as 'pages[]' and 'output'. Each element within the 'multipart' array represents a different part of the form data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fsplit-pdf', $headers);\n\u003C\u002Fpre>\n\n\u003Cp>A new Request object is created with the POST method, the API endpoint URL, and the headers array.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$res = $client->sendAsync($request, $options)->wait();\n\u003C\u002Fpre>\n\n\u003Cp>The client sends the request asynchronously and waits for the response, which is stored in \u003Ccode>$res\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">echo $res->getBody();\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the response body is echoed out, which contains the resulting split PDF files.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we have learned how to use PHP to call the pdfRest Split PDF API to extract PDF pages into separate documents based on page selections. To explore all the capabilities of the pdfRest API Tools, you can demo them in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, and refer to the  \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fsplit-pdf.php\">pdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-13T23:08:07.000+00:00","2026-09-02T18:28:43.000+00:00","Learn how to Extract Pages from PDF Files with PHP by calling Split PDF API Tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-php\u002F#article\",\n      \"headline\": \"How to Extract Pages from PDF Files with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-php\u002F\",\n      \"datePublished\": \"2024-02-13T23:08:07.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:48.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to Extract Pages from PDF Files with PHP by calling Split PDF API Tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Split PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsplit-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsplit-pdf\"\n        }\n      ],\n      \"keywords\": \"Extract, PHP, Pages, Split PDF\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Extract Pages from PDF Files with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8659,8660,8661,8662,8663,8664],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1603,"name":1604,"slug":1605,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1607,"name":1608,"slug":1609,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-extract-pages-from-pdf-files-with-php\u002F","How to Extract Pages from PDF Files with PHP , Tutorial | pdfRest",{"id":8669,"uuid":8670,"title":8671,"slug":8672,"html":8673,"comment_id":8669,"feature_image":48,"featured":284,"visibility":1257,"created_at":8674,"updated_at":8655,"published_at":8674,"custom_excerpt":8675,"codeinjection_head":8676,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8677,"primary_tag":8684,"url":8685,"excerpt":8675,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8686,"meta_description":8675,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65cbf670533c9f26b943635a","76fb4a7c-2891-4152-8e43-dd33eca83f3a","How to Extract Pages from PDF Files with Python","how-to-extract-pages-from-pdf-files-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Extract PDF Pages with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F'>Split PDF API Tool\u003C\u002Fa> allows users to programmatically extract pages from PDF documents to separate files. This can be particularly useful in scenarios where you have a large document that needs to be divided into smaller sections, such as when distributing individual chapters of a book to different reviewers, or when extracting specific pages from a report to share with a team.\u003C\u002Fp>\n\u003Cp>By using Python, you can automate this process and integrate it into your workflow or application.\u003C\u002Fp>\n\n\u003Ch2>Extract PDF Pages with Python Code Example\u003C\u002Fh2>\n\n\u003Cp>The following code is a complete example of how to call the Split PDF API using Python. It was sourced from the pdfRest API samples available on GitHub:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nsplit_pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fsplit-pdf'\n\n# The \u002Fsplit-pdf endpoint can take one PDF file or id as input.\n# This sample takes one PDF file that has at least 5 pages and splits it into two documents when given two page ranges.\n\n# Create a list of tuples for data that will be sent to the request\nsplit_request_data = []\nsplit_request_data.append(('file',('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf')))\nsplit_request_data.append(('pages', '1,2,5'))\nsplit_request_data.append(('pages', '3,4'))\nsplit_request_data.append(('output', 'example_splitPdf_out'))\n\nmp_encoder_splitPdf = MultipartEncoder(\n    fields=split_request_data\n)\n\n# Let's set the headers that the split-pdf endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_splitPdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to split-pdf endpoint...\")\nresponse = requests.post(split_pdf_endpoint_url, data=mp_encoder_splitPdf, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fsplit-pdf.py\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code snippet above demonstrates how to split a PDF document using the pdfRest API in Python. Let's break it down:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\u003C\u002Fpre>\n\n\u003Cp>This imports the necessary modules. \u003Ccode>MultipartEncoder\u003C\u002Fcode> is used for creating a multipart\u002Fform-data payload, which is required for file uploads.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">split_pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fsplit-pdf'\n\u003C\u002Fpre>\n\n\u003Cp>This sets the API endpoint URL for splitting PDFs.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">split_request_data = []\nsplit_request_data.append(('file',('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf')))\nsplit_request_data.append(('pages', '1,2,5'))\nsplit_request_data.append(('pages', '3,4'))\nsplit_request_data.append(('output', 'example_splitPdf_out'))\n\u003C\u002Fpre>\n\n\u003Cp>Here, we're creating the data to be sent with the request. We specify the PDF file, the page ranges for splitting, and the output name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_splitPdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\n\u003C\u002Fpre>\n\n\u003Cp>The headers include the API key, which you need to replace with your own. The \u003Ccode>Content-Type\u003C\u002Fcode> is set automatically by the \u003Ccode>MultipartEncoder\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(split_pdf_endpoint_url, data=mp_encoder_splitPdf, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This sends the POST request to the API endpoint with the data and headers.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've learned how to split a PDF into separate documents using the pdfRest API and Python. You can now use this code as a starting point to integrate PDF splitting functionality into your applications.\u003C\u002Fp>\n\n\u003Cp>I encourage you to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for further exploration.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fsplit-pdf.py\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-13T23:08:32.000+00:00","Learn how to Extract Pages from PDF Files with Python by calling Split PDF API Tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-python\u002F#article\",\n      \"headline\": \"How to Extract Pages from PDF Files with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-python\u002F\",\n      \"datePublished\": \"2024-02-13T23:08:32.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:48.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to Extract Pages from PDF Files with Python by calling Split PDF API Tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Split PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsplit-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsplit-pdf\"\n        }\n      ],\n      \"keywords\": \"Extract, Pages, Python, Split PDF\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Extract Pages from PDF Files with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pages-from-pdf-files-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8678,8679,8680,8681,8682,8683],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1603,"name":1604,"slug":1605,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1607,"name":1608,"slug":1609,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-extract-pages-from-pdf-files-with-python\u002F","How to Extract Pages from PDF Files with Python, Tutorial | pdfRest",{"id":8688,"uuid":8689,"title":8690,"slug":8691,"html":8692,"comment_id":8693,"feature_image":48,"featured":284,"visibility":1257,"created_at":8694,"updated_at":8655,"published_at":8694,"custom_excerpt":8695,"codeinjection_head":8696,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8697,"primary_tag":8704,"url":8705,"excerpt":8695,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8706,"meta_description":8707,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1340","790881f2-dd7d-4f88-ba6a-97f7e4f3d033","How to Extract PDF Text in .NET with C#","how-to-extract-pdf-text-with-dot-net-c-sharp","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Extract PDF Text with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F'>Extract Text API Tool\u003C\u002Fa> is a powerful service that allows users to extract text from PDF documents programmatically. This tutorial will guide you through the process of making an API call to the Extract Text endpoint using C# to retrieve text content from a PDF file.\u003C\u002Fp>\n\u003Cp>For instance, a user might use the Extract Text API to automate the process of converting PDF reports into editable text for further data analysis or integration into other applications.\u003C\u002Fp>\n\n\u003Ch2>Extract PDF Text C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"extracted-text\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"on\"));\n        multipartContent.Add(byteArrayOption, \"word_style\");\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source code reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fextracted-text.cs\">pdfRest API Samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code block above demonstrates how to make a multipart\u002Fform-data POST request to the pdfRest Extract Text API endpoint. Let's break down the key parts of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>This initializes a new instance of the HttpClient class and sets the base address to the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>The API key is added to the request headers. Replace the placeholder with your actual API key to authenticate your request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n\u003C\u002Fpre>\n\n\u003Cp>A new instance of MultipartFormDataContent is created to hold the parts of the multipart request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\u003C\u002Fpre>\n\n\u003Cp>The PDF file is read into a byte array, wrapped in a ByteArrayContent object, and added to the multipart content with the name \"file\". The content type is set to \"application\u002Fpdf\".\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"on\"));\nmultipartContent.Add(byteArrayOption, \"word_style\");\n\u003C\u002Fpre>\n\n\u003Cp>An additional option is added to the request. The \"word_style\" parameter is set to \"on\", which can be used to preserve the styling of words when extracting text.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\n\u003C\u002Fpre>\n\n\u003Cp>The request is sent asynchronously, and the response is awaited.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>The response content is read as a string, which contains the extracted text from the PDF.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to construct and send a multipart\u002Fform-data POST request to the pdfRest Extract Text API using C#. By executing the code, you can extract text from a PDF file and use it for various purposes in your applications.\u003C\u002Fp>\n\n\u003Cp>I encourage you to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for more details on how to use the various endpoints provided by pdfRest.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fextracted-text.cs\">pdfRest API Samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","657bb6ac2d4014c9499b3818","2023-12-15T02:15:08.000+00:00","Learn how to extract text from a PDF via C# and export into JSON for data processing. Available with the pdfRest Extract Text API tool.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-dot-net-c-sharp\u002F#article\",\n      \"headline\": \"How to Extract PDF Text in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-dot-net-c-sharp\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-dot-net-c-sharp\u002F\",\n      \"datePublished\": \"2023-12-15T02:15:08.000Z\",\n      \"dateModified\": \"2026-09-01T14:24:02.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to extract text from a PDF via C# and export into JSON for data processing. Available with the pdfRest Extract Text API tool.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Extract Text API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fextracted-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-text\"\n        }\n      ],\n      \"keywords\": \".NET, Extract, Extract Text, Text\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Extract PDF Text in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-dot-net-c-sharp\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8698,8699,8700,8701,8702,8703],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1476,"name":1477,"slug":1478,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-extract-pdf-text-with-dot-net-c-sharp\u002F","How to Extract PDF Text in .NET with C#, Tutorial | pdfRest","Learn how to extract text from a PDF via .NET and export into JSON for data processing. Available with the pdfRest Extract Text API tool.",{"id":8709,"uuid":8710,"title":8711,"slug":8712,"html":8713,"comment_id":8709,"feature_image":48,"featured":284,"visibility":1257,"created_at":8714,"updated_at":8715,"published_at":8714,"custom_excerpt":8716,"codeinjection_head":8717,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8718,"primary_tag":8725,"url":8726,"excerpt":8716,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8727,"meta_description":8716,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6618473f533c9f26b9437109","24777808-1c53-4150-9fc2-81daac135045","How to Extract PDF Text with cURL","how-to-extract-pdf-text-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Extract PDF Text with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F'>Extract Text API Tool\u003C\u002Fa> is a powerful feature that allows users to programmatically extract text from PDF documents. This tutorial will guide you through the process of sending an API call to the Extract Text endpoint using cURL, which is a versatile command-line tool used for transferring data with URLs. Utilizing cURL for API interactions is common among developers because of its simplicity and wide support across various platforms.\u003C\u002Fp>\n\n\u003Cp>You might need to extract text from a batch of PDF files to analyze the content, automate data entry tasks, or migrate information to a different format. For instance, a legal firm could use the Extract Text API to extract text from a large number of legal documents for case analysis or to search for specific terms within those documents. This can save hours of manual work and increase productivity.\u003C\u002Fp>\n\n\u003Ch2>Extract PDF Text with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fextracted-text\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\"\n\u003C\u002Fpre>\n\n\u003Cp>This code is sourced from the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fextracted-text.sh\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The cURL command provided is used to interact with the pdfRest Extract Text API. Let's break down each part of the command:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-X POST\u003C\u002Fpre>\n\n\u003Cp>This specifies the HTTP method for the request, which is POST in this case, indicating that data will be sent to the server.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">\"https:\u002F\u002Fapi.pdfrest.com\u002Fextracted-text\"\u003C\u002Fpre>\n\n\u003Cp>This is the URL of the API endpoint that triggers the Extract Text function.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\u003C\u002Fpre>\n\n\u003Cp>This header tells the server that the client expects a response in JSON format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the data being sent in the request is multipart form data, which is typically used for file uploads.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\u003C\u002Fpre>\n\n\u003Cp>Here you need to replace the placeholder with your actual API key. This key is used to authenticate the client making the request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\u003C\u002Fpre>\n\n\u003Cp>This is the form field that contains the file data. The '@' symbol indicates that the following string is a file path, and you should replace \"\u002Fpath\u002Fto\u002Ffile\" with the actual file path of the PDF you want to extract text from.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you have learned how to make a multipart API call to the pdfRest Extract Text endpoint using cURL. This allows you to programmatically extract text from PDF documents, which can be a stepping stone to further automation and integration within your projects or workflows.\u003C\u002Fp>\n\n\u003Cp>To explore more capabilities and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For a comprehensive understanding of the pdfRest API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note that this is an example of a multipart API call. For code samples using JSON payloads, you can find them at the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fextracted-text.sh\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-04-11T20:25:35.000+00:00","2026-09-02T18:28:44.000+00:00","Learn how to use pdfRest Extract Text API Tool with cURL to extract all text from a PDF","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-curl\u002F#article\",\n      \"headline\": \"How to Extract PDF Text with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-curl\u002F\",\n      \"datePublished\": \"2024-04-11T20:25:35.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:32.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Extract Text API Tool with cURL to extract all text from a PDF\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Extract Text API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fextracted-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-text\"\n        }\n      ],\n      \"keywords\": \"Extract, Extract Text, Text, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Extract PDF Text with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8719,8720,8721,8722,8723,8724],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1476,"name":1477,"slug":1478,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-extract-pdf-text-with-curl\u002F","How to Extract PDF Text with cURL, Tutorial | pdfRest",{"id":8729,"uuid":8730,"title":8731,"slug":8732,"html":8733,"comment_id":8729,"feature_image":48,"featured":284,"visibility":1257,"created_at":8734,"updated_at":8715,"published_at":8374,"custom_excerpt":8735,"codeinjection_head":8736,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8737,"primary_tag":8744,"url":8745,"excerpt":8735,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8746,"meta_description":8735,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c5e533c9f26b943b55f","e5d79beb-974d-41eb-b4f7-4a5ef3be8048","How to Extract PDF Text with Java","how-to-extract-pdf-text-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This tutorial shows you how to extract PDF text from a Java application with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F\">Extract Text API Tool\u003C\u002Fa>. The sample posts a PDF to \u003Ccode>\u002Fextracted-text\u003C\u002Fcode> and shows how the textual result, status, and response details are returned for downstream application use. The walkthrough gives you a practical starting point that you can adapt when you need to extract PDF text in your own document workflow.\u003C\u002Fp>\n\n\u003Ch2>Why Extract PDF Text with Java?\u003C\u002Fh2>\n\n\u003Cp>Search and analytics systems often need the textual content of a PDF rather than its visual representation. Extraction provides text that can be indexed, classified, compared, or passed to another service.\u003C\u002Fp>\n\n\u003Cp>The Java sample posts the PDF to \u003Ccode>\u002Fextracted-text\u003C\u002Fcode>. Page and output controls determine the scope and representation of the returned text resource.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONObject;\n\npublic class ExtractedText {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fextracted-text\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client = new OkHttpClient().newBuilder().build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FExtractedText.java\">Java sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>This dependency set uses OkHttp for transport, dotenv for loading \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode>, and \u003Ccode>org.json\u003C\u002Fcode> for structured request or response data.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>The startup code uses runtime arguments when supplied and otherwise falls back to the documented input path and environment-based credential.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fextracted-text\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client = new OkHttpClient().newBuilder().build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\u003C\u002Fpre>\n\n\u003Cp>The Java sample posts the PDF to \u003Ccode>\u002Fextracted-text\u003C\u002Fcode>. Page and output controls determine the scope and representation of the returned text resource. The multipart section leaves boundary construction to OkHttp so the header remains synchronized with the serialized content.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fextracted-text\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client = new OkHttpClient().newBuilder().build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\u003C\u002Fpre>\n\n\u003Cp>The request builder ties the body to its endpoint and applies the required \u003Ccode>Api-Key\u003C\u002Fcode> header before OkHttp sends it.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    try {\n      OkHttpClient client = new OkHttpClient().newBuilder().build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>The response block uses both status and body to distinguish a successful resource from validation or processing failures.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You have now seen how to extract PDF text from a Java application. With that foundation, you can use extracted text for search indexing, document classification, review assistance, and data pipelines.\u003C\u002Fp>\n\n\u003Cp>When you move beyond the sample, keep in mind that image-only scans require OCR before ordinary text extraction can return useful content. For born-digital PDFs, decide whether plain reading order or additional layout information better serves search, analytics, or reconstruction, and test multi-column documents explicitly.\u003C\u002Fp>\n\n\u003Cp>You can experiment with the Extract PDF Text operation in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. The \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-text\u002F\">Extract Text API Tool documentation\u003C\u002Fa> describes the full parameter and response contract.\u003C\u002Fp>\n\n\u003Cp>Note: The Extract PDF Text example above uses multipart form data; to avoid transferring the same input again, use the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FExtractedText.java\">JSON payload example\u003C\u002Fa> as a guide.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T17:33:18.000+00:00","Extract machine-readable text from PDF pages with Java.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-java\u002F#article\",\n      \"headline\": \"How to Extract PDF Text with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:38.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:38.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Extract machine-readable text from PDF pages with Java.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Extract Text API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fextracted-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-text\"\n        }\n      ],\n      \"keywords\": \"Extract, Extract Text, Java, Text\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Extract PDF Text with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8738,8739,8740,8741,8742,8743],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1476,"name":1477,"slug":1478,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-extract-pdf-text-with-java\u002F","Extract PDF Text with Java | pdfRest",{"id":8748,"uuid":8749,"title":8750,"slug":8751,"html":8752,"comment_id":8753,"feature_image":48,"featured":284,"visibility":1257,"created_at":8754,"updated_at":8755,"published_at":8754,"custom_excerpt":8756,"codeinjection_head":8757,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8758,"primary_tag":8765,"url":8766,"excerpt":8756,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8767,"meta_description":8756,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1341","61609770-cd81-4da5-847f-de491c499bc6","How to Extract PDF Text with JavaScript in NodeJS","how-to-extract-pdf-text-with-javascript","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Extract PDF Text with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F'>Extract Text API Tool\u003C\u002Fa> is a powerful resource for developers who need to extract text from PDF documents programmatically. This tool can be particularly useful in scenarios such as content analysis, data migration, or when you need to repurpose text content from PDF files into other formats or applications.\u003C\u002Fp>\n\u003Cp>In this tutorial, we will demonstrate how to make an API call to the Extract Text endpoint using JavaScript to retrieve text from a PDF document.\u003C\u002Fp>\n\n\u003Ch2>Extract PDF Text JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to extract text from a PDF document.\nvar axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\ndata.append(\"word_style\", \"on\");\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: \"post\",\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: \"https:\u002F\u002Fapi.pdfrest.com\u002Fextracted-text\",\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", \u002F\u002F Replace with your API key\n    ...data.getHeaders(), \u002F\u002F set headers for the request\n  },\n  data: data, \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error);\n  });\n\u003C\u002Fpre>\n\n\u003Cp>Source of the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fextracted-text.js\">pdf-rest-api-samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code uses the Axios library to make HTTP requests and the Form-Data library to handle multipart\u002Fform-data, which is necessary for file uploads.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\n\u003C\u002Fpre>\n\n\u003Cp>These lines import the required modules. Axios is used for making the HTTP request, FormData for constructing the multipart request body, and fs (file system) for accessing the file system to read the PDF file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\ndata.append(\"word_style\", \"on\");\n\u003C\u002Fpre>\n\n\u003Cp>A new FormData instance is created, and the PDF file is appended along with the 'word_style' parameter. The 'word_style' parameter, when set to 'on', includes style information for each word in the output.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: \"post\",\n  maxBodyLength: Infinity,\n  url: \"https:\u002F\u002Fapi.pdfrest.com\u002Fextracted-text\",\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    ...data.getHeaders(),\n  },\n  data: data,\n};\n\u003C\u002Fpre>\n\n\u003Cp>This is the configuration for the Axios request. It specifies the HTTP method, the endpoint URL, headers (including the API key and the headers from FormData), and the request body.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error);\n  });\n\u003C\u002Fpre>\n\n\u003Cp>The Axios library sends the request with the given configuration. The response is then logged to the console. If an error occurs, it is caught and logged.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we have learned how to use JavaScript to make an API call to pdfRest's Extract Text endpoint. This allows for the extraction of text from a PDF document, which can be used in various applications and services. The provided code demonstrates the process of setting up a multipart request, including a file and parameters, and handling the response from the API.\u003C\u002Fp>\n\n\u003Cp>For further exploration, you are encouraged to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fextracted-text.js\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp> \n\u003C!--kg-card-end: html-->\n","657bb6df2d4014c9499b3822","2023-12-15T02:15:59.000+00:00","2026-09-02T18:28:45.000+00:00","Learn how to extract text from a PDF via JavaScript and export into JSON for data processing. Available with the pdfRest Extract Text API tool.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-javascript\u002F#article\",\n      \"headline\": \"How to Extract PDF Text with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-javascript\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-javascript\u002F\",\n      \"datePublished\": \"2023-12-15T02:15:59.000Z\",\n      \"dateModified\": \"2026-09-01T14:24:02.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to extract text from a PDF via JavaScript and export into JSON for data processing. Available with the pdfRest Extract Text API tool.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Extract Text API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fextracted-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-text\"\n        }\n      ],\n      \"keywords\": \"Extract, Extract Text, JavaScript, Text\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Extract PDF Text with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-javascript\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8759,8760,8761,8762,8763,8764],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1476,"name":1477,"slug":1478,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-extract-pdf-text-with-javascript\u002F","How to Extract PDF Text with JavaScript in NodeJS, Tutorial | pdfRest",{"id":8769,"uuid":8770,"title":8771,"slug":8772,"html":8773,"comment_id":8774,"feature_image":48,"featured":284,"visibility":1257,"created_at":8775,"updated_at":8776,"published_at":8775,"custom_excerpt":8777,"codeinjection_head":8778,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8779,"primary_tag":8786,"url":8787,"excerpt":8777,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8788,"meta_description":8777,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b133f","5beb4924-9432-49c5-8681-fb0bf508299a","How to Extract PDF Text with PHP","how-to-extract-pdf-text-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Extract PDF Text with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F\">Extract Text API Tool\u003C\u002Fa> is a powerful resource that allows users to extract text from PDF documents programmatically. This tutorial will guide you through the process of sending an API call to the Extract Text endpoint using PHP.\u003C\u002Fp>\n\n\u003Cp>This functionality can be particularly useful in scenarios where you need to obtain text data from a large number of PDFs quickly, like indexing documents for search, data mining, or automating content extraction for further processing.\u003C\u002Fp>\n\n\u003Ch2>Extract PDF Text PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'word_style',\n      'contents' => 'on'\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fextracted-text', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source code reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fextracted-text.php\">GitHub - datalogics\u002Fpdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by loading the necessary classes using the Composer autoload feature:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\u003C\u002Fpre>\n\n\u003Cp>Next, an instance of the Guzzle HTTP client is created, and the API key is set in the headers for authentication:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$client = new Client();\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The options array is prepared with multipart form data. This includes the file to be processed, the content type of the file, and the 'word_style' parameter, which specifies how the text should be extracted:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$options = [\n  'multipart' => [\n    \u002F\u002F File details\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    \u002F\u002F Word style option\n    [\n      'name' => 'word_style',\n      'contents' => 'on'\n    ]\n  ]\n];\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>A new POST request is created with the API endpoint and headers, and the request is sent asynchronously. The response is then waited for and the body of the response, which contains the extracted text, is output:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fextracted-text', $headers);\n$res = $client->sendAsync($request, $options)->wait();\necho $res->getBody();\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we have successfully walked through the process of calling the pdfRest Extract Text API using PHP. By sending a multipart POST request, we can extract text from a PDF document and use it for various applications.\u003C\u002Fp>\n\n\u003Cp>To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information on the API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fextracted-text.php\">GitHub - datalogics\u002Fpdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","657bb6792d4014c9499b380e","2023-12-15T02:14:17.000+00:00","2026-09-10T20:19:18.000+00:00","Learn how to extract text from a PDF with PHP and export into JSON for data processing. Available via the pdfRest Extract Text API tool.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-php\u002F#article\",\n      \"headline\": \"How to Extract PDF Text with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-php\u002F\",\n      \"datePublished\": \"2023-12-15T02:14:17.000Z\",\n      \"dateModified\": \"2026-09-01T14:24:03.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to extract text from a PDF with PHP and export into JSON for data processing. Available via the pdfRest Extract Text API tool.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Extract Text API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fextracted-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-text\"\n        }\n      ],\n      \"keywords\": \"Extract, Extract Text, PHP, Text\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Extract PDF Text with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8780,8781,8782,8783,8784,8785],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1476,"name":1477,"slug":1478,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-extract-pdf-text-with-php\u002F","How to Extract PDF Text with PHP, Tutorial | pdfRest",{"id":8790,"uuid":8791,"title":8792,"slug":8793,"html":8794,"comment_id":8795,"feature_image":48,"featured":284,"visibility":1257,"created_at":8796,"updated_at":8797,"published_at":8796,"custom_excerpt":8798,"codeinjection_head":8799,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8800,"primary_tag":8807,"url":8808,"excerpt":8798,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8809,"meta_description":8798,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b133e","35cdb598-b1e8-4500-8ef4-0e68b629c718","How to Extract PDF Text with Python","how-to-extract-pdf-text-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Extract PDF Text with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F\">Extract Text API Tool\u003C\u002Fa> is designed to help users extract text from PDF documents programmatically. This tutorial will demonstrate how to use Python to send an API call to the Extract Text endpoint.\u003C\u002Fp>\n\n\u003Cp>This functionality can be particularly useful in scenarios where text needs to be extracted for data analysis, content repurposing, or for feeding into other software systems for further processing.\u003C\u002Fp>\n\n\u003Ch2>Extract PDF Text Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nextract_text_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fextracted-text'\n\n# The \u002Fextracted-text endpoint can take a single PDF file or id as input.\n#This sample demonstrates extracting the text from a document to return as JSON\nmp_encoder_extractText = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'word_style': 'on',\n    }\n)\n\n# Let's set the headers that the extracted-text endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_extractText.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to extracted-text endpoint...\")\nresponse = requests.post(extract_text_endpoint_url, data=mp_encoder_extractText, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fextracted-text.py\">GitHub - datalogics\u002Fpdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Python Code\u003C\u002Fh2>\n\n\u003Cp>The script combines \u003Ccode>requests\u003C\u002Fcode> with \u003Ccode>MultipartEncoder\u003C\u002Fcode> from \u003Ccode>requests-toolbelt\u003C\u002Fcode>. Install both external packages with \u003Ccode>python -m pip install requests requests-toolbelt\u003C\u002Fcode> when they are not already available.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">extract_text_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fextracted-text'\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>\u002Fextracted-text\u003C\u002Fcode> endpoint accepts an uploaded PDF or an existing resource ID. This example uses a multipart upload and returns extraction results directly as JSON.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_extractText = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'word_style': 'on',\n    }\n)\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>file\u003C\u002Fcode> tuple supplies the multipart filename, binary stream, and media type. Setting \u003Ccode>word_style\u003C\u002Fcode> to \u003Ccode>on\u003C\u002Fcode> adds a word list containing font, size, color, and color-space information. It does not perform OCR; image-only PDFs should first be processed with the OCR PDF tool when their visible text must be extracted.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_extractText.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\u003C\u002Fpre>\n\n\u003Cp>The encoder’s content type includes the required multipart boundary. The API key authenticates the request, and \u003Ccode>Accept: application\u002Fjson\u003C\u002Fcode> asks the service to return the extraction data in the response.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(\n    extract_text_endpoint_url,\n    data=mp_encoder_extractText,\n    headers=headers\n)\u003C\u002Fpre>\n\n\u003Cp>Passing the encoder through \u003Ccode>data\u003C\u002Fcode> sends the file and options as one multipart body. Additional endpoint controls can select pages, preserve line breaks, include word coordinates, or save the result as a downloadable JSON resource.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent=2))\nelse:\n    print(response.text)\u003C\u002Fpre>\n\n\u003Cp>The success path pretty-prints the returned text and metadata. The failure path preserves the API’s validation or processing message instead of trying to parse an error as a successful extraction result.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've walked through how to make a multipart API call to the pdfRest Extract Text endpoint using Python. This allows for the extraction of text from a PDF document and can be used in various applications where text data is needed from PDF files.\u003C\u002Fp>\n\n\u003Cp>For further exploration, you're encouraged to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fextracted-text.py\">GitHub - datalogics\u002Fpdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","657bb6592d4014c9499b3804","2023-12-15T02:13:45.000+00:00","2026-09-02T18:28:48.000+00:00","Learn how to extract text from a PDF via Python and export into JSON for data processing. Available with the pdfRest Extract Text API tool.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-python\u002F#article\",\n      \"headline\": \"How to Extract PDF Text with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-python\u002F\",\n      \"datePublished\": \"2023-12-15T02:13:45.000Z\",\n      \"dateModified\": \"2026-09-01T14:25:29.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to extract text from a PDF via Python and export into JSON for data processing. Available with the pdfRest Extract Text API tool.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Extract Text API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fextracted-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-text\"\n        }\n      ],\n      \"keywords\": \"Extract, Extract Text, Python, Text\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Extract PDF Text with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-extract-pdf-text-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8801,8802,8803,8804,8805,8806],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1476,"name":1477,"slug":1478,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-extract-pdf-text-with-python\u002F","How to Extract PDF Text with Python, Tutorial | pdfRest",{"id":8811,"uuid":8812,"title":8813,"slug":8814,"html":8815,"comment_id":8811,"feature_image":48,"featured":284,"visibility":1257,"created_at":8816,"updated_at":8817,"published_at":8816,"custom_excerpt":8818,"codeinjection_head":8819,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8820,"primary_tag":8825,"url":8826,"excerpt":8818,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8827,"meta_description":8828,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65c69a63533c9f26b9436219","3ff43f10-ba7a-4fc6-b993-f0adf3e63a37","How to Flatten Annotations in PDF Files in .NET with C#","how-to-flatten-annotations-in-pdf-files-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Flatten Annotations with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-annotations\u002F'>Flatten Annotations API Tool\u003C\u002Fa> is designed to take annotations in a PDF and make them a permanent part of the document. This process is known as \"flattening.\" Flattening annotations is useful in scenarios where you want to prevent further modifications to the annotations or ensure that they are displayed correctly across all PDF viewers. For instance, if you're sending a contract with comments to a client, you might want to flatten these comments so that they can't be altered before signing.\u003C\u002Fp>\n\n\u003Cp>This tutorial will guide you through the process of sending an API call to Flatten Annotations using C#. By the end of this tutorial, you will understand how to integrate this functionality into your C# applications.\u003C\u002Fp>\n\n\u003Ch2>Flatten Annotations with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"flattened-annotations-pdf\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile_name.pdf\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fflattened-annotations-pdf.cs\">pdfRest API C# Sample Code\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided code snippet demonstrates how to make a multipart\u002Fform-data POST request to the pdfRest Flatten Annotations API endpoint using C#.\u003C\u002Fp>\n\n\u003Cul>\n    \u003Cli>\u003Ccode>HttpClient\u003C\u002Fcode> is initialized with the base address of the pdfRest API.\u003C\u002Fli>\n    \u003Cli>An \u003Ccode>HttpRequestMessage\u003C\u002Fcode> is created for the POST request to the \"flattened-annotations-pdf\" endpoint.\u003C\u002Fli>\n    \u003Cli>The API key is added to the request headers. Replace \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" with your actual API key.\u003C\u002Fli>\n    \u003Cli>The request is set to accept JSON responses.\u003C\u002Fli>\n    \u003Cli>A \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> is created to hold the file content.\u003C\u002Fli>\n    \u003Cli>The PDF file is read into a byte array and added to the multipart content with the name \"file\" and the filename \"file_name.pdf\".\u003C\u002Fli>\n    \u003Cli>The \u003Ccode>Content-Type\u003C\u002Fcode> header for the file part is set to \"application\u002Fpdf\".\u003C\u002Fli>\n    \u003Cli>The multipart content is assigned to the request content.\u003C\u002Fli>\n    \u003Cli>The request is sent asynchronously, and the response is read as a string.\u003C\u002Fli>\n    \u003Cli>Finally, the API response is printed to the console.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the tutorial above, you have learned how to make a call to the pdfRest Flatten Annotations API using C#. This allows you to integrate PDF annotation flattening into your applications seamlessly. You can now ensure that annotations in your PDFs are displayed consistently and cannot be altered by the end users.\u003C\u002Fp>\n\n\u003Cp>To explore and demo all of the pdfRest API Tools, visit the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\u003C\u002Fa>. For more detailed information about the API, refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fflattened-annotations-pdf.cs\">https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fflattened-annotations-pdf.cs\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-09T21:34:27.000+00:00","2026-09-02T18:28:49.000+00:00","Learn how to use .NET to flatten annotations in PDF files by calling Flatten Annotations API Tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Flatten Annotations in PDF Files in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-02-09T21:34:27.000Z\",\n      \"dateModified\": \"2026-09-01T14:52:11.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use .NET to flatten annotations in PDF files by calling Flatten Annotations API Tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Flatten Annotations API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-annotations\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fflattened-annotations-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-annotations\"\n        }\n      ],\n      \"keywords\": \".NET, Flatten Annotations\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Flatten Annotations in PDF Files in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8821,8822,8823,8824],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1895,"name":1896,"slug":1897,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-flatten-annotations-in-pdf-files-in-net-with-c\u002F","How to Flatten Annotations in PDF Files in .NET with C#, Tutorial | pdfRest","Learn how to use .NET to flatten annotations in PDF files by calling Flatten Annotations API tool by pdfRest.",{"id":8830,"uuid":8831,"title":8832,"slug":8833,"html":8834,"comment_id":8830,"feature_image":48,"featured":284,"visibility":1257,"created_at":8835,"updated_at":7326,"published_at":7326,"custom_excerpt":8836,"codeinjection_head":8837,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8838,"primary_tag":8843,"url":8844,"excerpt":8836,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8845,"meta_description":8836,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a9750cd533c9f26b943b770","9af02dc6-5fcd-4331-946d-3f15845cc94b","How to Flatten Annotations in PDF Files with cURL","how-to-flatten-annotations-in-pdf-files-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This step-by-step tutorial explains how to flatten annotations in PDF files from a shell script with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-annotations\u002F\">Flatten Annotations API Tool\u003C\u002Fa>. After reviewing the command and its response handling, you'll be ready to test the Flatten Annotations in PDF request with representative files.\u003C\u002Fp>\n\n\u003Ch2>Why Flatten Annotations in PDF Files with cURL?\u003C\u002Fh2>\n\n\u003Cp>Review comments, highlights, stamps, and drawing markup may need to remain visible in a final PDF without staying independently editable. Flattening incorporates each annotation appearance into the ordinary page content.\u003C\u002Fp>\n\n\u003Cp>A legal review workflow can use this after comments are resolved but must still be preserved in the delivered record. The resulting PDF shows the markup consistently in viewers and print workflows that might otherwise hide or handle annotations differently.\u003C\u002Fp>\n\n\u003Cp>The operation creates a separate flattened PDF. Retain the annotated source when reviewers may need comment metadata, editing controls, or the original audit trail later.\u003C\u002Fp>\n\n\u003Ch2>cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\ncurl -X POST \"$API_URL\u002Fflattened-annotations-pdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\"\u003C\u002Fpre>\n\n\u003Cp>Source for Flatten Annotations in PDF: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fflattened-annotations-pdf.sh\">View the cURL sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Choose the pdfRest service region\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>The annotation-flattening command starts with the US pdfRest hostname and keeps the EU service available as a documented alternative. Use the same host for the reviewed input and the flattened result throughout the workflow.\u003C\u002Fp>\n\n\u003Ch3>Build the authenticated multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"$API_URL\u002Fflattened-annotations-pdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\u003C\u002Fpre>\n\n\u003Cp>cURL submits the reviewed document directly to \u003Ccode>\u002Fflattened-annotations-pdf\u003C\u002Fcode>. The headers distinguish the expected JSON response, multipart upload body, and API credential before any file data is sent.\u003C\u002Fp>\n\n\u003Ch3>Upload the input file data\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\u003C\u002Fpre>\n\n\u003Cp>The Flatten Annotations in PDF request reads the local source from the path after \u003Ccode>@\u003C\u002Fcode> and sends its bytes in the multipart \u003Ccode>file\u003C\u002Fcode> field. For Flatten Annotations in PDF, cURL treats the path as an upload rather than ordinary form text.\u003C\u002Fp>\n\n\u003Ch3>Set the operation-specific fields\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>output\u003C\u002Fcode> value names the flattened copy created from the reviewed PDF. Annotation appearances already stored in the document determine what becomes fixed page content.\u003C\u002Fp>\n\n\u003Ch3>Read the generated resource response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"$API_URL\u002Fflattened-annotations-pdf\" \\\u003C\u002Fpre>\n\n\u003Cp>pdfRest returns a new PDF resource after incorporating the annotation appearances. Keep its output ID or download URL for final distribution while retaining the annotated source separately when review history must remain editable.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You now have a direct cURL request for converting visible annotations into fixed page content before distribution, printing, or another PDF operation.\u003C\u002Fp>\n\n\u003Cp>Inspect representative annotation types before final delivery, including stamps, free text, highlights, and drawings. Flattening is intentionally irreversible in the generated output, so preserve the editable reviewed version when history matters.\u003C\u002Fp>\n\n\u003Cp>Continue exploring the Flatten Annotations in PDF workflow in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the complete Flatten Annotations in PDF request contract, accepted values, defaults, and limitations, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-annotations\u002F\">Flatten Annotations API Tool documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: The Flatten Annotations in PDF example above uploads a file with multipart form data. For source content already stored in pdfRest, the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fflattened-annotations-pdf.sh\">Flatten Annotations in PDF JSON payload example\u003C\u002Fa> shows the resource-ID request shape.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T22:25:17.000+00:00","Learn how to flatten PDF comments, stamps, and markup into page content with cURL for dependable final distribution.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-curl\u002F#article\",\n      \"headline\": \"How to Flatten Annotations in PDF Files with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-curl\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to flatten PDF comments, stamps, and markup into page content with cURL for dependable final distribution.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Flatten Annotations API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-annotations\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fflattened-annotations-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-annotations\"\n        }\n      ],\n      \"keywords\": \"Flatten Annotations, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Flatten Annotations in PDF Files with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8839,8840,8841,8842],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1895,"name":1896,"slug":1897,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-flatten-annotations-in-pdf-files-with-curl\u002F","How to Flatten Annotations in PDF Files with cURL, Tutorial | pdfRest",{"id":8847,"uuid":8848,"title":8849,"slug":8850,"html":8851,"comment_id":8847,"feature_image":48,"featured":284,"visibility":1257,"created_at":8734,"updated_at":8817,"published_at":8852,"custom_excerpt":8853,"codeinjection_head":8854,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8855,"primary_tag":8860,"url":8861,"excerpt":8853,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8862,"meta_description":8853,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c5e533c9f26b943b56a","dcf82894-a08e-4562-a1b0-cabb4c5397b6","How to Flatten Annotations in PDF Files with Java","how-to-flatten-annotations-in-pdf-files-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>Learn how to flatten annotations in PDF files with Java and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-annotations\u002F\">Flatten Annotations API Tool\u003C\u002Fa>. The request creates a new PDF whose annotation appearances are incorporated into ordinary page content while preserving their visible appearance for controlled distribution. We'll move from input and authentication setup through the request and returned data involved when you flatten annotations in PDF files.\u003C\u002Fp>\n\n\u003Ch2>Why Flatten Annotations in PDF Files with Java?\u003C\u002Fh2>\n\n\u003Cp>After a review cycle, comments, stamps, and markup may need to remain visible without staying independently editable. Flattening incorporates their appearances into the page content.\u003C\u002Fp>\n\n\u003Cp>The Java request sends the reviewed PDF to \u003Ccode>\u002Fflattened-annotations-pdf\u003C\u002Fcode>. The operation produces a new PDF, so the original annotated version can be retained separately when needed.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class FlattenedAnnotationsPDF {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"flattened\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fflattened-annotations-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FFlattenedAnnotationsPDF.java\">Java sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The Java setup combines OkHttp networking with dotenv configuration and \u003Ccode>org.json\u003C\u002Fcode> processing.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>The input setup separates file selection from authentication so either value can change without rewriting the request.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"flattened\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fflattened-annotations-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The Java request sends the reviewed PDF to \u003Ccode>\u002Fflattened-annotations-pdf\u003C\u002Fcode>. The operation produces a new PDF, so the original annotated version can be retained separately when needed. The OkHttp body uses the form multipart type required for combining uploaded content with operation parameters.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fflattened-annotations-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>This POST request adds the API key header, selects the operation URL, and attaches the prepared body; changing the base constant switches between US and EU service hosts.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>This result handling shows the raw outcome for learning purposes; production code can retain output IDs and branch on reported errors.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>Together, we stepped through the Java request needed to flatten annotations in PDF files. With that foundation, you can flatten annotations before final distribution, printing, archival conversion, or workflows that cannot preserve interactive markup.\u003C\u002Fp>\n\n\u003Cp>As you build this into a larger workflow, keep in mind that flattening is intentionally irreversible in the generated output: comments and marks remain visible but are no longer separate editable annotations. Preserve the reviewed source when audit history matters, and verify that all required annotation appearances are visible before final distribution.\u003C\u002Fp>\n\n\u003Cp>Try the Flatten Annotations in PDF operation with representative files in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. Review the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-annotations\u002F\">Flatten Annotations API Tool documentation\u003C\u002Fa> for supported values and production considerations.\u003C\u002Fp>\n\n\u003Cp>Note: The Flatten Annotations in PDF example above uses multipart form data; for the resource-ID form of this operation, compare the multipart call with the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FFlattenedAnnotationsPDF.java\">JSON payload example\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T21:57:39.000+00:00","Flatten PDF annotations into page content with Java.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-java\u002F#article\",\n      \"headline\": \"How to Flatten Annotations in PDF Files with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:39.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:39.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Flatten PDF annotations into page content with Java.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Flatten Annotations API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-annotations\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fflattened-annotations-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-annotations\"\n        }\n      ],\n      \"keywords\": \"Flatten Annotations, Java\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Flatten Annotations in PDF Files with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8856,8857,8858,8859],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1895,"name":1896,"slug":1897,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-flatten-annotations-in-pdf-files-with-java\u002F","Flatten Annotations in PDF Files with Java | pdfRest",{"id":8864,"uuid":8865,"title":8866,"slug":8867,"html":8868,"comment_id":8864,"feature_image":48,"featured":284,"visibility":1257,"created_at":8869,"updated_at":8870,"published_at":8869,"custom_excerpt":8871,"codeinjection_head":8872,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8873,"primary_tag":8878,"url":8879,"excerpt":8871,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8880,"meta_description":8871,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65c69f0b533c9f26b9436227","fabdb612-718e-447e-9a12-6938223ac310","How to Flatten Annotations in PDF Files with JavaScript in NodeJS","how-to-flatten-annotations-in-pdf-files-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Flatten Annotations with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-annotations\u002F'>Flatten Annotations API Tool\u003C\u002Fa> is designed to permanently merge annotations into the content layer of a PDF document. This can be particularly useful when you want to ensure that comments, stamps, or filled form fields remain an integral part of the PDF content, for example, when finalizing a contract or an agreement that has been reviewed and annotated by multiple parties. By flattening annotations, you make them uneditable, which can be crucial for archiving and sharing official documents.\u003C\u002Fp> \n  \n\u003Cp>This tutorial will show you how to send an API call to Flatten Annotations using JavaScript.\u003C\u002Fp>\n\n\u003Ch2>Flatten Annotations with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F**\n * This request demonstrates how to flatten annotations in a PDF.\n *\u002F\nvar axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\ndata.append(\"output\", \"pdfrest_flattened_annotations_pdf\");\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: \"post\",\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: \"https:\u002F\u002Fapi.pdfrest.com\u002Fflattened-annotations-pdf\",\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", \u002F\u002F Replace with your API key\n    ...data.getHeaders(), \u002F\u002F set headers for the request\n  },\n  data: data, \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error);\n  });\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>The source of the provided code can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fflattened-annotations-pdf.js\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code snippet above demonstrates how to use the pdfRest Flatten Annotations API with JavaScript:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\n\u003C\u002Fpre>\n\n\u003Cp>This part of the code includes the necessary modules: \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests, \u003Ccode>FormData\u003C\u002Fcode> for creating multipart\u002Fform-data payloads, and \u003Ccode>fs\u003C\u002Fcode> for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\ndata.append(\"output\", \"pdfrest_flattened_annotations_pdf\");\n\u003C\u002Fpre>\n\n\u003Cp>Here, a new \u003Ccode>FormData\u003C\u002Fcode> instance is created, and the PDF file to be flattened is appended to it along with an output parameter that specifies the name of the output file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: \"post\",\n  maxBodyLength: Infinity,\n  url: \"https:\u002F\u002Fapi.pdfrest.com\u002Fflattened-annotations-pdf\",\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    ...data.getHeaders(),\n  },\n  data: data,\n};\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>config\u003C\u002Fcode> object defines the configuration for the axios request, including the API endpoint URL, the API key for authentication, and the data payload.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error);\n  });\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the axios request is sent, and the response is handled in the promise's \u003Ccode>then\u003C\u002Fcode> method, or an error is caught in the \u003Ccode>catch\u003C\u002Fcode> method.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you've learned how to use JavaScript to call the pdfRest Flatten Annotations API. This allows you to integrate PDF annotation flattening into your JavaScript applications seamlessly. To further explore and demo all of the pdfRest API Tools, you can visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For comprehensive documentation on all available endpoints and parameters, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fflattened-annotations-pdf.js\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-09T21:54:19.000+00:00","2026-09-02T18:28:50.000+00:00","Learn how to us JavaScript to flatten annotations in PDF files by calling Flatten Annotations API Tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Flatten Annotations in PDF Files with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-02-09T21:54:19.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:50.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to us JavaScript to flatten annotations in PDF files by calling Flatten Annotations API Tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Flatten Annotations API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-annotations\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fflattened-annotations-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-annotations\"\n        }\n      ],\n      \"keywords\": \"Flatten Annotations, JavaScript\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Flatten Annotations in PDF Files with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8874,8875,8876,8877],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1895,"name":1896,"slug":1897,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-flatten-annotations-in-pdf-files-with-javascript-in-nodejs\u002F","How to Flatten Annotations in PDF Files with JavaScript in NodeJS, Tutorial | pdfRest",{"id":8882,"uuid":8883,"title":8884,"slug":8885,"html":8886,"comment_id":8882,"feature_image":48,"featured":284,"visibility":1257,"created_at":8887,"updated_at":8870,"published_at":8887,"custom_excerpt":8888,"codeinjection_head":8889,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8890,"primary_tag":8895,"url":8896,"excerpt":8888,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8897,"meta_description":8888,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65c6a1ac533c9f26b9436235","aea08737-d61d-40b8-ac23-94ac1cde909a","How to Flatten Annotations in PDF Files with PHP","how-to-flatten-annotations-in-pdf-files-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Cp>\n    The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-annotations\u002F'>Flatten Annotations API Tool\u003C\u002Fa> allows developers to programmatically merge annotations into a PDF's content. This is useful when you need to finalize a document so that comments, highlights, and other markups can no longer be modified or removed. This process is essential for creating a final, static version of a document, such as a legal contract or a finished report.\n\u003C\u002Fp>\n\n\u003Cp>\n    This tutorial will guide you through the process of using our PHP client to make an API call to the Flatten Annotations endpoint. This is particularly useful for PHP developers who need to automate document finalization within their applications.\n\u003C\u002Fp>\n\n\u003Ch2>Flatten Annotations with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">\nrequire 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => 'example.pdf',\n      'headers' => [\n        'Content-Type' => 'application\u002Fpdf'\n      ]\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_flattened_pdf'\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fflattened-annotations-pdf', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fflattened-annotations-pdf.php\">GitHub - datalogics\u002Fpdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This script uses the Guzzle HTTP client to communicate with the pdfRest API. The key components of the multipart request are designed to securely send your file and specify the flattening operation.\u003C\u002Fp>\n\n\u003Cul>\n    \u003Cli>The \u003Ccode>'Api-Key'\u003C\u002Fcode> in the headers is your unique key for authentication.\u003C\u002Fli>\n    \u003Cli>The \u003Ccode>'name' => 'file'\u003C\u002Fcode> part of the request carries the PDF document you want to process. The \u003Ccode>'contents'\u003C\u002Fcode> key uses \u003Ccode>Utils::tryFopen\u003C\u002Fcode> to open the file securely from the specified path.\u003C\u002Fli>\n    \u003Cli>The \u003Ccode>'name' => 'output'\u003C\u002Fcode> parameter, set to \u003Ccode>'pdfrest_flattened_pdf'\u003C\u002Fcode>, instructs the API to perform the specific action of merging all annotations into the document content.\u003C\u002Fli>\n    \u003Cli>The request is sent to the \u003Ccode>https:\u002F\u002Fapi.pdfrest.com\u002Fflattened-annotations-pdf\u003C\u002Fcode> endpoint, which is dedicated to this particular tool.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Frequently Asked Questions\u003C\u002Fh2>\n\n\u003Cp>Below are some common questions about flattening PDF annotations.\u003C\u002Fp>\n\n\u003Cdl>\n    \u003Cdt>What types of annotations are supported?\u003C\u002Fdt>\n    \u003Cdd>The API is designed to flatten all standard PDF annotation types, including text highlights, underlines, sticky notes, comments, shapes, and stamps. It merges them into the document's content layer so they become permanent.\u003C\u002Fdd>\n\n    \u003Cdt>Does flattening a PDF affect hyperlinks?\u003C\u002Fdt>\n    \u003Cdd>The flattening process does not affect hyperlinks within the document's content. These links will remain active and clickable after the process is complete.\u003C\u002Fdd>\n\n    \u003Cdt>Can I unflatten a PDF after processing it?\u003C\u002Fdt>\n    \u003Cdd>No, the flattening process is permanent. Once annotations are merged into the document content, they cannot be unflattened or edited as separate objects. It is always recommended to work with a copy of your original file.\u003C\u002Fdd>\n\u003C\u002Fdl>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following these steps, you have successfully implemented the pdfRest Flatten Annotations API. You can now integrate this functionality into your applications to automate the process of finalizing and securing PDF documents. To explore all of the available API tools and features, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and our comprehensive \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API documentation\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-09T22:05:32.000+00:00","Learn how to use PHP to flatten annotations in PDF files by calling Flatten Annotations AI Tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-php\u002F#article\",\n      \"headline\": \"How to Flatten Annotations in PDF Files with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-php\u002F\",\n      \"datePublished\": \"2024-02-09T22:05:32.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:50.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use PHP to flatten annotations in PDF files by calling Flatten Annotations AI Tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Flatten Annotations API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-annotations\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fflattened-annotations-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-annotations\"\n        }\n      ],\n      \"keywords\": \"Flatten Annotations, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Flatten Annotations in PDF Files with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8891,8892,8893,8894],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1895,"name":1896,"slug":1897,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-flatten-annotations-in-pdf-files-with-php\u002F","How to Flatten Annotations in PDF Files with PHP, Tutorial | pdfRest",{"id":8899,"uuid":8900,"title":8901,"slug":8902,"html":8903,"comment_id":8899,"feature_image":48,"featured":284,"visibility":1257,"created_at":8904,"updated_at":8870,"published_at":8904,"custom_excerpt":8905,"codeinjection_head":8906,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8907,"primary_tag":8912,"url":8913,"excerpt":8905,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8914,"meta_description":8905,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65c6a3ae533c9f26b943623f","06a304b9-6d69-4b71-a08e-b92b54519cc9","How to Flatten Annotations in PDF Files with Python","how-to-flatten-annotations-in-pdf-files-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Flatten Annotations with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-annotations\u002F'>Flatten Annotations API Tool\u003C\u002Fa> is designed to permanently merge annotations into the PDF content layer. This is useful when you want to ensure that comments, form fields, or markup added to a PDF are preserved when the document is printed or viewed on systems where annotations may not be displayed by default. For instance, if you've collected feedback on a document and want to create a version with all comments embedded for archival purposes, flattening annotations would be the way to go.\u003C\u002Fp> \n  \n\u003Cp>This tutorial will show you how to send an API call to Flatten Annotations using Python.\u003C\u002Fp>\n\n\u003Ch2>Flatten Annotations with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nflattened_annotations_pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fflattened-annotations-pdf'\n\nmp_encoder_flattenedPDF = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_out'\n    }\n)\n\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_flattenedPDF.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to flattened-annotations-pdf endpoint...\")\nresponse = requests.post(flattened_annotations_pdf_endpoint_url, data=mp_encoder_flattenedPDF, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fflattened-annotations-pdf.py\">pdf-rest-api-samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This code snippet demonstrates how to use the pdfRest Flatten Annotations API with Python:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\u003C\u002Fpre>\n\n\u003Cp>These lines import the necessary libraries. \u003Ccode>MultipartEncoder\u003C\u002Fcode> from \u003Ccode>requests_toolbelt\u003C\u002Fcode> is used for encoding multipart form data. The \u003Ccode>requests\u003C\u002Fcode> library is used to send HTTP requests, and \u003Ccode>json\u003C\u002Fcode> is used for working with JSON data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_flattenedPDF = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_out'\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>This section creates a \u003Ccode>MultipartEncoder\u003C\u002Fcode> object with the PDF file to flatten and the desired output name. Replace \u003Ccode>'\u002Fpath\u002Fto\u002Ffile'\u003C\u002Fcode> with the actual file path and \u003Ccode>'file_name.pdf'\u003C\u002Fcode> with the actual file name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_flattenedPDF.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\u003C\u002Fpre>\n\n\u003Cp>Here, the headers for the HTTP request are defined. The \u003Ccode>'Api-Key'\u003C\u002Fcode> should be replaced with your actual API key from pdfRest.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(flattened_annotations_pdf_endpoint_url, data=mp_encoder_flattenedPDF, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This line sends the POST request to the pdfRest API endpoint with the encoded PDF data and headers.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you've learned how to call the pdfRest Flatten Annotations API using Python. This can be a powerful tool in your document processing workflow, ensuring annotations are preserved in the final document version. You're encouraged to demo all of the pdfRest API Tools in the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\u003C\u002Fa> and refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa> for more information.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fflattened-annotations-pdf.py\">https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fflattened-annotations-pdf.py\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-09T22:14:06.000+00:00","Learn how to use Python to flatten annotations to PDF files by calling Flatten Annotations by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-python\u002F#article\",\n      \"headline\": \"How to Flatten Annotations in PDF Files with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-python\u002F\",\n      \"datePublished\": \"2024-02-09T22:14:06.000Z\",\n      \"dateModified\": \"2026-09-01T14:52:11.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use Python to flatten annotations to PDF files by calling Flatten Annotations by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Flatten Annotations API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-annotations\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fflattened-annotations-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-annotations\"\n        }\n      ],\n      \"keywords\": \"Flatten Annotations, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Flatten Annotations in PDF Files with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-annotations-in-pdf-files-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8908,8909,8910,8911],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1895,"name":1896,"slug":1897,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-flatten-annotations-in-pdf-files-with-python\u002F","How to Flatten Annotations in PDF Files with Python, Tutorial | pdfRest",{"id":8916,"uuid":8917,"title":8918,"slug":8919,"html":8920,"comment_id":8916,"feature_image":48,"featured":284,"visibility":1257,"created_at":8921,"updated_at":8922,"published_at":8921,"custom_excerpt":8923,"codeinjection_head":8924,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8925,"primary_tag":8930,"url":8931,"excerpt":8923,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8932,"meta_description":8923,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65c507fd533c9f26b94360e2","14def195-820a-43cd-a5eb-09e4356eea6f","How to Flatten Layers in PDF Files in .NET with C#","how-to-flatten-layers-in-pdf-files-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Flatten Layers with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-layers\u002F'>Flatten Layers API Tool\u003C\u002Fa> is designed to simplify PDFs by merging layers into a single layer, which can be useful in various scenarios such as ensuring compatibility with older PDF viewers, reducing file size, or preparing a document for printing. \u003C\u002Fp>\n\n  \u003Cp>This tutorial will guide you through the process of sending an API call to Flatten Layers using C#. For example, a graphic designer might use Flatten Layers to ensure that a complex brochure with multiple layers prints correctly without any layering issues.\u003C\u002Fp>\n\n\u003Ch2>Flatten Layers with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"flattened-layers-pdf\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source code reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fflattened-layers-pdf.cs\">GitHub - pdfRest API Samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code snippet above demonstrates how to use C# to call the pdfRest Flatten Layers API. Let's break down what each part of the code is doing:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>This line initializes a new instance of the HttpClient class with the base address set to the pdfRest API endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var request = new HttpRequestMessage(HttpMethod.Post, \"flattened-layers-pdf\"))\n\u003C\u002Fpre>\n\n\u003Cp>Here, we're creating a new POST request to the \"flattened-layers-pdf\" endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>This line adds your API key to the request headers. Replace \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" with your actual pdfRest API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n\u003C\u002Fpre>\n\n\u003Cp>This initializes a new MultipartFormDataContent object, which allows you to send files as part of the request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name\");\n\u003C\u002Fpre>\n\n\u003Cp>These lines read the PDF file you want to flatten from the specified path, create a ByteArrayContent with the file's bytes, and add it to the multipart content with the form field name \"file\" and the filename \"file_name\".\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\n\u003C\u002Fpre>\n\n\u003Cp>This line sends the request to the pdfRest API and waits for the response.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>Once the response is received, this line reads the content of the response as a string.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps in this tutorial, you've successfully called the pdfRest Flatten Layers API using C#. This allows you to programmatically flatten layers in a PDF document and handle the resulting file as needed. You're encouraged to demo all of the pdfRest API Tools in the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\u003C\u002Fa> and refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa> for more information.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fflattened-layers-pdf.cs\">GitHub - pdfRest API Samples (JSON Payload)\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-08T16:57:33.000+00:00","2026-09-02T18:28:51.000+00:00","Learn how to use .NET to Flatten Layers in PDF Files by calling Flatten Layers API Tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-layers-in-pdf-files-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Flatten Layers in PDF Files in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-layers-in-pdf-files-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-layers-in-pdf-files-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-02-08T16:57:33.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:52.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use .NET to Flatten Layers in PDF Files by calling Flatten Layers API Tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Flatten Layers API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-layers\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fflattened-layers-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-layers\"\n        }\n      ],\n      \"keywords\": \".NET, Flatten Layers\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Flatten Layers in PDF Files in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-layers-in-pdf-files-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8926,8927,8928,8929],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1899,"name":1900,"slug":1901,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-flatten-layers-in-pdf-files-in-net-with-c\u002F","How to Flatten Layers in PDF Files in .NET with C#, Tutorial | pdfRest",{"id":8934,"uuid":8935,"title":8936,"slug":8937,"html":8938,"comment_id":8939,"feature_image":48,"featured":284,"visibility":1257,"created_at":8940,"updated_at":8922,"published_at":8940,"custom_excerpt":8941,"codeinjection_head":8942,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8943,"primary_tag":8948,"url":8949,"excerpt":8941,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8950,"meta_description":8941,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1371","704b8e51-020b-467e-bc4e-7c92414ed46c","How to Flatten Layers of a PDF with Python","how-to-flatten-layers-of-a-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Flatten Layers with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-layers\u002F'>Flatten Layers API Tool\u003C\u002Fa> is a powerful resource for developers who need to programmatically flatten layers in PDF documents. Flattening layers merges all visible layers into a single layer, which can be useful for ensuring consistent viewing across different platforms and software.\u003C\u002Fp>\n    \n\u003Cp>For example, a graphic designer might need to flatten a PDF before sending it to a print shop to prevent any layers from being accidentally altered or omitted during the printing process. This tutorial will guide you through the process of sending an API call to Flatten Layers using Python.\u003C\u002Fp>\n\n\u003Ch2>Flatten Layers with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nflattened_layers_pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fflattened-layers-pdf'\n\nmp_encoder_flattenedPDF = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_out'\n    }\n)\n\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_flattenedPDF.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to flattened-layers-pdf endpoint...\")\nresponse = requests.post(flattened_layers_pdf_endpoint_url, data=mp_encoder_flattenedPDF, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Source of the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fflattened-layers-pdf.py\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Python Code\u003C\u002Fh2>\n\n\u003Cp>The provided Python code performs the following steps to flatten layers in a PDF document:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">flattened_layers_pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fflattened-layers-pdf'\n\u003C\u002Fpre>\n\n\u003Cp>This line sets the endpoint URL for the Flatten Layers API tool.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_flattenedPDF = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_out'\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>The MultipartEncoder is used to build the multipart\u002Fform-data payload. It includes the PDF file to be flattened and the desired output name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_flattenedPDF.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\u003C\u002Fpre>\n\n\u003Cp>Headers are set to accept JSON responses, declare the content type, and include the API key for authentication.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(flattened_layers_pdf_endpoint_url, data=mp_encoder_flattenedPDF, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This line sends the POST request with the payload and headers to the endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>If the request is successful, the response is printed in a readable JSON format. Otherwise, the error text is printed.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps outlined above, you have learned how to make an API call to the pdfRest Flatten Layers API using Python. You can now use this knowledge to automate the process of flattening layers in PDFs for various applications. To further explore the capabilities of pdfRest, you can demo all of the pdfRest API Tools in the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\u003C\u002Fa>. Additionally, refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\u003C\u002Fa> for more details on how to use the different features offered by the service.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fflattened-layers-pdf.py\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","659d8f3b2d4014c9499b3d25","2024-01-09T18:23:55.000+00:00","Learn how to flatten the layers of a PDF using Python to call the Flatten Layers API tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-layers-of-a-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Flatten Layers of a PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-layers-of-a-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-layers-of-a-pdf-with-python\u002F\",\n      \"datePublished\": \"2024-01-09T18:23:55.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:55.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to flatten the layers of a PDF using Python to call the Flatten Layers API tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Flatten Layers API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-layers\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fflattened-layers-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-layers\"\n        }\n      ],\n      \"keywords\": \"Flatten Layers, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Flatten Layers of a PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-layers-of-a-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8944,8945,8946,8947],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1899,"name":1900,"slug":1901,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-flatten-layers-of-a-pdf-with-python\u002F","How to Flatten Layers of a PDF with Python, Tutorial | pdfRest",{"id":8952,"uuid":8953,"title":8954,"slug":8955,"html":8956,"comment_id":8952,"feature_image":48,"featured":284,"visibility":1257,"created_at":8957,"updated_at":8958,"published_at":8957,"custom_excerpt":8959,"codeinjection_head":8960,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8961,"primary_tag":8967,"url":8968,"excerpt":8959,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8969,"meta_description":8959,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"660c5213533c9f26b9436f2e","660818d3-53df-48dc-ae76-0e3eb4a34423","How to Flatten PDF Forms in .NET with C#","how-to-flatten-pdf-forms-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Flatten PDF Forms with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-forms\u002F'>Flatten Forms API Tool\u003C\u002Fa> is designed to help users convert interactive PDF forms into static PDF documents by flattening form fields. This means that the form fields are no longer editable and become part of the PDF content, preserving the data entered into the form. This tutorial will guide you through the process of sending an API call to the Flatten Forms endpoint using C# to achieve this result.\u003C\u002Fp>\n\n\u003Cp>Flattening forms can be particularly useful in scenarios where you want to finalize the content of a form after it has been filled out, such as when submitting official documents or archiving filled forms for record-keeping. For instance, a business might use this tool to flatten employment application forms after they have been completed by applicants, ensuring that the information provided cannot be altered and is ready for review and storage.\u003C\u002Fp>\n\n\u003Ch2>Flatten PDF Forms with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"flattened-forms-pdf\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fflattened-forms-pdf.cs\">pdf-rest-api-samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code above demonstrates how to make a multipart API call to the pdfRest Flatten Forms API using C#. Let's break down the key parts of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") };\n\u003C\u002Fpre>\n\n\u003Cp>This line initializes a new instance of the HttpClient class and sets the BaseAddress to the pdfRest API endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>This line adds your API key to the request headers, which is required for authentication with the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n\u003C\u002Fpre>\n\n\u003Cp>A new instance of MultipartFormDataContent is created to hold the file and any other parts of the multipart request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\u003C\u002Fpre>\n\n\u003Cp>These lines read the PDF file into a byte array, create a ByteArrayContent with this array, and add it to the multipart content with the appropriate content type header for PDF files.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\nvar apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the API call is sent asynchronously, and the response is read into a string which is then output to the console.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps outlined above, you have learned how to programmatically flatten PDF forms using C# and the pdfRest API. This capability can be integrated into various applications to automate the process of converting interactive forms into non-editable documents.\u003C\u002Fp>\n\n\u003Cp>We encourage you to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for more detailed information on other API endpoints and their usage.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fflattened-forms-pdf.cs\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-04-02T18:44:35.000+00:00","2026-09-02T18:28:52.000+00:00","Learn how to use pdfRest Flatten Forms API Tool with C# to flatten PDF forms","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Flatten PDF Forms in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-04-02T18:44:35.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:35.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Flatten Forms API Tool with C# to flatten PDF forms\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Flatten Forms API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-forms\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fflattened-forms-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-forms\"\n        }\n      ],\n      \"keywords\": \".NET, Flatten Forms, Forms\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Flatten PDF Forms in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8962,8963,8964,8965,8966],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1778,"name":1779,"slug":1780,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1782,"name":1783,"slug":1784,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-flatten-pdf-forms-in-net-with-c\u002F","How to Flatten PDF Forms in .NET with C#, Tutorial | pdfRest",{"id":8971,"uuid":8972,"title":8973,"slug":8974,"html":8975,"comment_id":8971,"feature_image":48,"featured":284,"visibility":1257,"created_at":8976,"updated_at":8958,"published_at":8976,"custom_excerpt":8977,"codeinjection_head":8978,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8979,"primary_tag":8985,"url":8986,"excerpt":8977,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":8987,"meta_description":8977,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"660c519e533c9f26b9436f24","b7089a38-5de1-4740-9627-fbbae1a39cb5","How to Flatten PDF Forms with cURL","how-to-flatten-pdf-forms-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Flatten PDF Forms with cURL?\u003C\u002Fh2>\n\n\u003Cp>\nThe pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-forms\u002F'>Flatten Forms API Tool\u003C\u002Fa> is designed for users who need to convert interactive PDF forms into non-interactive, flat documents. This process is known as \"flattening\" and it ensures that the form data is displayed as part of the PDF content, preventing any further modifications. This tutorial will guide you through the process of sending an API call to the Flatten Forms endpoint using cURL, a powerful and versatile command-line tool used for transferring data with URLs.\n\u003C\u002Fp>\n\n\u003Cp>\nAn organization might need to archive submitted forms in a non-editable format for compliance purposes. After collecting data through interactive forms, the organization can use the Flatten Forms API to create a final version of the document that preserves the entered data in a format that can be easily shared, printed, or archived without the risk of further alterations.\n\u003C\u002Fp>\n\n\u003Ch2>Flatten PDF Forms with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fflattened-forms-pdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>Reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fflattened-forms-pdf.sh\">pdf-rest-api-samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>\nLet's break down the provided cURL command to understand how it works:\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-X POST\n\u003C\u002Fpre>\n\n\u003Cp>\nThis specifies the HTTP method for the request, which is POST in this case, indicating that we are sending data to the server to create or update a resource.\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">\"https:\u002F\u002Fapi.pdfrest.com\u002Fflattened-forms-pdf\"\n\u003C\u002Fpre>\n\n\u003Cp>\nThis is the URL of the API endpoint that will process the flattening of the PDF form.\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\n\u003C\u002Fpre>\n\n\u003Cp>\nThis header tells the server that the client expects a response in JSON format.\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\n\u003C\u002Fpre>\n\n\u003Cp>\nThis header indicates that the body of the request contains form data encoded as a multipart MIME message, which is necessary for file uploads.\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>\nThis header provides your unique API key for authentication with the pdfRest API service.\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\n\u003C\u002Fpre>\n\n\u003Cp>\nThe '-F' flag is used to specify each field that will be sent as part of the 'multipart\u002Fform-data'. Here, 'file' is the field name and '@\u002Fpath\u002Fto\u002Ffile' is the file path to the PDF that needs to be flattened.\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>\nAnother field is specified using the '-F' flag. 'output' is the field name, and 'example_out' is the desired name for the output file after the PDF has been flattened.\n\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>\nBy following the steps outlined above, you have learned how to use cURL to make a request to the pdfRest Flatten Forms API, which will process an interactive PDF form and return a flattened version. This is particularly useful for preserving the integrity of form data and preparing documents for distribution or archival.\n\u003C\u002Fp>\n\n\u003Cp>\nTo explore more capabilities of the pdfRest API, you are encouraged to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further information and to deepen your understanding, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\n\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fflattened-forms-pdf.sh\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-04-02T18:42:38.000+00:00","Learn how to use the Flatten Forms API Tool by pdfRest to flatten PDF forms with cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-curl\u002F#article\",\n      \"headline\": \"How to Flatten PDF Forms with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-curl\u002F\",\n      \"datePublished\": \"2024-04-02T18:42:38.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:35.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use the Flatten Forms API Tool by pdfRest to flatten PDF forms with cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Flatten Forms API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-forms\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fflattened-forms-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-forms\"\n        }\n      ],\n      \"keywords\": \"Flatten Forms, Forms, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Flatten PDF Forms with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8980,8981,8982,8983,8984],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1778,"name":1779,"slug":1780,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1782,"name":1783,"slug":1784,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-flatten-pdf-forms-with-curl\u002F","How to Flatten PDF Forms with cURL, Tutorial | pdfRest",{"id":8989,"uuid":8990,"title":8991,"slug":8992,"html":8993,"comment_id":8989,"feature_image":48,"featured":284,"visibility":1257,"created_at":8994,"updated_at":8958,"published_at":8852,"custom_excerpt":8995,"codeinjection_head":8996,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":8997,"primary_tag":9003,"url":9004,"excerpt":8995,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9005,"meta_description":8995,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c5f533c9f26b943b573","1055343c-6b89-465c-8794-743b98568496","How to Flatten PDF Forms with Java","how-to-flatten-pdf-forms-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>Follow this Java walkthrough to flatten PDF forms with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-forms\u002F\">Flatten Forms API Tool\u003C\u002Fa>. The Java call sends a completed form to \u003Ccode>\u002Fflattened-forms-pdf\u003C\u002Fcode> and receives a static, non-interactive PDF resource for final distribution. Along the way, you'll see which fields are needed to flatten PDF forms and how the response fits into later processing.\u003C\u002Fp>\n\n\u003Ch2>Why Flatten PDF Forms with Java?\u003C\u002Fh2>\n\n\u003Cp>A completed application may need to show its entered values while preventing later field edits. Flattening creates a non-interactive presentation of those values for final records.\u003C\u002Fp>\n\n\u003Cp>The Java client calls \u003Ccode>\u002Fflattened-forms-pdf\u003C\u002Fcode> with the source PDF. The generated file keeps field appearances but removes their interactive form behavior.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class FlattenedFormsPDF {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"flattened\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fflattened-forms-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FFlattenedFormsPDF.java\">Java sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The library group relies on OkHttp to send the call, dotenv to resolve credentials, and \u003Ccode>org.json\u003C\u002Fcode> to inspect or format JSON.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>This initialization step supports quick local testing while allowing normal callers to provide their own path and \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"flattened\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fflattened-forms-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The Java client calls \u003Ccode>\u002Fflattened-forms-pdf\u003C\u002Fcode> with the source PDF. The generated file keeps field appearances but removes their interactive form behavior. The multipart builder sets \u003Ccode>MultipartBody.FORM\u003C\u002Fcode>, allowing OkHttp to generate the matching boundary automatically.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fflattened-forms-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The authenticated call joins authentication, routing, and payload in one place while leaving regional service selection in the API URL constant.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>The final section makes success and failure information available to the caller, including any temporary resources that must be saved or reused before expiration.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial showed how a Java application can flatten PDF forms. With that foundation, you can use form flattening for finalized submissions, signed packets, print workflows, and fixed archival copies.\u003C\u002Fp>\n\n\u003Cp>For production use, keep in mind that once flattened, fields can no longer be edited or exported as interactive form data from the output. Keep the original form when later corrections may be required, and verify appearances for checkboxes, signatures, multiline text, and fields with custom styling.\u003C\u002Fp>\n\n\u003Cp>Use \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> to inspect the request and output from the Flatten PDF Forms operation. For the complete set of options supported by Flatten PDF Forms, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-forms\u002F\">Flatten Forms API Tool documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: The Flatten PDF Forms example above uses multipart form data; for an existing resource rather than a new upload, see the request shape in the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FFlattenedFormsPDF.java\">JSON payload example\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T17:33:19.000+00:00","Flatten completed PDF form fields into static page content with Java.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-java\u002F#article\",\n      \"headline\": \"How to Flatten PDF Forms with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:39.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:39.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Flatten completed PDF form fields into static page content with Java.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Flatten Forms API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-forms\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fflattened-forms-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-forms\"\n        }\n      ],\n      \"keywords\": \"Flatten Forms, Forms, Java\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Flatten PDF Forms with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[8998,8999,9000,9001,9002],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1778,"name":1779,"slug":1780,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1782,"name":1783,"slug":1784,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-flatten-pdf-forms-with-java\u002F","Flatten PDF Forms with Java | pdfRest",{"id":9007,"uuid":9008,"title":9009,"slug":9010,"html":9011,"comment_id":9007,"feature_image":48,"featured":284,"visibility":1257,"created_at":9012,"updated_at":9013,"published_at":9012,"custom_excerpt":9014,"codeinjection_head":9015,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9016,"primary_tag":9022,"url":9023,"excerpt":9014,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9024,"meta_description":9014,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"660c514e533c9f26b9436f1a","ef763afc-7db9-4aca-8dd2-30bbfb8cdd99","How to Flatten PDF Forms with JavaScript in NodeJS","how-to-flatten-pdf-forms-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Flatten PDF Forms with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-forms\u002F'>Flatten Forms API Tool\u003C\u002Fa> is a powerful resource for developers working with PDF forms. Flattening a PDF form means converting the editable form fields into static content, which ensures that the entered data cannot be altered. This tutorial will guide you through the process of sending an API call to the Flatten Forms API using JavaScript, which can be particularly useful when you need to programmatically process PDFs within a web application or a server-side script.\u003C\u002Fp>\n\n\u003Cp>Consider a scenario where you're running a business that collects customer feedback through PDF forms. Once a customer fills out the form, you might want to secure the information by flattening the form before archiving it or sending it to another department. By using the Flatten Forms API with JavaScript, you can automate this process, ensuring that the data remains intact and unchangeable, thus maintaining data integrity and preventing any post-submission modifications.\u003C\u002Fp>\n\n\u003Ch2>Flatten PDF Forms with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F**\n * This request demonstrates how to flatten forms in a PDF.\n *\u002F\nvar axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\ndata.append(\"output\", \"pdfrest_flattened_forms_pdf\");\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: \"post\",\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: \"https:\u002F\u002Fapi.pdfrest.com\u002Fflattened-forms-pdf\",\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", \u002F\u002F Replace with your API key\n    ...data.getHeaders(), \u002F\u002F set headers for the request\n  },\n  data: data, \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error);\n  });\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>The provided code can be found in the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fflattened-forms-pdf.js\">pdfRest API samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing the necessary modules: axios for HTTP requests, FormData for constructing multipart\u002Fform-data payloads, and fs for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\n\u003C\u002Fpre>\n\n\u003Cp>A new FormData instance is created and the PDF file along with output parameter are appended to it. The file path should be replaced with the actual path to your PDF file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\ndata.append(\"output\", \"pdfrest_flattened_forms_pdf\");\n\u003C\u002Fpre>\n\n\u003Cp>The configuration object for the axios request is defined with the request method, URL, headers (including the API key), and data. The API key should be replaced with your actual pdfRest API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: \"post\",\n  maxBodyLength: Infinity,\n  url: \"https:\u002F\u002Fapi.pdfrest.com\u002Fflattened-forms-pdf\",\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    ...data.getHeaders(),\n  },\n  data: data,\n};\n\u003C\u002Fpre>\n\n\u003Cp>The axios request is sent, and the response or error is handled with a promise. On success, the response data is logged to the console.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error);\n  });\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following this tutorial, you've learned how to send an API call to the Flatten Forms endpoint of pdfRest using JavaScript. With this knowledge, you can start integrating PDF form flattening capabilities into your applications. To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further information and a comprehensive understanding of the API's capabilities, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. For code samples using JSON payloads, you can visit the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fflattened-forms-pdf.js\">pdfRest API samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-04-02T18:41:18.000+00:00","2026-09-02T18:28:53.000+00:00","Learn how to flatten PDF forms with pdfRest Flatten Forms API Tool using JavaScript","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Flatten PDF Forms with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-04-02T18:41:18.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:35.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to flatten PDF forms with pdfRest Flatten Forms API Tool using JavaScript\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Flatten Forms API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-forms\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fflattened-forms-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-forms\"\n        }\n      ],\n      \"keywords\": \"Flatten Forms, Forms, JavaScript\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Flatten PDF Forms with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9017,9018,9019,9020,9021],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1778,"name":1779,"slug":1780,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1782,"name":1783,"slug":1784,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-flatten-pdf-forms-with-javascript-in-nodejs\u002F","How to Flatten PDF Forms with JavaScript in NodeJS, Tutorial | pdfRest",{"id":9026,"uuid":9027,"title":9028,"slug":9029,"html":9030,"comment_id":9026,"feature_image":48,"featured":284,"visibility":1257,"created_at":9031,"updated_at":9032,"published_at":9031,"custom_excerpt":9033,"codeinjection_head":9034,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9035,"primary_tag":9041,"url":9042,"excerpt":9033,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9043,"meta_description":9033,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"660c50e0533c9f26b9436f10","b49c1245-2190-48b9-b54d-1cb1c11cfda8","How to Flatten PDF Forms with PHP","how-to-flatten-pdf-forms-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Flatten PDF Forms with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-forms\u002F\">Flatten Forms API Tool\u003C\u002Fa> is a powerful resource for developers looking to programmatically flatten form fields within a PDF. Flattening forms means converting the editable form fields into static text, which is part of the PDF content and can no longer be edited. This tutorial will guide you through the process of sending an API call to the Flatten Forms endpoint using PHP, which is a common server-side scripting language used in web development.\u003C\u002Fp>\n\n\u003Cp>In the real world, flattening forms can be crucial for preserving the content of filled-out forms, such as applications, contracts, or any other documents that require user input. Once a form is flattened, the information entered by the user is secured, and the document can be distributed without the risk of further modifications. This is particularly useful for finalizing documents before archiving or sharing them with parties that should not alter the content.\u003C\u002Fp>\n\n\u003Ch2>Flatten PDF Forms with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers'  => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_flattened_pdf'\n    ]\n]];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fflattened-forms-pdf', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source of the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fflattened-forms-pdf.php\">GitHub - datalogics\u002Fpdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by loading the required libraries for making HTTP requests. The \u003Ccode>GuzzleHttp\\Client\u003C\u002Fcode> class is used to send requests to the server, and the \u003Ccode>GuzzleHttp\\Psr7\\Request\u003C\u002Fcode> and \u003Ccode>GuzzleHttp\\Psr7\\Utils\u003C\u002Fcode> classes are used to create and manage the request and file streams, respectively.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\u003C\u002Fpre>\n\n\u003Cp>Next, an API key is set in the headers to authenticate the request:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The options array is where the multipart form data is defined. This includes the file to be flattened and the desired output name:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">'options' => [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers'  => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_flattened_pdf'\n    ]\n]];\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>The request is then created and sent asynchronously, with the response being outputted to the user:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fflattened-forms-pdf', $headers);\n$res = $client->sendAsync($request, $options)->wait();\necho $res->getBody();\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following this tutorial, you have learned how to send a multipart API call to the pdfRest Flatten Forms API using PHP. This enables you to flatten form fields in a PDF document, securing the data entered by users and preparing the document for distribution or archiving. You're encouraged to explore and demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for further information.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fflattened-forms-pdf.php\">GitHub - datalogics\u002Fpdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-04-02T18:39:28.000+00:00","2026-09-10T20:19:06.000+00:00","Learn how to use pdfRest Flatten Forms API Tool to flatten PDF forms with PHP","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-php\u002F#article\",\n      \"headline\": \"How to Flatten PDF Forms with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-php\u002F\",\n      \"datePublished\": \"2024-04-02T18:39:28.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:35.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Flatten Forms API Tool to flatten PDF forms with PHP\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Flatten Forms API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-forms\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fflattened-forms-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-forms\"\n        }\n      ],\n      \"keywords\": \"Flatten Forms, Forms, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Flatten PDF Forms with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9036,9037,9038,9039,9040],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1778,"name":1779,"slug":1780,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1782,"name":1783,"slug":1784,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-flatten-pdf-forms-with-php\u002F","How to Flatten PDF Forms with PHP, Tutorial | pdfRest",{"id":9045,"uuid":9046,"title":9047,"slug":9048,"html":9049,"comment_id":9050,"feature_image":48,"featured":284,"visibility":1257,"created_at":9051,"updated_at":9052,"published_at":9051,"custom_excerpt":9053,"codeinjection_head":9054,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9055,"primary_tag":9061,"url":9062,"excerpt":9053,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9063,"meta_description":9053,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1356","e5a04f8c-9415-4745-a662-2877bdf4864d","How to Flatten PDF Forms with Python","how-to-flatten-pdf-forms-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Flatten PDF Forms with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-forms\u002F'>Flatten Forms API Tool\u003C\u002Fa> provides a simple way to flatten form fields in a PDF, meaning it converts form fields into static text. This is useful in scenarios where you want to finalize a form by preventing any further edits, such as after a user has filled out a form and you want to archive it or send it as a non-editable document.\u003C\u002Fp>\n\n\u003Cp>This tutorial will guide you through the process of sending an API call to the Flatten Forms endpoint using Python.\u003C\u002Fp>\n\n\u003Ch2>Flatten PDF Forms with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nflattened_forms_pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fflattened-forms-pdf'\n\nmp_encoder_flattenedPDF = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_out'\n    }\n)\n\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_flattenedPDF.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to flattened-forms-pdf endpoint...\")\nresponse = requests.post(flattened_forms_pdf_endpoint_url, data=mp_encoder_flattenedPDF, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Source code reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fflattened-forms-pdf.py\">GitHub - pdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code snippet above demonstrates how to use the requests library in Python to make a multipart\u002Fform-data POST request to the pdfRest Flatten Forms API endpoint. Let's break down the code into its components:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\u003C\u002Fpre>\n\n\u003Cp>This section imports the necessary modules. \u003Ccode>MultipartEncoder\u003C\u002Fcode> from \u003Ccode>requests_toolbelt\u003C\u002Fcode> is used to encode the files and fields for the multipart request, while \u003Ccode>requests\u003C\u002Fcode> is the main library used to send HTTP requests, and \u003Ccode>json\u003C\u002Fcode> is used to work with JSON data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">flattened_forms_pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fflattened-forms-pdf'\n\u003C\u002Fpre>\n\n\u003Cp>This line sets the URL for the Flatten Forms API endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_flattenedPDF = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_out'\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>This section creates a \u003Ccode>MultipartEncoder\u003C\u002Fcode> object with the fields to be sent in the request. The \u003Ccode>'file'\u003C\u002Fcode> field contains the PDF file to be flattened, and \u003Ccode>'output'\u003C\u002Fcode> specifies the base name for the output file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_flattenedPDF.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\u003C\u002Fpre>\n\n\u003Cp>Here, the headers for the request are set, including the \u003Ccode>Content-Type\u003C\u002Fcode> which is automatically set to the correct value by the \u003Ccode>MultipartEncoder\u003C\u002Fcode>, and the \u003Ccode>Api-Key\u003C\u002Fcode> which should be replaced with your actual API key from pdfRest.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(flattened_forms_pdf_endpoint_url, data=mp_encoder_flattenedPDF, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This line sends the POST request to the endpoint with the encoded data and headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the response is checked. If successful, the JSON response is printed in a formatted manner. Otherwise, the error text is printed.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we walked through how to make an API call to the pdfRest Flatten Forms API endpoint using Python. By sending a PDF file to this endpoint, we can flatten its forms, making it a static document that can no longer be edited. This is particularly useful for preserving the final state of filled-out forms.\u003C\u002Fp>\n\n\u003Cp>I encourage you to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for more details.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fflattened-forms-pdf.py\">GitHub - pdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","658216c62d4014c9499b3a0c","2023-12-19T22:18:46.000+00:00","2026-09-02T18:28:54.000+00:00","Learn how to flatten PDF form fields using Python to call the Flatten Forms API Tool, part of PDF Forms Pro Tools from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-python\u002F#article\",\n      \"headline\": \"How to Flatten PDF Forms with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-python\u002F\",\n      \"datePublished\": \"2023-12-19T22:18:46.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:59.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to flatten PDF form fields using Python to call the Flatten Forms API Tool, part of PDF Forms Pro Tools from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Flatten Forms API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-forms\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fflattened-forms-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-forms\"\n        }\n      ],\n      \"keywords\": \"Flatten Forms, Forms, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Flatten PDF Forms with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-forms-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9056,9057,9058,9059,9060],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1778,"name":1779,"slug":1780,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1782,"name":1783,"slug":1784,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-flatten-pdf-forms-with-python\u002F","How to Flatten PDF Forms with Python, Tutorial | pdfRest",{"id":9065,"uuid":9066,"title":9067,"slug":9068,"html":9069,"comment_id":9065,"feature_image":48,"featured":284,"visibility":1257,"created_at":8835,"updated_at":7326,"published_at":7326,"custom_excerpt":9070,"codeinjection_head":9071,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9072,"primary_tag":9077,"url":9078,"excerpt":9070,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9079,"meta_description":9070,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a9750cd533c9f26b943b779","027cbd12-e2e1-4e53-8307-63fa0b617745","How to Flatten PDF Layers with cURL","how-to-flatten-pdf-layers-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Cp>By the end of this tutorial, you'll understand how to flatten PDF layers with cURL and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-layers\u002F\">Flatten Layers API Tool\u003C\u002Fa>. We'll explain the important request pieces so you can move from a working command to an integration that can flatten PDF layers.\u003C\u002Fp>\n\n\u003Ch2>Why Flatten PDF Layers with cURL?\u003C\u002Fh2>\n\n\u003Cp>Layered PDFs can display different optional content depending on viewer controls or saved visibility settings. Flattening produces a consolidated PDF whose appearance no longer depends on whether a recipient understands or enables those layers.\u003C\u002Fp>\n\n\u003Cp>Engineering drawings provide a common example: a drawing may separate dimensions, notes, and production details into optional-content groups. A cURL workflow can flatten the approved view before it is sent to a vendor or print system.\u003C\u002Fp>\n\n\u003Cp>The endpoint incorporates the currently visible layer content into ordinary page content. It does not provide a later way to recover alternate layer views from the flattened result.\u003C\u002Fp>\n\n\u003Ch2>cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\ncurl -X POST \"$API_URL\u002Fflattened-layers-pdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\"\u003C\u002Fpre>\n\n\u003Cp>Source for Flatten PDF Layers: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fflattened-layers-pdf.sh\">View the cURL sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Choose the pdfRest service region\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>Layer flattening uses the hostname assigned to \u003Ccode>API_URL\u003C\u002Fcode>, with the global service enabled and the EU route shown beneath it. Keeping the operation regional ensures that its input and consolidated output stay addressable by later calls.\u003C\u002Fp>\n\n\u003Ch3>Build the authenticated multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"$API_URL\u002Fflattened-layers-pdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\u003C\u002Fpre>\n\n\u003Cp>The layered file is posted to \u003Ccode>\u002Fflattened-layers-pdf\u003C\u002Fcode> as one multipart upload. JSON response negotiation and API authentication remain explicit headers, making the shell request easy to inspect.\u003C\u002Fp>\n\n\u003Ch3>Upload the input file data\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\u003C\u002Fpre>\n\n\u003Cp>The Flatten PDF Layers request reads the local source from the path after \u003Ccode>@\u003C\u002Fcode> and sends its bytes in the multipart \u003Ccode>file\u003C\u002Fcode> field. For Flatten PDF Layers, cURL treats the path as an upload rather than ordinary form text.\u003C\u002Fp>\n\n\u003Ch3>Set the operation-specific fields\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\u003C\u002Fpre>\n\n\u003Cp>For this operation, \u003Ccode>output\u003C\u002Fcode> assigns a requested name to the consolidated PDF. Layer visibility comes from the source document state rather than from an additional list of layer names in the request.\u003C\u002Fp>\n\n\u003Ch3>Read the generated resource response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"$API_URL\u002Fflattened-layers-pdf\" \\\u003C\u002Fpre>\n\n\u003Cp>A successful layer-flattening response describes the newly generated PDF resource. Save its identifier or download information before sending the fixed rendering to a printer, vendor, or another document-processing step.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By completing this walkthrough, you can flatten PDF layers from a shell script and deliver a stable rendering to systems without optional-content controls.\u003C\u002Fp>\n\n\u003Cp>Confirm the intended visibility state before sending the request and compare the output with the approved view. Keep the layered source whenever future users may need alternate views or edits.\u003C\u002Fp>\n\n\u003Cp>Continue exploring the Flatten PDF Layers workflow in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the complete Flatten PDF Layers request contract, accepted values, defaults, and limitations, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-layers\u002F\">Flatten Layers API Tool documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: The Flatten PDF Layers example above uploads a file with multipart form data. For source content already stored in pdfRest, the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fflattened-layers-pdf.sh\">Flatten PDF Layers JSON payload example\u003C\u002Fa> shows the resource-ID request shape.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Learn how to flatten optional-content layers in a PDF with cURL and create one predictable visual result for delivery or printing.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-layers-with-curl\u002F#article\",\n      \"headline\": \"How to Flatten PDF Layers with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-layers-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-layers-with-curl\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to flatten optional-content layers in a PDF with cURL and create one predictable visual result for delivery or printing.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Flatten Layers API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-layers\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fflattened-layers-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-layers\"\n        }\n      ],\n      \"keywords\": \"Flatten Layers, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Flatten PDF Layers with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-layers-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9073,9074,9075,9076],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1899,"name":1900,"slug":1901,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-flatten-pdf-layers-with-curl\u002F","How to Flatten PDF Layers with cURL, Tutorial | pdfRest",{"id":9081,"uuid":9082,"title":9083,"slug":9084,"html":9085,"comment_id":9081,"feature_image":48,"featured":284,"visibility":1257,"created_at":8994,"updated_at":9052,"published_at":8852,"custom_excerpt":9086,"codeinjection_head":9087,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9088,"primary_tag":9093,"url":9094,"excerpt":9086,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9095,"meta_description":9086,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c5f533c9f26b943b57d","ad8ee11b-61d3-4b65-9ed5-d3f8f08a7d20","How to Flatten PDF Layers with Java","how-to-flatten-pdf-layers-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>In the following tutorial, you'll use Java and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-layers\u002F\">Flatten Layers API Tool\u003C\u002Fa> to flatten PDF layers. The example posts a layered document to \u003Ccode>\u002Fflattened-layers-pdf\u003C\u002Fcode> and captures the consolidated PDF output for consistent downstream viewing and printing. The example is designed to clarify both the API-specific fields and the surrounding HTTP request used to flatten PDF layers.\u003C\u002Fp>\n\n\u003Ch2>Why Flatten PDF Layers with Java?\u003C\u002Fh2>\n\n\u003Cp>Engineering drawings and design files may contain layers whose visibility differs by viewer or user setting. Flattening creates one predictable visual result for distribution or printing.\u003C\u002Fp>\n\n\u003Cp>The request posts the PDF to \u003Ccode>\u002Fflattened-layers-pdf\u003C\u002Fcode> and receives a new resource with optional content incorporated into ordinary page content.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class FlattenedLayersPDF {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"flattened\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fflattened-layers-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FFlattenedLayersPDF.java\">Java sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>This client brings together the HTTP client, environment-based API key loading, and JSON utilities used later in the example.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>The sample configuration shows where the input comes from and keeps the credential outside the request-building logic.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"flattened\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fflattened-layers-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The request posts the PDF to \u003Ccode>\u002Fflattened-layers-pdf\u003C\u002Fcode> and receives a new resource with optional content incorporated into ordinary page content. This request body packages fields and files together without hard-coding a \u003Ccode>Content-Type\u003C\u002Fcode> boundary.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fflattened-layers-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The HTTP request reads the credential through dotenv and targets the endpoint shown in the source, with the EU hostname documented beside the default US value.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>The example output logic checks the server result before treating the body as output and exposes diagnostic JSON when the operation cannot be completed.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>We have now covered the request and response flow for using Java to flatten PDF layers. With that foundation, this workflow is useful for drawings, maps, production artwork, and documents that must render consistently in systems without layer controls.\u003C\u002Fp>\n\n\u003Cp>Before relying on the result in an automated workflow, keep in mind that the flattened result should be checked against the intended layer visibility state, particularly for drawings, maps, and production artwork. Retain the layered source when future users may need alternate views or edits that the consolidated PDF can no longer provide.\u003C\u002Fp>\n\n\u003Cp>Continue testing representative documents with the Flatten PDF Layers operation in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. The \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-layers\u002F\">Flatten Layers API Tool documentation\u003C\u002Fa> provides authoritative defaults, accepted fields, and limitations for the Flatten PDF Layers operation.\u003C\u002Fp>\n\n\u003Cp>Note: The Flatten PDF Layers example above uses multipart form data; when the input is already stored in pdfRest, follow the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FFlattenedLayersPDF.java\">JSON payload example\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Flatten optional-content layers in a PDF with Java.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-layers-with-java\u002F#article\",\n      \"headline\": \"How to Flatten PDF Layers with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-layers-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-layers-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:39.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:39.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Flatten optional-content layers in a PDF with Java.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Flatten Layers API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-layers\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fflattened-layers-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-layers\"\n        }\n      ],\n      \"keywords\": \"Flatten Layers, Java\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Flatten PDF Layers with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-layers-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9089,9090,9091,9092],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1899,"name":1900,"slug":1901,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-flatten-pdf-layers-with-java\u002F","Flatten PDF Layers with Java | pdfRest",{"id":9097,"uuid":9098,"title":9099,"slug":9100,"html":9101,"comment_id":9097,"feature_image":48,"featured":284,"visibility":1257,"created_at":9102,"updated_at":7326,"published_at":7326,"custom_excerpt":9103,"codeinjection_head":9104,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9105,"primary_tag":9110,"url":9111,"excerpt":9103,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9112,"meta_description":9103,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a97640b533c9f26b943b7b1","fca5890a-1515-4dd8-85d2-bfe9ef4512ed","How to Flatten PDF Layers with JavaScript in NodeJS","how-to-flatten-pdf-layers-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Cp>Follow this JavaScript in NodeJS walkthrough to flatten PDF layers with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-layers\u002F\">Flatten Layers API Tool\u003C\u002Fa>. You'll see the complete Flatten PDF Layers sample first, then examine the transport code and API fields that matter when this JavaScript in NodeJS pattern moves into an application.\u003C\u002Fp>\n\n\u003Ch2>Why Flatten PDF Layers with JavaScript in NodeJS?\u003C\u002Fh2>\n\n\u003Cp>Optional-content groups allow one PDF to contain several visual configurations, but not every viewer or downstream system handles those controls consistently. Flatten Layers produces a consolidated PDF whose displayed content is fixed.\u003C\u002Fp>\n\n\u003Cp>Consider a NodeJS document service that prepares layered site maps for contractors. It can flatten the customer-approved combination of utilities, labels, and boundaries before the file enters a download queue, avoiding surprises in lightweight viewers.\u003C\u002Fp>\n\n\u003Cp>The endpoint uses the visibility state already present in the source; it does not accept a separate list of layers to turn on or off. Applications should establish and verify the intended view before they submit the document.\u003C\u002Fp>\n\n\u003Ch2>JavaScript in NodeJS Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F**\n * This request demonstrates how to flatten layers in a PDF.\n *\u002F\nvar axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\ndata.append(\"output\", \"pdfrest_flattened_layers_pdf\");\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: \"post\",\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: apiUrl + \"\u002Fflattened-layers-pdf\",\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", \u002F\u002F Replace with your API key\n    ...data.getHeaders(), \u002F\u002F set headers for the request\n  },\n  data: data, \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error);\n  });\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\u003C\u002Fpre>\n\n\u003Cp>Source for Flatten PDF Layers: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fflattened-layers-pdf.js\">View the JavaScript in NodeJS sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the NodeJS request and file modules\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\u003C\u002Fpre>\n\n\u003Cp>Axios sends the HTTP calls for Flatten PDF Layers, \u003Ccode>FormData\u003C\u002Fcode> constructs multipart bodies when needed, and Node's \u003Ccode>fs\u003C\u002Fcode> module opens local files as streams. Together, these packages provide the transport and file handling required by the JavaScript Flatten PDF Layers sample.\u003C\u002Fp>\n\n\u003Ch3>Select the pdfRest service region\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>apiUrl\u003C\u002Fcode> centralizes regional routing for Flatten PDF Layers. The NodeJS Flatten PDF Layers flow can switch to the documented EU hostname without changing the endpoint paths that follow.\u003C\u002Fp>\n\n\u003Ch3>Add the source and output fields\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\ndata.append(\"output\", \"pdfrest_flattened_layers_pdf\");\n\n\u002F\u002F define configuration options for axios request\nvar config = {\u003C\u002Fpre>\n\n\u003Cp>This block constructs the operation-specific input for Flatten PDF Layers. Its file parts carry binary content, while the named Flatten PDF Layers fields describe pdfRest behavior rather than syntax supplied by JavaScript in NodeJS.\u003C\u002Fp>\n\n\u003Ch3>Configure the Axios request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: \"post\",\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: apiUrl + \"\u002Fflattened-layers-pdf\",\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", \u002F\u002F Replace with your API key\n    ...data.getHeaders(), \u002F\u002F set headers for the request\n  },\n  data: data, \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n  .then(function (response) {\u003C\u002Fpre>\n\n\u003Cp>The JavaScript in NodeJS request joins the Flatten PDF Layers endpoint, authentication header, and prepared body. For this Flatten PDF Layers call, the multipart metadata generated by JavaScript in NodeJS must remain paired with the body so pdfRest can separate files from options.\u003C\u002Fp>\n\n\u003Ch3>Handle the generated PDF response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error);\n  });\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\u003C\u002Fpre>\n\n\u003Cp>The final Flatten PDF Layers handling in JavaScript in NodeJS exposes the HTTP result and JSON body. Before using a Flatten PDF Layers output or request ID, production JavaScript in NodeJS code should verify the status and retain the identifier required by the next step.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You now have a JavaScript in NodeJS pattern for turning the approved visible layer state into a stable PDF that no longer depends on optional-content controls.\u003C\u002Fp>\n\n\u003Cp>Retain the layered source beside the generated delivery copy when alternate views remain valuable. A preview comparison is especially useful for maps and design assets, where an omitted layer can carry operational meaning even when the request itself succeeds.\u003C\u002Fp>\n\n\u003Cp>Try the Flatten PDF Layers workflow with a representative file in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, then adapt the request in JavaScript in NodeJS. The \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-layers\u002F\">Flatten Layers API Tool documentation\u003C\u002Fa> provides the complete JavaScript in NodeJS context for Flatten PDF Layers values, defaults, and limitations.\u003C\u002Fp>\n\n\u003Cp>Note: This JavaScript in NodeJS Flatten PDF Layers tutorial uses a multipart file upload. For Flatten PDF Layers content already stored in pdfRest, the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fflattened-layers-pdf.js\">JavaScript in NodeJS JSON payload example\u003C\u002Fa> supplies a managed resource ID instead of uploading the file again.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T23:47:23.000+00:00","Use JavaScript in NodeJS to flatten PDF layers and deliver a stable page appearance without optional-content controls.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-layers-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Flatten PDF Layers with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-layers-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-layers-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Use JavaScript in NodeJS to flatten PDF layers and deliver a stable page appearance without optional-content controls.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Flatten Layers API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-layers\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fflattened-layers-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-layers\"\n        }\n      ],\n      \"keywords\": \"Flatten Layers, JavaScript\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Flatten PDF Layers with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-layers-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9106,9107,9108,9109],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1899,"name":1900,"slug":1901,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-flatten-pdf-layers-with-javascript-in-nodejs\u002F","Flatten PDF Layers with JavaScript in NodeJS | pdfRest",{"id":9114,"uuid":9115,"title":9116,"slug":9117,"html":9118,"comment_id":9114,"feature_image":48,"featured":284,"visibility":1257,"created_at":9102,"updated_at":7326,"published_at":7326,"custom_excerpt":9119,"codeinjection_head":9120,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9121,"primary_tag":9126,"url":9127,"excerpt":9119,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9128,"meta_description":9119,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a97640b533c9f26b943b7a8","4c2bc987-e5fa-4890-af45-2efab62f0d6b","How to Flatten PDF Layers with PHP","how-to-flatten-pdf-layers-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Cp>In this tutorial, we'll use PHP and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-layers\u002F\">Flatten Layers API Tool\u003C\u002Fa> to flatten PDF layers. The complete Flatten PDF Layers repository sample stays visible while we explain the request fields and response behavior a PHP application must adapt safely.\u003C\u002Fp>\n\n\u003Ch2>Why Flatten PDF Layers with PHP?\u003C\u002Fh2>\n\n\u003Cp>Layered PDFs can show different optional content depending on viewer controls and saved visibility settings. Flattening incorporates the visible layer content into an ordinary PDF presentation that no longer depends on those controls.\u003C\u002Fp>\n\n\u003Cp>A PHP-based production portal might receive engineering drawings with dimensions, revision notes, and manufacturing details stored in separate layers. Before sending the approved view to a supplier, the portal can flatten it so the same details appear in browser previews and print output.\u003C\u002Fp>\n\n\u003Cp>The operation creates a new PDF rather than altering the uploaded source. Because alternate layer views cannot be recovered from the flattened result, keep the layered original whenever later editing or another visibility state may be required.\u003C\u002Fp>\n\n\u003Ch2>PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile', \u002F\u002F Set the filename for the file to be processed, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => '\u003CContent-type header>' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'output', \u002F\u002F Specify the field name for the output option.\n      'contents' => 'pdfrest_flattened_pdf' \u002F\u002F Set the value for the output option (in this case, 'pdfrest_flattened_pdf').\n    ]\n  ]\n];\n\n$request = new Request('POST', $apiUrl.'\u002Fflattened-layers-pdf', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the flattened layers PDF content.\u003C\u002Fpre>\n\n\u003Cp>Source for Flatten PDF Layers: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fflattened-layers-pdf.php\">View the PHP sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load Guzzle and its stream helpers\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\u003C\u002Fpre>\n\n\u003Cp>Guzzle supplies the HTTP client and PSR-7 request objects used throughout the Flatten PDF Layers example. For this PHP Flatten PDF Layers flow, \u003Ccode>Utils::tryFopen\u003C\u002Fcode> creates readable multipart streams without loading every uploaded byte into one string.\u003C\u002Fp>\n\n\u003Ch3>Select the pdfRest service region\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\u003C\u002Fpre>\n\n\u003Cp>The active \u003Ccode>$apiUrl\u003C\u002Fcode> selects the US service for Flatten PDF Layers; the commented assignment shows the EU alternative. Keep the PHP uploads, request IDs, and generated resources for Flatten PDF Layers on that same regional host.\u003C\u002Fp>\n\n\u003Ch3>Build the flattening multipart body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile', \u002F\u002F Set the filename for the file to be processed, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => '\u003CContent-type header>' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'output', \u002F\u002F Specify the field name for the output option.\n      'contents' => 'pdfrest_flattened_pdf' \u002F\u002F Set the value for the output option (in this case, 'pdfrest_flattened_pdf').\n    ]\n  ]\n];\n\n$request = new Request('POST', $apiUrl.'\u002Fflattened-layers-pdf', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the flattened layers PDF content.\u003C\u002Fpre>\n\n\u003Cp>This block constructs the operation-specific input for Flatten PDF Layers. Its file parts carry binary content, while the named Flatten PDF Layers fields describe pdfRest behavior rather than syntax supplied by PHP.\u003C\u002Fp>\n\n\u003Ch3>Send the flatten-layers request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">$request = new Request('POST', $apiUrl.'\u002Fflattened-layers-pdf', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the flattened layers PDF content.\u003C\u002Fpre>\n\n\u003Cp>The PHP request joins the Flatten PDF Layers endpoint, authentication header, and prepared body. For this Flatten PDF Layers call, the multipart metadata generated by PHP must remain paired with the body so pdfRest can separate files from options.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You now have a PHP pattern for turning the approved visible layer state into a stable PDF that no longer depends on optional-content controls.\u003C\u002Fp>\n\n\u003Cp>Compare the generated PDF with the approved layer state before distribution. Drawings, maps, and production artwork deserve a visual check because flattening faithfully fixes the current appearance, including any layer that was unintentionally visible or hidden.\u003C\u002Fp>\n\n\u003Cp>Try the Flatten PDF Layers workflow with a representative file in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, then adapt the request in PHP. The \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-layers\u002F\">Flatten Layers API Tool documentation\u003C\u002Fa> provides the complete PHP context for Flatten PDF Layers values, defaults, and limitations.\u003C\u002Fp>\n\n\u003Cp>Note: This PHP Flatten PDF Layers tutorial uses a multipart file upload. For Flatten PDF Layers content already stored in pdfRest, the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fflattened-layers-pdf.php\">PHP JSON payload example\u003C\u002Fa> supplies a managed resource ID instead of uploading the file again.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Flatten optional-content layers in PDF files with PHP so recipients and print systems receive one consistent rendering.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-layers-with-php\u002F#article\",\n      \"headline\": \"How to Flatten PDF Layers with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-layers-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-layers-with-php\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Flatten optional-content layers in PDF files with PHP so recipients and print systems receive one consistent rendering.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Flatten Layers API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-layers\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fflattened-layers-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-layers\"\n        }\n      ],\n      \"keywords\": \"Flatten Layers, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Flatten PDF Layers with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-layers-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9122,9123,9124,9125],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1899,"name":1900,"slug":1901,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-flatten-pdf-layers-with-php\u002F","Flatten PDF Layers with PHP | pdfRest",{"id":9130,"uuid":9131,"title":9132,"slug":9133,"html":9134,"comment_id":9130,"feature_image":48,"featured":284,"visibility":1257,"created_at":9135,"updated_at":9136,"published_at":9135,"custom_excerpt":9137,"codeinjection_head":9138,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9139,"primary_tag":9146,"url":9147,"excerpt":9137,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9148,"meta_description":9137,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"66107054533c9f26b9436fb0","d45512d3-2e27-4286-8725-4b6a1cd21b13","How to Flatten PDF Transparencies in .NET with C#","how-to-flatten-pdf-transparencies-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Flatten Transparencies with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-transparencies\u002F'>Flatten Transparencies API Tool\u003C\u002Fa> is a powerful resource for developers who need to process PDF files and ensure compatibility across various PDF viewers. This API tool allows you to flatten transparencies in a PDF, which can be crucial for printing purposes or when you need to finalize a document's visual elements. This tutorial will guide you through the process of sending an API call to Flatten Transparencies using C#.\u003C\u002Fp>\n\n\u003Cp>Consider a scenario where a graphic designer has created a PDF with multiple layers and transparency effects. While the document looks great on screen, these effects can cause issues when printing, as not all printers can accurately reproduce them. By flattening the transparencies, the designer can convert these effects into a single layer, ensuring that the printed document closely matches what is seen on screen. This process is essential for professional printing and archiving purposes.\u003C\u002Fp>\n\n\u003Ch2>Flatten Transparencies with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"flattened-transparencies-pdf\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source of the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fflattened-transparencies-pdf.cs\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The above code snippet demonstrates how to make a multipart\u002Fform-data POST request to the pdfRest Flatten Transparencies API endpoint using C#. Let's break down the key components of this code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") };\n\u003C\u002Fpre>\n\n\u003Cp>This line initializes a new instance of the HttpClient class and sets the base address to the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var request = new HttpRequestMessage(HttpMethod.Post, \"flattened-transparencies-pdf\");\n\u003C\u002Fpre>\n\n\u003Cp>Here we create a new HttpRequestMessage for a POST request to the 'flattened-transparencies-pdf' endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>The API key is added to the request headers for authentication. Replace 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' with your actual pdfRest API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n\u003C\u002Fpre>\n\n\u003Cp>These lines read the PDF file as a byte array, create a ByteArrayContent object with it, and add it to the multipart\u002Fform-data content. Replace '\u002Fpath\u002Fto\u002Ffile.pdf' with the actual file path and 'file_name.pdf' with the desired name for the file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\u003C\u002Fpre>\n\n\u003Cp>This sets the content type of the file part to 'application\u002Fpdf', indicating that the file is a PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\n\u003C\u002Fpre>\n\n\u003Cp>This line sends the request to the pdfRest API and awaits the response.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>Finally, we read the response content as a string, which contains the API's result.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps in this tutorial, you have learned how to use C# to call the pdfRest Flatten Transparencies API to process a PDF file. This can be a valuable tool in your programming toolkit, especially when dealing with documents that require a consistent visual output across different platforms.\u003C\u002Fp>\n\n\u003Cp>To explore more capabilities and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on the API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fflattened-transparencies-pdf.cs\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-04-05T21:42:44.000+00:00","2026-09-02T18:28:55.000+00:00","Learn how to use the Flatten Transparencies API Tool by pdfRest to flatten all transparencies in PDF files with C#","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Flatten PDF Transparencies in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-04-05T21:42:44.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:34.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use the Flatten Transparencies API Tool by pdfRest to flatten all transparencies in PDF files with C#\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Flatten Transparencies API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-transparencies\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fflattened-transparencies-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-transparencies\"\n        }\n      ],\n      \"keywords\": \".NET, Flatten Transparencies, Prepress, Print\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Flatten PDF Transparencies in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9140,9141,9142,9143,9144,9145],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2173,"name":2174,"slug":2175,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2137,"name":2138,"slug":2139,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2153,"name":2154,"slug":2155,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-flatten-pdf-transparencies-in-net-with-c\u002F","How to Flatten PDF Transparencies in .NET with C#, Tutorial | pdfRest",{"id":9150,"uuid":9151,"title":9152,"slug":9153,"html":9154,"comment_id":9150,"feature_image":48,"featured":284,"visibility":1257,"created_at":9155,"updated_at":9136,"published_at":9155,"custom_excerpt":9156,"codeinjection_head":9157,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9158,"primary_tag":9165,"url":9166,"excerpt":9156,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9167,"meta_description":9156,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"661072f0533c9f26b9436fd0","db30be00-daf9-4943-a728-c72b4537a258","How to Flatten PDF Transparencies with cURL","how-to-flatten-pdf-transparencies-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Flatten Transparencies with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-transparencies\u002F'>Flatten Transparencies API Tool\u003C\u002Fa> is a powerful feature that allows users to process PDF files by flattening transparent elements within the document. This can be particularly useful when preparing a PDF for printing or ensuring compatibility across different viewing platforms. This tutorial will show how to send an API call to Flatten Transparencies using the command-line tool cURL, which is widely used for transferring data with URLs.\u003C\u002Fp>\n\n\u003Cp>Imagine you have a PDF with complex vector graphics and transparency effects that look great on-screen but cause issues when printed on certain printers. By flattening the transparencies, you can convert these effects into a format that is more printer-friendly, ensuring that the printed document closely matches what is seen on a display. This is just one scenario where flattening transparencies can be crucial for maintaining the quality and consistency of your PDF documents.\u003C\u002Fp>\n\n\u003Ch2>Flatten Transparencies with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fflattened-transparencies-pdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>Reference to the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fflattened-transparencies-pdf.sh\">pdfRest API cURL Samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The cURL command provided is used to make a POST request to the pdfRest API endpoint for flattening transparencies in a PDF file. Let's break down each part of the command:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-X POST\n\u003C\u002Fpre>\n\n\u003Cp>This specifies the HTTP method for the request, which is POST in this case, indicating that data will be sent to the server.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">\"https:\u002F\u002Fapi.pdfrest.com\u002Fflattened-transparencies-pdf\"\n\u003C\u002Fpre>\n\n\u003Cp>This is the URL of the API endpoint that will process the request to flatten transparencies.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\n\u003C\u002Fpre>\n\n\u003Cp>This header tells the server that the client expects a response in JSON format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\n\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the data being sent in the request is in multipart form-data format, which is used for uploading files.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>This header is used to authenticate the request with your unique API key provided by pdfRest.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\n\u003C\u002Fpre>\n\n\u003Cp>This form field is used to attach the file that needs to be processed. The '@' symbol indicates that a file is being uploaded, followed by the path to the file on your local system.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>This form field specifies the name of the output file that will be created after the transparencies have been flattened.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps outlined above, you have learned how to use cURL to make an API call to pdfRest's Flatten Transparencies endpoint. This process is essential for preparing PDFs for various use cases where transparency could cause issues, such as printing or viewing on different devices.\u003C\u002Fp>\n\n\u003Cp>Feel free to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fflattened-transparencies-pdf.sh\">pdfRest API JSON Payload Samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-04-05T21:53:52.000+00:00","Learn how to flatten all PDF transparencies with the pdfRest Flatten Transparencies API Tool using cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-curl\u002F#article\",\n      \"headline\": \"How to Flatten PDF Transparencies with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-curl\u002F\",\n      \"datePublished\": \"2024-04-05T21:53:52.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:34.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to flatten all PDF transparencies with the pdfRest Flatten Transparencies API Tool using cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Flatten Transparencies API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-transparencies\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fflattened-transparencies-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-transparencies\"\n        }\n      ],\n      \"keywords\": \"Flatten Transparencies, Prepress, Print, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Flatten PDF Transparencies with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9159,9160,9161,9162,9163,9164],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2173,"name":2174,"slug":2175,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2137,"name":2138,"slug":2139,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2153,"name":2154,"slug":2155,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-flatten-pdf-transparencies-with-curl\u002F","How to Flatten PDF Transparencies with cURL, Tutorial | pdfRest",{"id":9169,"uuid":9170,"title":9171,"slug":9172,"html":9173,"comment_id":9169,"feature_image":48,"featured":284,"visibility":1257,"created_at":9174,"updated_at":9136,"published_at":9174,"custom_excerpt":9175,"codeinjection_head":9176,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9177,"primary_tag":9183,"url":9184,"excerpt":9175,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9185,"meta_description":9175,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"672bd66f533c9f26b9438c71","e0eff9a5-8a0d-4e18-b518-bbb2e85d6ec1","How to Flatten PDF Transparencies with Java","how-to-flatten-pdf-transparencies-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Flatten PDF Transparencies with Java?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-transparencies\u002F'>Flatten Transparencies API Tool\u003C\u002Fa> provides a way to process PDF documents by flattening transparencies, which can be crucial for ensuring consistent visual output across different platforms and devices. This tutorial will guide you through the process of sending an API call to the Flatten Transparencies endpoint using Java, making it easier to integrate this functionality into your Java applications.\u003C\u002Fp>\n\n\u003Cp>Flattening transparencies is often necessary when preparing documents for printing or when ensuring compatibility with older PDF viewers that may not handle transparency effects correctly. By flattening these transparencies, you can prevent unexpected visual discrepancies and maintain the intended look of your document.\u003C\u002Fp>\n\n\u003Ch2>Flatten PDF Transparencies with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class FlattenedTransparenciesPDF {\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"flattened\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fflattened-transparencies-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FFlattenedTransparenciesPDF.java\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by setting a default file path and API key. The file path is specified as \u003Ccode>DEFAULT_FILE_PATH\u003C\u002Fcode>, and the API key is \u003Ccode>DEFAULT_API_KEY\u003C\u002Fcode>. These can be overridden by command-line arguments or environment variables, respectively.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">File inputFile;\nif (args.length > 0) {\n  inputFile = new File(args[0]);\n} else {\n  inputFile = new File(DEFAULT_FILE_PATH);\n}\n\u003C\u002Fpre>\n\n\u003Cp>This snippet checks if a file path has been provided as a command-line argument. If not, it uses the default file path.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>dotenv\u003C\u002Fcode> library is used to load environment variables from a \u003Ccode>.env\u003C\u002Fcode> file, allowing for secure management of sensitive information like API keys.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">RequestBody requestBody =\n    new MultipartBody.Builder()\n        .setType(MultipartBody.FORM)\n        .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n        .addFormDataPart(\"output\", \"flattened\")\n        .build();\n\u003C\u002Fpre>\n\n\u003Cp>A multipart form request body is constructed, which includes the PDF file and specifies that the output should be \"flattened\". This is crucial for the API to understand what operation to perform.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Request request =\n    new Request.Builder()\n        .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n        .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fflattened-transparencies-pdf\")\n        .post(requestBody)\n        .build();\n\u003C\u002Fpre>\n\n\u003Cp>The request is built with the API key in the header and the URL pointing to the Flatten Transparencies endpoint. The request body is attached as a POST request.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to send an API call to the pdfRest Flatten Transparencies endpoint using Java. This example demonstrated how to handle file uploads and manage API keys securely.\u003C\u002Fp>\n\n\u003Cp>To explore more, try out all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FFlattenedTransparenciesPDF.java\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-06T20:49:51.000+00:00","Learn how to flatten all transparent content in PDF files using the pdfRest Flatten Transparencies API Tool with Java","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-java\u002F#article\",\n      \"headline\": \"How to Flatten PDF Transparencies with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-java\u002F\",\n      \"datePublished\": \"2024-11-06T20:49:51.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:21.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to flatten all transparent content in PDF files using the pdfRest Flatten Transparencies API Tool with Java\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Flatten Transparencies API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-transparencies\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fflattened-transparencies-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-transparencies\"\n        }\n      ],\n      \"keywords\": \"Flatten Transparencies, Java, Print\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Flatten PDF Transparencies with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9178,9179,9180,9181,9182],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2173,"name":2174,"slug":2175,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2137,"name":2138,"slug":2139,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-flatten-pdf-transparencies-with-java\u002F","How to Flatten PDF Transparencies with Java, Tutorial | pdfRest",{"id":9187,"uuid":9188,"title":9189,"slug":9190,"html":9191,"comment_id":9187,"feature_image":48,"featured":284,"visibility":1257,"created_at":9192,"updated_at":9193,"published_at":9192,"custom_excerpt":9194,"codeinjection_head":9195,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9196,"primary_tag":9203,"url":9204,"excerpt":9194,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9205,"meta_description":9194,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"661070aa533c9f26b9436fba","47e02dc9-4221-4b9f-94e3-4daf9dfcbef5","How to Flatten PDF Transparencies with JavaScript in NodeJS","how-to-flatten-pdf-transparencies-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Flatten Transparencies with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-transparencies\u002F'>Flatten Transparencies API Tool\u003C\u002Fa> is a powerful resource for developers who need to process PDFs to ensure compatibility and reduce file complexity. This tool is particularly useful when you want to make sure that PDFs with transparent elements are rendered consistently across different viewers and printers. This tutorial will show how to send an API call to Flatten Transparencies with JavaScript, which is a common language for web development and automation tasks.\u003C\u002Fp>\n\n\u003Cp>A developer might integrate Flatten Transparencies when preparing documents for printing or publication. For instance, a graphic design studio might need to ensure that PDFs containing complex vector graphics with transparency effects are printed correctly, without any rendering issues. By flattening transparencies, the PDFs will be simplified, which can prevent printing errors and make the files more universally readable.\u003C\u002Fp>\n\n\u003Ch2>Flatten Transparencies with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to flatten transparencies in a PDF.\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('quality', 'medium');\ndata.append('output', 'pdfrest_flattened_transparencies_pdf');\n\n\u002F\u002F Define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fflattened-transparencies-pdf', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source of the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fflattened-transparencies-pdf.js\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code example above demonstrates how to use the pdfRest Flatten Transparencies API Tool using JavaScript. The following sections break down the key parts of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\u003C\u002Fpre>\n\n\u003Cp>This snippet includes the required modules. \u003Ccode>axios\u003C\u002Fcode> is used for making HTTP requests, \u003Ccode>FormData\u003C\u002Fcode> is for creating multipart\u002Fform-data payloads, and \u003Ccode>fs\u003C\u002Fcode> is for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('quality', 'medium');\ndata.append('output', 'pdfrest_flattened_transparencies_pdf');\n\u003C\u002Fpre>\n\n\u003Cp>Here, a new \u003Ccode>FormData\u003C\u002Fcode> instance is created, and the PDF file along with parameters are appended to it. The \u003Ccode>'file'\u003C\u002Fcode> is the PDF to be processed, \u003Ccode>'quality'\u003C\u002Fcode> specifies the desired quality of the output, and \u003Ccode>'output'\u003C\u002Fcode> is the name of the resulting file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fflattened-transparencies-pdf', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\n\u003C\u002Fpre>\n\n\u003Cp>This configures the \u003Ccode>axios\u003C\u002Fcode> request with the API endpoint, headers including the API key, and the data payload.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\u003C\u002Fpre>\n\n\u003Cp>The request is sent using \u003Ccode>axios\u003C\u002Fcode>, and the response is handled in the promise's \u003Ccode>then\u003C\u002Fcode> and \u003Ccode>catch\u003C\u002Fcode> blocks.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial covered how to flatten transparencies in a PDF using JavaScript and the pdfRest API. By following the steps outlined, you can now automate the process of preparing PDFs for printing or digital distribution, ensuring compatibility and reducing file complexity.\u003C\u002Fp>\n\n\u003Cp>To explore more capabilities and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further information and detailed documentation, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fflattened-transparencies-pdf.js\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-04-05T21:44:10.000+00:00","2026-09-02T18:28:56.000+00:00","Learn how to flatten all transparencies in PDF files with the pdfRest Flatten Transparencies API Tool using JavaScript","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Flatten PDF Transparencies with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-04-05T21:44:10.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:34.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to flatten all transparencies in PDF files with the pdfRest Flatten Transparencies API Tool using JavaScript\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Flatten Transparencies API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-transparencies\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fflattened-transparencies-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-transparencies\"\n        }\n      ],\n      \"keywords\": \"Flatten Transparencies, JavaScript, Prepress, Print\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Flatten PDF Transparencies with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9197,9198,9199,9200,9201,9202],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2173,"name":2174,"slug":2175,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2137,"name":2138,"slug":2139,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2153,"name":2154,"slug":2155,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-flatten-pdf-transparencies-with-javascript-in-nodejs\u002F","How to Flatten PDF Transparencies with JavaScript in NodeJS, Tutorial | pdfRest",{"id":9207,"uuid":9208,"title":9209,"slug":9210,"html":9211,"comment_id":9207,"feature_image":48,"featured":284,"visibility":1257,"created_at":9212,"updated_at":9193,"published_at":9212,"custom_excerpt":9213,"codeinjection_head":9214,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9215,"primary_tag":9222,"url":9223,"excerpt":9213,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9224,"meta_description":9213,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6610738b533c9f26b9436fe4","4b856174-c244-450f-af90-8565b6675029","How to Flatten PDF Transparencies with PHP","how-to-flatten-pdf-transparencies-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Flatten Transparencies with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-transparencies\u002F'>Flatten Transparencies API Tool\u003C\u002Fa> is a powerful resource for developers who need to process PDFs to ensure compatibility across various viewers and printers. This tool allows you to flatten transparencies within a PDF, which can be crucial for eliminating rendering issues and ensuring that the document appears the same across different platforms. This tutorial will guide you through the process of making an API call to the Flatten Transparencies endpoint using PHP.\u003C\u002Fp>\n\n\u003Cp>Consider a scenario where you're a print shop owner and receive a PDF with complex graphics for printing. These graphics might contain transparencies that can cause issues with certain printing equipment or result in unexpected visual artifacts. By using the Flatten Transparencies API, you can programmatically prepare the PDF for printing by flattening these transparencies, ensuring that the printed output matches the intended design.\u003C\u002Fp>\n\n\u003Ch2>Flatten Transparencies with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre>\nrequire 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' =--> 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'quality',\n      'contents' => 'medium'\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_flattened_transparencies_pdf'\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fflattened-transparencies-pdf', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source of the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fflattened-transparencies-pdf.php\">GitHub - datalogics\u002Fpdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided code snippet shows how to use the Guzzle HTTP client in PHP to make a multipart\u002Fform-data POST request to the pdfRest Flatten Transparencies API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>This section sets up the headers for the HTTP request, including the 'Api-Key' which is required for authentication with the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'quality',\n      'contents' => 'medium'\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_flattened_transparencies_pdf'\n    ]\n  ]\n];\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>$options\u003C\u002Fcode> array contains the 'multipart' key, which defines the different parts of the multipart request. Each part is an associative array with keys like 'name', 'contents', 'filename', and 'headers' that specify the details of the file to be uploaded, the quality setting, and the output filename.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fflattened-transparencies-pdf', $headers);\n\u003C\u002Fpre>\n\n\u003Cp>This line creates a new HTTP POST request object with the API endpoint URL and the headers array.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$res = $client->sendAsync($request, $options)->wait();\n\u003C\u002Fpre>\n\n\u003Cp>The Guzzle HTTP client sends the asynchronous request with the provided options and waits for the response.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">echo $res->getBody();\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the response body is printed out. This body will contain the content of the flattened transparencies PDF.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps outlined above, you have learned how to make an API call to the pdfRest Flatten Transparencies API using PHP. This allows you to programmatically process PDFs to flatten transparencies, which is especially useful for ensuring consistent printing and viewing experiences.\u003C\u002Fp>\n\n\u003Cp>To further explore the capabilities of the pdfRest API, consider trying out all of the API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For a deeper understanding of the API's functionality and additional endpoints, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fflattened-transparencies-pdf.php\">GitHub - datalogics\u002Fpdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-04-05T21:56:27.000+00:00","Learn how to flatten PDF transparencies with the Flatten Transparencies API Tool by pdfRest using PHP","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-php\u002F#article\",\n      \"headline\": \"How to Flatten PDF Transparencies with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-php\u002F\",\n      \"datePublished\": \"2024-04-05T21:56:27.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:33.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to flatten PDF transparencies with the Flatten Transparencies API Tool by pdfRest using PHP\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Flatten Transparencies API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-transparencies\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fflattened-transparencies-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-transparencies\"\n        }\n      ],\n      \"keywords\": \"Flatten Transparencies, PHP, Prepress, Print\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Flatten PDF Transparencies with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9216,9217,9218,9219,9220,9221],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2173,"name":2174,"slug":2175,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2137,"name":2138,"slug":2139,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2153,"name":2154,"slug":2155,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-flatten-pdf-transparencies-with-php\u002F","How to Flatten PDF Transparencies with PHP, Tutorial | pdfRest",{"id":9226,"uuid":9227,"title":9228,"slug":9229,"html":9230,"comment_id":9226,"feature_image":48,"featured":284,"visibility":1257,"created_at":9231,"updated_at":9232,"published_at":9231,"custom_excerpt":9233,"codeinjection_head":9234,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9235,"primary_tag":9242,"url":9243,"excerpt":9233,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9244,"meta_description":9233,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6610732b533c9f26b9436fda","ceef9dda-2db4-4137-97e0-faada64c7b53","How to Flatten PDF Transparencies with Python","how-to-flatten-pdf-transparencies-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Flatten Transparencies with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-transparencies\u002F'>Flatten Transparencies API Tool\u003C\u002Fa> is a powerful resource for developers looking to process PDF files by flattening transparencies within them. This tool can be particularly useful when preparing PDFs for printing or ensuring compatibility across various PDF viewers that may not handle transparencies correctly. This tutorial will show how to send an API call to Flatten Transparencies using Python, which is a popular programming language for scripting and automating tasks.\u003C\u002Fp>\n\n\u003Cp>In the real world, a user might need to flatten transparencies when they are sending a document to a print shop that requires all elements in a PDF to be in a print-ready format. Flattening transparencies can reduce printing errors and ensure that the document appears the same in print as it does on screen. For example, a graphic designer might use this tool to prepare a complex brochure or a poster for professional printing, ensuring that all transparent effects are rendered correctly.\u003C\u002Fp>\n\n\u003Ch2>Flatten Transparencies with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nflatten_transparencies_pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fflattened-transparencies-pdf'\n\n# The \u002Fflattened-transparencies-pdf endpoint can take a single PDF file or id as input.\n# This sample demonstrates setting quality to 'medium'.\n# We have preset 'high', 'medium', and 'low' quality levels available for use. These preset levels do not require the 'profile' parameter.\nmp_encoder_flattenTransparenciesPdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_flattenedPdf_out',\n        'quality': 'medium',\n    }\n)\n\n# Let's set the headers that the flattened-transparencies-pdf endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_flattenTransparenciesPdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to flattened-transparencies-pdf endpoint...\")\nresponse = requests.post(flatten_transparencies_pdf_endpoint_url, data=mp_encoder_flattenTransparenciesPdf, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>This code is sourced from the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fflattened-transparencies-pdf.py\">pdf-rest-api-samples\u003C\u002Fa> on GitHub.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided Python code demonstrates how to use the pdfRest Flatten Transparencies API tool by making a POST request to the endpoint \u003Ccode>https:\u002F\u002Fapi.pdfrest.com\u002Fflattened-transparencies-pdf\u003C\u002Fcode>. Let's break down the key parts of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">flatten_transparencies_pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fflattened-transparencies-pdf'\n\u003C\u002Fpre>\n\n\u003Cp>This line sets the endpoint URL for the API call.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_flattenTransparenciesPdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_flattenedPdf_out',\n        'quality': 'medium',\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>This block creates a \u003Ccode>MultipartEncoder\u003C\u002Fcode> object with the fields needed for the request:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Ccode>'file'\u003C\u002Fcode>: The PDF file to be processed. Replace \u003Ccode>'\u002Fpath\u002Fto\u002Ffile'\u003C\u002Fcode> with the actual file path.\u003C\u002Fli>\n\u003Cli>\u003Ccode>'output'\u003C\u002Fcode>: The desired name for the output file.\u003C\u002Fli>\n\u003Cli>\u003Ccode>'quality'\u003C\u002Fcode>: The quality setting for the flattening process. Options are 'high', 'medium', and 'low'.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_flattenTransparenciesPdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\u003C\u002Fpre>\n\n\u003Cp>Here, the headers for the request are set. The 'Api-Key' should be replaced with your actual API key from pdfRest.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(flatten_transparencies_pdf_endpoint_url, data=mp_encoder_flattenTransparenciesPdf, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This line sends the POST request to the API endpoint with the provided data and headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>After the request is sent, this code checks if it was successful and prints the JSON response or error text accordingly.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you've learned how to call the pdfRest Flatten Transparencies API tool using Python. This can be a valuable skill for automating the process of preparing PDFs for various purposes, such as printing or ensuring compatibility. You can now experiment with different quality settings and see how they affect your PDFs.\u003C\u002Fp>\n\n\u003Cp>To further explore the capabilities of pdfRest, consider demoing all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information on the API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found in our \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fflattened-transparencies-pdf.py\">GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-04-05T21:54:51.000+00:00","2026-09-02T18:28:57.000+00:00","Learn how to use the pdfRest Flatten Transparencies API Tool with Python to flatten all PDF transparencies","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-python\u002F#article\",\n      \"headline\": \"How to Flatten PDF Transparencies with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-python\u002F\",\n      \"datePublished\": \"2024-04-05T21:54:51.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:34.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use the pdfRest Flatten Transparencies API Tool with Python to flatten all PDF transparencies\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Flatten Transparencies API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fflatten-transparencies\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fflattened-transparencies-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fflatten-transparencies\"\n        }\n      ],\n      \"keywords\": \"Flatten Transparencies, Prepress, Print, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Flatten PDF Transparencies with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-flatten-pdf-transparencies-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9236,9237,9238,9239,9240,9241],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2173,"name":2174,"slug":2175,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2137,"name":2138,"slug":2139,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2153,"name":2154,"slug":2155,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-flatten-pdf-transparencies-with-python\u002F","How to Flatten PDF Transparencies with Python, Tutorial | pdfRest",{"id":9246,"uuid":9247,"title":9248,"slug":9249,"html":9250,"comment_id":9246,"feature_image":48,"featured":284,"visibility":1257,"created_at":9251,"updated_at":9232,"published_at":9251,"custom_excerpt":9252,"codeinjection_head":9253,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9254,"primary_tag":9259,"url":9260,"excerpt":9252,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9261,"meta_description":9252,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65f7b4f5533c9f26b9436ad4","24d50ec6-8207-4161-9723-2fb1c525366d","How to Import Data to PDF Forms in .NET with C#","how-to-import-data-to-pdf-forms-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Import Form Data with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fimport-form-data\u002F'>Import Form Data API Tool\u003C\u002Fa> is designed to streamline the process of importing data into PDF forms. It allows users to programmatically fill out PDF forms with data from various sources, such as databases or user input.\u003C\u002Fp>\n  \n\u003Cp>This tutorial will guide you through the steps of sending an API call to Import Form Data using C#.\u003C\u002Fp>\n\n\u003Cp>Consider a scenario where a company needs to generate hundreds of personalized contracts. Manually entering data into each form is time-consuming and prone to errors. By using the Import Form Data API, the company can automate the process, ensuring that each PDF form is accurately filled out with the correct data from their database, saving time and reducing the potential for mistakes.\u003C\u002Fp>\n\n\u003Ch2>Import Form Data with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf-with-imported-form-data\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArray2 = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Fdatafile.xml\");\n        var byteAryContent2 = new ByteArrayContent(byteArray2);\n        multipartContent.Add(byteAryContent2, \"data_file\", \"datafile_name.xml\");\n        byteAryContent2.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fxml\");\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source of the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-imported-form-data.cs\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This code snippet demonstrates how to use C# to make a multipart\u002Fform-data POST request to the pdfRest API endpoint for importing form data into a PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>This line initializes a new instance of the HttpClient class and sets the base address for the API calls to the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>The Api-Key header is added to the request. This key is required for authentication and should be replaced with your actual pdfRest API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n\u003C\u002Fpre>\n\n\u003Cp>A new instance of MultipartFormDataContent is created, which will hold the form data to be sent in the request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\u003C\u002Fpre>\n\n\u003Cp>This snippet reads the PDF file as a byte array, wraps it in a ByteArrayContent object, and adds it to the multipart content with the name \"file\". Replace \"\u002Fpath\u002Fto\u002Ffile.pdf\" with the actual file path and \"file_name.pdf\" with the actual file name. The \"Content-Type\" header is used to indicate this is a PDF file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray2 = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Fdatafile.xml\");\nvar byteAryContent2 = new ByteArrayContent(byteArray2);\nmultipartContent.Add(byteAryContent2, \"data_file\", \"datafile_name.xml\");\nbyteAryContent2.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fxml\");\n\u003C\u002Fpre>\n\n\u003Cp>Similarly, this snippet reads the data file (typically XML or FDF containing form data; in this case XML) and adds it to the multipart content with the name \"data_filename.xml\". The \"Content-Type\" header is used to indicate this is an XML file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\n\u003C\u002Fpre>\n\n\u003Cp>The request is sent asynchronously, and the response is captured in the response variable.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>The response content is read as a string, which contains the result of the API call.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps in this tutorial, you have learned how to use C# to make a multipart API call to the pdfRest Import Form Data endpoint. This enables you to programmatically import data into PDF forms, which can be a powerful tool for automating document workflows.\u003C\u002Fp>\n\n\u003Cp>To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information about the API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-imported-form-data.cs\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-18T03:28:53.000+00:00","Learn how to use pdfRest Import Form Data API Tool with .NET to import data into PDF forms.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Import Data to PDF Forms in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-03-18T03:28:53.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:38.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Import Form Data API Tool with .NET to import data into PDF forms.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Import Form Data API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fimport-form-data\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-imported-form-data API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fimport-form-data\"\n        }\n      ],\n      \"keywords\": \".NET, Import Form Data\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Import Data to PDF Forms in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9255,9256,9257,9258],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1806,"name":1807,"slug":1808,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-import-data-to-pdf-forms-in-net-with-c\u002F","How to Import Data to PDF Forms in .NET with C#, Tutorial | pdfRest",{"id":9263,"uuid":9264,"title":9265,"slug":9266,"html":9267,"comment_id":9263,"feature_image":48,"featured":284,"visibility":1257,"created_at":9268,"updated_at":9232,"published_at":9268,"custom_excerpt":9269,"codeinjection_head":9270,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9271,"primary_tag":9278,"url":9279,"excerpt":9269,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9280,"meta_description":9269,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"672bcb5f533c9f26b9438c14","2f4d4ee5-75b4-4384-a27b-24279c2cc800","How to Import Data to PDF Forms with cURL","how-to-import-data-to-pdf-forms-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Import Form Data with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fimport-form-data\u002F'>Import Form Data API Tool\u003C\u002Fa> is a powerful resource for users who need to automate the process of importing form data into PDF documents. This tutorial will guide you through the process of sending an API call to import form data using cURL, a command-line tool for transferring data with URLs. By leveraging cURL, you can efficiently interact with the pdfRest API to streamline your document management workflows.\u003C\u002Fp>\n\n\u003Cp>Imagine a business that collects customer information through online forms and needs to generate personalized PDF reports for each submission. Using the Import Form Data API, the business can automate the process of merging form data with a PDF template, saving time and reducing errors associated with manual data entry.\u003C\u002Fp>\n\n\u003Ch2>Import Form Data with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-imported-form-data\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\" \\\n  -F \"data_file=@\u002Fpath\u002Fto\u002Fdatafile\"\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-imported-form-data.sh\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The command begins with \u003Ccode>curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-imported-form-data\"\u003C\u002Fcode>, which specifies that a POST request is being made to the specified endpoint. This is essential for sending data to the server to process the import.\u003C\u002Fp>\n\n\u003Cp>The header \u003Ccode>-H \"Accept: application\u002Fjson\"\u003C\u002Fcode> indicates that the client expects a JSON response from the server, which is a common format for API responses.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>-H \"Content-Type: multipart\u002Fform-data\"\u003C\u002Fcode> header is crucial because it tells the server that the request will contain multiple parts, such as files and form data. This is necessary for uploading files.\u003C\u002Fp>\n\n\u003Cp>\u003Ccode>-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\u003C\u002Fcode> includes the API key for authentication. Replace the placeholder with your actual API key to authenticate your request.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\u003C\u002Fcode> option uploads the PDF file that will receive the imported form data. Replace \u003Ccode>\u002Fpath\u002Fto\u002Ffile\u003C\u002Fcode> with the path to your PDF document.\u003C\u002Fp>\n\n\u003Cp>Using \u003Ccode>-F \"output=example_out\"\u003C\u002Fcode>, you specify the desired name for the output file. This parameter determines how the resulting file will be named after processing.\u003C\u002Fp>\n\n\u003Cp>Finally, \u003Ccode>-F \"data_file=@\u002Fpath\u002Fto\u002Fdatafile\"\u003C\u002Fcode> uploads the data file containing the form data to be imported. Ensure you replace \u003Ccode>\u002Fpath\u002Fto\u002Fdatafile\u003C\u002Fcode> with the correct path to your data file.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use cURL to make an API call to the pdfRest Import Form Data endpoint. This process allows you to automate the integration of form data into PDF documents, enhancing efficiency and accuracy in document processing.\u003C\u002Fp>\n\n\u003Cp>To explore more features and capabilities of pdfRest, I encourage you to demo all the API Tools available in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For comprehensive details, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example demonstrates a multipart API call. For code samples using JSON payloads, visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-imported-form-data.sh\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-06T20:02:39.000+00:00","Learn how to use pdfRest Import Form Data API Tool to fill PDF form fields from an external data source with cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-curl\u002F#article\",\n      \"headline\": \"How to Import Data to PDF Forms with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-curl\u002F\",\n      \"datePublished\": \"2024-11-06T20:02:39.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:22.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Import Form Data API Tool to fill PDF form fields from an external data source with cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Import Form Data API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fimport-form-data\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-imported-form-data API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fimport-form-data\"\n        }\n      ],\n      \"keywords\": \"Data, Forms, Import Form Data, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Import Data to PDF Forms with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9272,9273,9274,9275,9276,9277],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1806,"name":1807,"slug":1808,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1782,"name":1783,"slug":1784,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-import-data-to-pdf-forms-with-curl\u002F","How to Import Data to PDF Forms with cURL, Tutorial | pdfRest",{"id":9282,"uuid":9283,"title":9284,"slug":9285,"html":9286,"comment_id":9282,"feature_image":48,"featured":284,"visibility":1257,"created_at":8994,"updated_at":9287,"published_at":8852,"custom_excerpt":9288,"codeinjection_head":9289,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9290,"primary_tag":9297,"url":9298,"excerpt":9288,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9299,"meta_description":9288,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c5f533c9f26b943b586","5dba5798-390b-4e09-8c22-f904c1442e8a","How to Import Data to PDF Forms with Java","how-to-import-data-to-pdf-forms-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This step-by-step tutorial explains how a Java application can import data to PDF forms through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fimport-form-data\u002F\">Import Form Data API Tool\u003C\u002Fa>. The multipart request pairs the destination PDF with a structured data file whose field names map to the form. After reviewing the example, you'll be ready to import data to PDF forms with your own input.\u003C\u002Fp>\n\n\u003Ch2>Why Import Data to PDF Forms with Java?\u003C\u002Fh2>\n\n\u003Cp>An onboarding system may already hold customer details that also belong in a standardized PDF form. Importing those values avoids asking users or staff to enter the same information twice.\u003C\u002Fp>\n\n\u003Cp>The multipart request sends the PDF as \u003Ccode>file\u003C\u002Fcode> and the field-value file as \u003Ccode>data_file\u003C\u002Fcode> to \u003Ccode>\u002Fpdf-with-imported-form-data\u003C\u002Fcode>. Field names in the data must match the form.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class PDFWithImportedFormData {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify the path to your data file here, or as the second argument when running the\n  \u002F\u002F program.\n  private static final String DEFAULT_DATA_PATH = \"\u002Fpath\u002Fto\u002Ffile.xml\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile, dataFile;\n    if (args.length > 1) {\n      inputFile = new File(args[0]);\n      dataFile = new File(args[1]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n      dataFile = new File(DEFAULT_DATA_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    final RequestBody dataFileRequestBody =\n        RequestBody.create(dataFile, MediaType.parse(\"application\u002Fxml\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"data_file\", dataFile.getName(), dataFileRequestBody)\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf-with-imported-form-data\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPDFWithImportedFormData.java\">Java sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The sample assigns a clear role to each library: HTTP communication, credential lookup, or JSON handling.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify the path to your data file here, or as the second argument when running the\n  \u002F\u002F program.\n  private static final String DEFAULT_DATA_PATH = \"\u002Fpath\u002Fto\u002Ffile.xml\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile, dataFile;\n    if (args.length > 1) {\n      inputFile = new File(args[0]);\n      dataFile = new File(args[1]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\u003C\u002Fpre>\n\n\u003Cp>The form and its data file have separate defaults and command-line arguments, making their relationship explicit before dotenv loads the API key.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody dataFileRequestBody =\n        RequestBody.create(dataFile, MediaType.parse(\"application\u002Fxml\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"data_file\", dataFile.getName(), dataFileRequestBody)\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf-with-imported-form-data\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The multipart request sends the PDF as \u003Ccode>file\u003C\u002Fcode> and the field-value file as \u003Ccode>data_file\u003C\u002Fcode> to \u003Ccode>\u002Fpdf-with-imported-form-data\u003C\u002Fcode>. Field names in the data must match the form. The form-data setup leaves boundary construction to OkHttp so the header remains synchronized with the serialized content.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf-with-imported-form-data\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\u003C\u002Fpre>\n\n\u003Cp>The client request posts the multipart content to pdfRest and keeps deployment-region changes independent of the rest of the Java code.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>The response check prints the HTTP status and JSON body so generated resource IDs or API error details are visible.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>The completed example gives you a practical Java starting point for learning how to import data to PDF forms. With that foundation, you can use form import for prefilled applications, generated forms, batch correspondence, and system-of-record synchronization.\u003C\u002Fp>\n\n\u003Cp>As you apply the pattern to real documents, keep in mind that data keys must match the PDF field names exactly, so export a known form first when the contract is unclear. Validate dates, checkboxes, choice fields, and multiline values with realistic records before generating forms in bulk.\u003C\u002Fp>\n\n\u003Cp>Before integrating this workflow, test representative documents with the Import Data to PDF Forms operation in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. Then use the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fimport-form-data\u002F\">Import Form Data API Tool documentation\u003C\u002Fa> to review every available parameter and response field.\u003C\u002Fp>\n\n\u003Cp>Note: The Import Data to PDF Forms example above uses multipart form data; to reuse a resource ID, use the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPDFWithImportedFormData.java\">JSON payload example\u003C\u002Fa> as a guide.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-02T18:28:58.000+00:00","Populate PDF form fields from structured data with Java.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-java\u002F#article\",\n      \"headline\": \"How to Import Data to PDF Forms with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:39.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:39.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Populate PDF form fields from structured data with Java.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Import Form Data API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fimport-form-data\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-imported-form-data API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fimport-form-data\"\n        }\n      ],\n      \"keywords\": \"Data, Forms, Import Form Data, Java\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Import Data to PDF Forms with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9291,9292,9293,9294,9295,9296],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1806,"name":1807,"slug":1808,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1782,"name":1783,"slug":1784,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-import-data-to-pdf-forms-with-java\u002F","Import Data to PDF Forms with Java | pdfRest",{"id":9301,"uuid":9302,"title":9303,"slug":9304,"html":9305,"comment_id":9301,"feature_image":48,"featured":284,"visibility":1257,"created_at":9306,"updated_at":9287,"published_at":9306,"custom_excerpt":9307,"codeinjection_head":9308,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9309,"primary_tag":9314,"url":9315,"excerpt":9307,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9316,"meta_description":9307,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65f7b562533c9f26b9436ade","83ebc5ef-e7b5-41b2-91fe-eab14080702d","How to Import Data to PDF Forms with JavaScript in NodeJS","how-to-import-data-to-pdf-forms-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Import Form Data with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fimport-form-data\u002F'>Import Form Data API Tool\u003C\u002Fa> is a powerful resource for developers looking to automate the process of populating PDF forms with data. This tool enables you to send an API call to import data into a PDF form programmatically, which can be incredibly useful for generating customized documents on-the-fly.\u003C\u002Fp>\n  \n\u003Cp>In this tutorial, we will demonstrate how to make an API call to the Import Form Data API Tool using JavaScript to utilize this functionality.\u003C\u002Fp>\n\n\u003Cp>Imagine you are managing a large number of customer contracts, and each contract needs to be filled out with specific customer details. Manually entering this data can be time-consuming and prone to errors. By using the Import Form Data API, you can automate the process by importing data from a structured data file directly into your PDF forms, ensuring accuracy and efficiency in document generation.\u003C\u002Fp>\n\n\u003Ch2>Import Form Data with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F**\n * This request demonstrates how to import data from a data file into a PDF with forms.\n *\u002F\nvar axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\ndata.append(\"data_file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Fdatafile\"));\ndata.append(\"output\", \"pdfrest_pdf_with_imported_form_data\");\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: \"post\",\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-imported-form-data\",\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", \u002F\u002F Replace with your API key\n    ...data.getHeaders(), \u002F\u002F set headers for the request\n  },\n  data: data, \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error);\n  });\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Reference: The code provided is sourced from \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-imported-form-data.js\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code example above demonstrates how to use Node.js, along with the Axios library, to make a multipart POST request to the pdfRest API for importing form data into a PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\u003C\u002Fpre>\n\n\u003Cp>This snippet includes the necessary modules: Axios for making HTTP requests, FormData to construct multipart\u002Fform-data payloads, and fs to interact with the file system.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\ndata.append(\"data_file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Fdatafile\"));\ndata.append(\"output\", \"pdfrest_pdf_with_imported_form_data\");\u003C\u002Fpre>\n\n\u003Cp>Here, a new FormData instance is created, and the PDF file, data file, and output name are appended. The files are read from the specified paths and included in the request payload.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: \"post\",\n  maxBodyLength: Infinity,\n  url: \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-imported-form-data\",\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    ...data.getHeaders(),\n  },\n  data: data,\n};\u003C\u002Fpre>\n\n\u003Cp>The configuration object for the Axios request is defined, setting the request method, URL, headers (including the API key), and the data payload.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error);\n  });\u003C\u002Fpre>\n\n\u003Cp>The Axios library is used to send the request with the provided configuration. The response is then logged to the console or, in case of an error, the error information is logged.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've successfully demonstrated how to call the pdfRest API to import form data into a PDF using JavaScript. This process can be integrated into various applications to automate document workflows and increase productivity.\u003C\u002Fp>\n\n\u003Cp>To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For a comprehensive understanding of the available endpoints and their functionalities, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. For code samples using JSON payloads, you can find them at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-imported-form-data.js\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-18T03:30:42.000+00:00","Learn how to use pdfRest Import Form Data API Tool with JavaScript in NodeJS to import data into PDF forms.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Import Data to PDF Forms with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-03-18T03:30:42.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:38.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Import Form Data API Tool with JavaScript in NodeJS to import data into PDF forms.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Import Form Data API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fimport-form-data\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-imported-form-data API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fimport-form-data\"\n        }\n      ],\n      \"keywords\": \"Import Form Data, JavaScript\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Import Data to PDF Forms with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9310,9311,9312,9313],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1806,"name":1807,"slug":1808,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-import-data-to-pdf-forms-with-javascript-in-nodejs\u002F","How to Import Data to PDF Forms with JavaScript in NodeJS, Tutorial | pdfRest",{"id":9318,"uuid":9319,"title":9320,"slug":9321,"html":9322,"comment_id":9318,"feature_image":48,"featured":284,"visibility":1257,"created_at":9323,"updated_at":9324,"published_at":9323,"custom_excerpt":9325,"codeinjection_head":9326,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9327,"primary_tag":9332,"url":9333,"excerpt":9325,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9334,"meta_description":9325,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65f7b5a2533c9f26b9436ae8","23d89271-da9e-40ac-a2da-3ad18d566c55","How to Import Data to PDF Forms with PHP","how-to-import-data-to-pdf-forms-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Import Form Data with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fimport-form-data\u002F'>Import Form Data API Tool\u003C\u002Fa> is a powerful feature that allows users to automate the process of importing data into PDF forms. This tool is particularly useful when you have a PDF form and a set of data that you want to merge together without manual data entry.\u003C\u002Fp> \n  \n\u003Cp>This tutorial will guide you through the process of making an API call to the Import Form Data endpoint using PHP, which is a common server-side scripting language used in web development.\u003C\u002Fp>\n\n\u003Cp>In the real world, you might use the Import Form Data feature to automate the filling of customer information into contract templates, to generate personalized reports from collected data, or to streamline any process where form data needs to be programmatically merged with a PDF. For instance, a healthcare provider could use this tool to populate patient intake forms with data from an electronic health record system, saving time and reducing errors.\u003C\u002Fp>\n\n\u003Ch2>Import Form Data with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">\nrequire 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n$client = new Client();\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Provide the path to the PDF file with forms.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers'  => [\n        'Content-Type' => '\u003CContent-type header>'\n      ]\n    ],\n    [\n      'name' => 'data_file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Fdatafile', 'r'), \u002F\u002F Provide the path to the file with form data.\n      'filename' => '\u002Fpath\u002Fto\u002Fdatafile',\n      'headers'  => [\n        'Content-Type' => '\u003CContent-type header>'\n      ]\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_pdf-with-imported-form-data' \u002F\u002F Specify the output file name\n    ]\n]];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-imported-form-data', $headers);  \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the PDF with data.\n\u003C\u002Fpre>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided PHP code uses the Guzzle HTTP client to send a multipart POST request to the pdfRest API. Let's break down the key parts of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">use GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>This section initializes the Guzzle HTTP client and sets up the headers for the API request, including the required 'Api-Key' for authentication.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$options = [\n  'multipart' => [\n    \u002F\u002F ...\n  ]\n];\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>$options\u003C\u002Fcode> array contains the multipart form data. Each part represents a different piece of data to be sent with the request:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>\u003Cstrong>file\u003C\u002Fstrong>: The PDF file with forms that you want to populate.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>data_file\u003C\u002Fstrong>: The file containing the form data in FDF, XFDF, XML, or JSON format.\u003C\u002Fli>\n  \u003Cli>\u003Cstrong>output\u003C\u002Fstrong>: The desired name for the output PDF file.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-php\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-imported-form-data', $headers);\n$res = $client->sendAsync($request, $options)->wait();\necho $res->getBody();\n\u003C\u002Fpre>\n\n\u003Cp>Here, a new HTTP POST request is created with the API endpoint and headers, and the request is sent asynchronously. The response is then waited on, and the body of the response, which contains the PDF with the imported data, is outputted.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following this tutorial, you've learned how to use PHP to call the pdfRest Import Form Data API to programmatically fill out a PDF form with data. This can greatly improve efficiency and accuracy in various data entry tasks.\u003C\u002Fp>\n\n\u003Cp>To further explore the capabilities of pdfRest and to demo all of the API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information about the API and its features, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. If you are interested in code samples using JSON payloads, you can find them at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-imported-form-data.php\">this GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-18T03:31:46.000+00:00","2026-09-02T18:28:59.000+00:00","Learn how to use pdfRest Import Form Data API Tool with PHP to import data into PDF forms.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-php\u002F#article\",\n      \"headline\": \"How to Import Data to PDF Forms with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-php\u002F\",\n      \"datePublished\": \"2024-03-18T03:31:46.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:38.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Import Form Data API Tool with PHP to import data into PDF forms.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Import Form Data API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fimport-form-data\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-imported-form-data API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fimport-form-data\"\n        }\n      ],\n      \"keywords\": \"Import Form Data, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Import Data to PDF Forms with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9328,9329,9330,9331],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1806,"name":1807,"slug":1808,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-import-data-to-pdf-forms-with-php\u002F","How to Import Data to PDF Forms with PHP, Tutorial | pdfRest",{"id":9336,"uuid":9337,"title":9338,"slug":9339,"html":9340,"comment_id":9336,"feature_image":48,"featured":284,"visibility":1257,"created_at":9341,"updated_at":9324,"published_at":9341,"custom_excerpt":9342,"codeinjection_head":9343,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9344,"primary_tag":9349,"url":9350,"excerpt":9342,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9351,"meta_description":9342,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65f7b5fb533c9f26b9436af2","a98b3971-2e5b-4b08-b2b0-8914daa24464","How to Import Data to PDF Forms with Python","how-to-import-data-to-pdf-forms-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Import Form Data with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fimport-form-data\u002F'>Import Form Data API Tool\u003C\u002Fa> is a powerful resource for automating the process of importing data into PDF forms. This tool allows you to programmatically fill out PDF forms with data from various sources such as XML or FDF files.\u003C\u002Fp> \n  \n\u003Cp>This tutorial will guide you through the process of making an API call to the Import Form Data endpoint using Python, demonstrating how to send data to populate a PDF form programmatically.\u003C\u002Fp>\n\n\u003Cp>Consider a real-world scenario where a business needs to generate hundreds of personalized contracts for a new product launch. Manually entering data into each form would be time-consuming and error-prone. By using the Import Form Data API, the business can automate the process, ensuring that each PDF form is accurately filled with the correct data from a structured data file, thus saving time and reducing the potential for human error.\u003C\u002Fp>\n\n\u003Ch2>Import Form Data with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nimport_form_data_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-imported-form-data'\n\nmp_encoder_importFormData = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'data_file': ('file_name.xml', open('\u002Fpath\u002Fto\u002Fdatafile', 'rb'), 'application\u002Fxml'), # Update for your data file format\n        'output' : 'example_out'\n    }\n)\n\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_importFormData.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to pdf-with-imported-form-data endpoint...\")\nresponse = requests.post(import_form_data_endpoint_url, data=mp_encoder_importFormData, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-imported-form-data.py\">GitHub - datalogics\u002Fpdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided code demonstrates how to make a multipart POST request to the pdfRest Import Form Data API endpoint. Here's a breakdown of the key components:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">import_form_data_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-imported-form-data'\u003C\u002Fpre>\n\n\u003Cp>This line sets the URL for the API endpoint that will process the form data import.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_importFormData = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'data_file': ('file_name.xml', open('\u002Fpath\u002Fto\u002Fdatafile', 'rb'), 'application\u002Fxml'),\n        'output' : 'example_out'\n    }\n)\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>MultipartEncoder\u003C\u002Fcode> constructs the multipart payload for the request. The fields dictionary includes:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Ccode>'file'\u003C\u002Fcode>: The PDF file into which data will be imported.\u003C\u002Fli>\n\u003Cli>\u003Ccode>'data_file'\u003C\u002Fcode>: The data file containing the form data to be imported.\u003C\u002Fli>\n\u003Cli>\u003Ccode>'output'\u003C\u002Fcode>: The base name for the output file.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_importFormData.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\u003C\u002Fpre>\n\n\u003Cp>Headers specify the expected response format, the content type of the request, and the API key for authentication.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(import_form_data_endpoint_url, data=mp_encoder_importFormData, headers=headers)\u003C\u002Fpre>\n\n\u003Cp>This line sends the POST request with the multipart payload and headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\u003C\u002Fpre>\n\n\u003Cp>The response is checked for success, and if successful, the JSON response is printed. Otherwise, the error text is displayed.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following this tutorial, you've learned how to use Python to call the pdfRest Import Form Data API to programmatically fill PDF forms with data. This can significantly streamline workflows that involve repetitive form filling and ensure data consistency across documents.\u003C\u002Fp>\n\n\u003Cp>Feel free to demo all of the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">pdfRest API Tools\u003C\u002Fa> in the API Lab and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for more detailed information on how to use the various features provided by pdfRest.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-imported-form-data.py\">GitHub - datalogics\u002Fpdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-18T03:33:15.000+00:00","Learn how to use pdfRest Import Form Data API Tool with Python to import data into PDF forms.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-python\u002F#article\",\n      \"headline\": \"How to Import Data to PDF Forms with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-python\u002F\",\n      \"datePublished\": \"2024-03-18T03:33:15.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:38.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Import Form Data API Tool with Python to import data into PDF forms.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Import Form Data API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fimport-form-data\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-imported-form-data API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fimport-form-data\"\n        }\n      ],\n      \"keywords\": \"Import Form Data, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Import Data to PDF Forms with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-import-data-to-pdf-forms-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9345,9346,9347,9348],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1806,"name":1807,"slug":1808,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-import-data-to-pdf-forms-with-python\u002F","How to Import Data to PDF Forms with Python, Tutorial | pdfRest",{"id":9353,"uuid":9354,"title":9355,"slug":9356,"html":9357,"comment_id":9358,"feature_image":48,"featured":284,"visibility":1257,"created_at":9359,"updated_at":9360,"published_at":9359,"custom_excerpt":9361,"codeinjection_head":9362,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9363,"primary_tag":9368,"url":9369,"excerpt":9361,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9370,"meta_description":9361,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1363","e85e4187-22a7-484d-956b-d1ff2a11b816","How to Linearize PDF in .NET with C#","how-to-linearize-pdf-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Linearize PDF with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Flinearize-pdf\u002F'>Linearize PDF API Tool\u003C\u002Fa> is a powerful resource that allows you to optimize PDFs for faster web viewing. Linearizing a PDF, also known as \"web optimization\" or \"fast web view,\" restructures the file so that it can be read in a web browser before the entire file has been downloaded.\u003C\u002Fp>\n\n\u003Cp>This tutorial will demonstrate how to send an API call to the Linearize PDF endpoint using C#. A real-world example of using Linearize PDF could be a web application that provides large PDFs, like e-books or product catalogues, and wants to improve user experience by allowing users to begin reading without waiting for the entire document to download.\u003C\u002Fp>\n\n\u003Ch2>Linearize PDF with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"linearized-pdf\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source code reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Flinearized-pdf.cs\">pdfRest API Samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the C# Code\u003C\u002Fh2>\n\n\u003Cp>The provided code is a C# example of how to make a POST request to the Linearize PDF endpoint of the pdfRest API:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>This initializes an instance of \u003Ccode>HttpClient\u003C\u002Fcode> with the base address set to the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var request = new HttpRequestMessage(HttpMethod.Post, \"linearized-pdf\"))\n\u003C\u002Fpre>\n\n\u003Cp>A new \u003Ccode>HttpRequestMessage\u003C\u002Fcode> is created with the HTTP method set to POST and the endpoint set to \"linearized-pdf\".\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>The API key is added to the request headers. Replace \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" with your actual pdfRest API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n\u003C\u002Fpre>\n\n\u003Cp>A \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> object is created to hold the file content.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\n\u003C\u002Fpre>\n\n\u003Cp>The PDF file is read into a byte array from the specified path. Replace \"\u002Fpath\u002Fto\u002Ffile.pdf\" with the path to your PDF file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">multipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n\u003C\u002Fpre>\n\n\u003Cp>The byte array content is added to the multipart form data content with the name \"file\" and a file name \"file_name.pdf\". Replace \"file_name.pdf\" with the actual file name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\u003C\u002Fpre>\n\n\u003Cp>The content type of the byte array is set to \"application\u002Fpdf\" to indicate that the content is a PDF file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\n\u003C\u002Fpre>\n\n\u003Cp>The request is sent asynchronously and the response is awaited.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>The response content is read as a string asynchronously, which contains the result of the API call.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial walked you through the process of making an API call to the pdfRest Linearize PDF endpoint using C#. By executing this code, you have successfully sent a PDF file to be linearized, which can now be served more efficiently over the web. Feel free to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for further exploration.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Flinearized-pdf.cs\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","658f29092d4014c9499b3bf0","2023-12-29T20:16:09.000+00:00","2026-09-02T18:29:00.000+00:00","Learn how to use C# to call the Linearize PDF API Tool from pdfRest to enable Fast Web View on your documents.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Linearize PDF in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-in-net-with-c\u002F\",\n      \"datePublished\": \"2023-12-29T20:16:09.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:57.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use C# to call the Linearize PDF API Tool from pdfRest to enable Fast Web View on your documents.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Linearize PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Flinearize-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Flinearized-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Flinearize-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Linearize PDF\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Linearize PDF in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9364,9365,9366,9367],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1887,"name":1888,"slug":1889,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-linearize-pdf-in-net-with-c\u002F","How to Linearize PDF in .NET with C#, Tutorial | pdfRest",{"id":9372,"uuid":9373,"title":9374,"slug":9375,"html":9376,"comment_id":9372,"feature_image":48,"featured":284,"visibility":1257,"created_at":9377,"updated_at":9360,"published_at":9377,"custom_excerpt":9378,"codeinjection_head":9379,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9380,"primary_tag":9385,"url":9386,"excerpt":9378,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9387,"meta_description":9378,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65eb7073533c9f26b9436849","864e170d-9572-46dc-baeb-f00af1957449","How to Linearize PDF with cURL","how-to-linearize-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Linearize PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Flinearize-pdf\u002F'>Linearize PDF API Tool\u003C\u002Fa> is an invaluable resource for optimizing PDFs for fast web view. Linearization restructures a PDF document so that its pages can be displayed or streamed one at a time without needing to download the entire file first. This tutorial will guide you through the process of sending an API call to the Linearize PDF endpoint using cURL, a powerful and versatile command-line tool for transferring data with URLs.\u003C\u002Fp>\n\n\u003Cp>Linearizing a PDF is particularly useful for improving user experience on websites where large PDF files are available for viewing. For instance, if a user wants to read a lengthy report or e-book, linearizing the PDF allows the initial pages to be displayed quickly while the rest of the document continues to download in the background. This means no long waits and a smoother reading experience for the end user.\u003C\u002Fp>\n\n\u003Ch2>Linearize PDF with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Flinearized-pdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>Reference to the code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Flinearized-pdf.sh\">pdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The above cURL command is composed of several parts that together create a POST request to the pdfRest API:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Flinearized-pdf\"\n\u003C\u002Fpre>\n\n\u003Cp>This specifies the HTTP method (POST) and the API endpoint URL for linearizing a PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\n\u003C\u002Fpre>\n\n\u003Cp>This header tells the server that the client expects a response in JSON format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\n\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the data being sent in the request is multipart form data, which is necessary for file uploads.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>Here you must replace 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' with your actual API key provided by pdfRest.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\n\u003C\u002Fpre>\n\n\u003Cp>This form field is used to upload the PDF file that you want to linearize. Replace '\u002Fpath\u002Fto\u002Ffile' with the actual file path to your PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>This form field specifies the name of the output file that will be created after the linearization process.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps outlined above, you've successfully made an API call to linearize a PDF using cURL. This allows for quicker access to PDF content over the web, enhancing the user experience. To explore the full capabilities of the pdfRest API and to see live examples, you can visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For a deeper understanding of all the available features and detailed documentation, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Additional code samples using JSON payloads for the Linearize PDF API and other endpoints can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Flinearized-pdf.sh\">pdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-08T20:09:23.000+00:00","Learn how to apply linearization to a PDF to optimize for fast web view with pdfRest Linearize PDF API Tool and cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Linearize PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-curl\u002F\",\n      \"datePublished\": \"2024-03-08T20:09:23.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:43.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to apply linearization to a PDF to optimize for fast web view with pdfRest Linearize PDF API Tool and cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Linearize PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Flinearize-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Flinearized-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Flinearize-pdf\"\n        }\n      ],\n      \"keywords\": \"Linearize PDF, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Linearize PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9381,9382,9383,9384],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1887,"name":1888,"slug":1889,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-linearize-pdf-with-curl\u002F","How to Linearize PDF with cURL, Tutorial | pdfRest",{"id":9389,"uuid":9390,"title":9391,"slug":9392,"html":9393,"comment_id":9389,"feature_image":48,"featured":284,"visibility":1257,"created_at":9394,"updated_at":9395,"published_at":9394,"custom_excerpt":9396,"codeinjection_head":9397,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9398,"primary_tag":9403,"url":9404,"excerpt":9396,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9405,"meta_description":9396,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65eb7a72533c9f26b9436861","8cd36112-ca90-4b91-8c59-bc7571bd5017","How to Linearize PDF with Java","how-to-linearize-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Linearize PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Flinearize-pdf\u002F'>Linearize PDF API Tool\u003C\u002Fa> provides a straightforward way to optimize PDF files for faster web view. Linearization, also known as \"web optimization\" or \"fast web view,\" restructures a PDF document so that its pages can be displayed one by one as they are downloaded, rather than waiting for the entire file to be downloaded first. This tutorial will demonstrate how to send an API call to Linearize PDF using Java, which is particularly useful for developers working in Java environments who need to integrate PDF optimization into their applications.\u003C\u002Fp>\n\n\u003Cp>Consider a scenario where a user is trying to access a large PDF document from a web server. If the PDF is not linearized, the user might experience significant delays before being able to view the first page, leading to a poor user experience. By using the Linearize PDF API, the document can be prepared for efficient online viewing, allowing end-users to start reading the PDF almost immediately while the rest of the document continues to download in the background.\u003C\u002Fp>\n\n\u003Ch2>Linearize PDF with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class LinearizedPDF {\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_linearized\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Flinearized-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\n\u003C\u002Fpre>\n\n\u003Cp>The provided code is sourced from the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FLinearizedPDF.java\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code example above demonstrates how to make a multipart API call to the pdfRest Linearize PDF endpoint. Let's break down the key components of this code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">\u002F\u002F Specify the path to your file here, or as the first argument when running the program.\nprivate static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\u003C\u002Fpre>\n\n\u003Cp>This line sets the default file path for the PDF to be linearized. The user can also provide the file path as an argument when running the program.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">\u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\nprivate static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\u003C\u002Fpre>\n\n\u003Cp>The API key is necessary for authentication with the pdfRest API. It can be hardcoded or stored as an environment variable.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\u003C\u002Fpre>\n\n\u003Cp>This snippet initializes the Dotenv library, which is used to load environment variables from a .env file, if available.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n    RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n\u003C\u002Fpre>\n\n\u003Cp>This creates a request body with the PDF file's content and specifies the media type as \"application\u002Fpdf\".\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">RequestBody requestBody =\n    new MultipartBody.Builder()\n        .setType(MultipartBody.FORM)\n        .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n        .addFormDataPart(\"output\", \"pdfrest_linearized\")\n        .build();\n\u003C\u002Fpre>\n\n\u003Cp>This code constructs the multipart request body, including the file and the desired output filename.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Request request =\n    new Request.Builder()\n        .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n        .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Flinearized-pdf\")\n        .post(requestBody)\n        .build();\n\u003C\u002Fpre>\n\n\u003Cp>The request is built with the API key header, the endpoint URL, and the POST method containing the request body.\u003C\u002Fp>\n\n\u003Cp>Upon executing the request, the program prints the response code and, if successful, outputs the pretty-printed JSON response.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, we have successfully called the Linearize PDF API using Java to optimize a PDF file for faster web viewing. This can greatly enhance the user experience by allowing immediate access to the content of large PDF documents on the web.\u003C\u002Fp>\n\n\u003Cp>To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information on how to use the API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. Remember, this is an example of a multipart API call, and code samples using JSON payloads can be found at the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FLinearizedPDF.java\">pdf-rest-api-samples repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-08T20:52:02.000+00:00","2026-09-02T18:29:01.000+00:00","Learn how to use Linearize PDF API Tool from Datalogics with Java to optimize PDFs for fast web view","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Linearize PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-java\u002F\",\n      \"datePublished\": \"2024-03-08T20:52:02.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:42.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use Linearize PDF API Tool from Datalogics with Java to optimize PDFs for fast web view\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Linearize PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Flinearize-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Flinearized-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Flinearize-pdf\"\n        }\n      ],\n      \"keywords\": \"Java, Linearize PDF\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Linearize PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9399,9400,9401,9402],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1887,"name":1888,"slug":1889,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-linearize-pdf-with-java\u002F","How to Linearize PDF with Java, Tutorial | pdfRest",{"id":9407,"uuid":9408,"title":9409,"slug":9410,"html":9411,"comment_id":9412,"feature_image":48,"featured":284,"visibility":1257,"created_at":9413,"updated_at":9395,"published_at":9413,"custom_excerpt":9414,"codeinjection_head":9415,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9416,"primary_tag":9421,"url":9422,"excerpt":9414,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9423,"meta_description":9414,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1364","224320c9-bceb-470a-b9b4-c5e081fa42a0","How to Linearize PDF with JavaScript in NodeJS","how-to-linearize-pdf-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Linearize PDF with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Flinearize-pdf\u002F'>Linearize PDF API Tool\u003C\u002Fa> is designed to optimize PDFs for faster web viewing by reorganizing the file structure to download only the parts of the PDF that are required for viewing, rather than the entire file.\u003C\u002Fp>\n\n\u003Cp>This tutorial will show how to send an API call to Linearize PDF with JavaScript. For instance, if a user is serving large PDFs on their website, linearizing them would significantly improve the user experience by allowing the PDFs to be viewed almost immediately, without waiting for the entire file to download.\u003C\u002Fp>\n\n\u003Ch2>Linearize PDF with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\u002F\u002F This request demonstrates how to liearize a PDF for fast web viewing.\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('output', 'pdfrest_linearized_pdf');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Flinearized-pdf', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\u003C\u002Fpre>\n\n\u003Cp>Reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Flinearized-pdf.js\">pdfRest API Samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the JavaScript Code\u003C\u002Fh2>\n\n\u003Cp>The provided code uses the Axios library to send an HTTP POST request to the pdfRest API to linearize a PDF. Here's a breakdown of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\u003C\u002Fpre>\n\n\u003Cp>This snippet imports the necessary modules: Axios for HTTP requests, FormData to create multipart\u002Fform-data payloads, and fs to interact with the file system.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('output', 'pdfrest_linearized_pdf');\n\u003C\u002Fpre>\n\n\u003Cp>Here, a new FormData instance is created, and the PDF file to be linearized is appended to the form data along with an output parameter that names the output file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Flinearized-pdf', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\n\u003C\u002Fpre>\n\n\u003Cp>The Axios request configuration is defined, including the API endpoint URL, the API key header (which should be replaced with your actual API key), and the form data payload.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\u003C\u002Fpre>\n\n\u003Cp>The Axios instance is then used to send the request. The response is logged to the console if successful, or an error is logged if the request fails.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've accomplished sending a request to the pdfRest API to linearize a PDF for fast web viewing. Users are encouraged to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for further exploration of the API's capabilities.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Flinearized-pdf.js\">pdfRest API Samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","658f29562d4014c9499b3bfe","2023-12-29T20:17:26.000+00:00","Learn how to enable Fast Web View on PDF files with JavaScript using the Linearize PDF API Tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Linearize PDF with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2023-12-29T20:17:26.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:57.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to enable Fast Web View on PDF files with JavaScript using the Linearize PDF API Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Linearize PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Flinearize-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Flinearized-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Flinearize-pdf\"\n        }\n      ],\n      \"keywords\": \"JavaScript, Linearize PDF\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Linearize PDF with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9417,9418,9419,9420],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1887,"name":1888,"slug":1889,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-linearize-pdf-with-javascript-in-nodejs\u002F","How to Linearize a PDF with JavaScript in NodeJS, Tutorial | pdfRest",{"id":9425,"uuid":9426,"title":9427,"slug":9428,"html":9429,"comment_id":9430,"feature_image":48,"featured":284,"visibility":1257,"created_at":9431,"updated_at":9432,"published_at":9431,"custom_excerpt":9433,"codeinjection_head":9434,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9435,"primary_tag":9440,"url":9441,"excerpt":9433,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9442,"meta_description":9433,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1362","18e4035d-b58f-4dfa-9d7a-f1dd4e8e6a8e","How to Linearize PDF with PHP","how-to-linearize-pdf-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Linearize PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Flinearize-pdf\u002F\">Linearize PDF API Tool\u003C\u002Fa> provides a convenient way to optimize PDF files for faster web viewing by rearranging the file structure. This process, known as linearization, allows a PDF to be displayed one page at a time as it is downloaded, which can be particularly useful for large documents that need to be viewed online.\u003C\u002Fp>\n\n\u003Cp>For example, if you have an e-book platform where users can read large PDFs directly in their browsers, using this API to linearize your PDFs would enhance the user experience by allowing immediate access to individual pages without the need to download the entire document first.\u003C\u002Fp>\n\n\u003Cp>This tutorial will demonstrate how to send an API call to the Linearize PDF endpoint using PHP.\u003C\u002Fp>\n\n\u003Ch2>Linearize PDF with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_linearized_pdf'\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Flinearized-pdf', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source code reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Flinearized-pdf.php\">pdfRest API Samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the PHP Code\u003C\u002Fh2>\n\n\u003Cp>The above PHP code demonstrates how to perform a multipart\u002Fform-data POST request to the pdfRest API to linearize a PDF file. Here's a breakdown of the key parts of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\u003C\u002Fpre>\n\n\u003Cp>This line includes the Composer-generated autoloader, which automatically loads the Guzzle HTTP client library.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The headers array contains the API key required for authentication with the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$options = [\n  'multipart' => [\n    \u002F\u002F File part\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    \u002F\u002F Output part\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_linearized_pdf'\n    ]\n  ]\n];\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>The options array specifies the multipart request payload. The 'file' part includes the file stream, filename, and content type. The 'output' part defines the desired output option.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Flinearized-pdf', $headers);\n\u003C\u002Fpre>\n\n\u003Cp>This line creates a new HTTP POST request with the specified endpoint and headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$res = $client->sendAsync($request, $options)->wait();\n\u003C\u002Fpre>\n\n\u003Cp>The client sends the request asynchronously and waits for the response. The response body contains the linearized PDF content.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've learned how to use PHP to call the pdfRest Linearize PDF API to optimize a PDF for fast web viewing. By sending an API call with the necessary parameters, we've accomplished the task of linearizing a PDF document.\u003C\u002Fp>\n\n\u003Cp>To explore further, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Flinearized-pdf.php\">pdfRest API Samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","658f28aa2d4014c9499b3be6","2023-12-29T20:14:34.000+00:00","2026-09-10T20:19:13.000+00:00","Learn how to use PHP to call the Linearize PDF API Tool from pdfRest to enable Fast Web View on your documents.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-php\u002F#article\",\n      \"headline\": \"How to Linearize PDF with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-php\u002F\",\n      \"datePublished\": \"2023-12-29T20:14:34.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:57.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use PHP to call the Linearize PDF API Tool from pdfRest to enable Fast Web View on your documents.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Linearize PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Flinearize-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Flinearized-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Flinearize-pdf\"\n        }\n      ],\n      \"keywords\": \"Linearize PDF, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Linearize PDF with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9436,9437,9438,9439],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1887,"name":1888,"slug":1889,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-linearize-pdf-with-php\u002F","How to Linearize a PDF with PHP, Tutorial | pdfRest",{"id":9444,"uuid":9445,"title":9446,"slug":9447,"html":9448,"comment_id":9449,"feature_image":48,"featured":284,"visibility":1257,"created_at":9450,"updated_at":9451,"published_at":9452,"custom_excerpt":48,"codeinjection_head":9453,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9454,"primary_tag":9459,"url":9460,"excerpt":9461,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9462,"meta_description":9463,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1350","82398a47-f9f8-43b6-a4d9-9a1ed35e72fb","How to Linearize PDF with Python","how-to-linearize-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Linearize PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Flinearize-pdf\u002F'>Linearize PDF API Tool\u003C\u002Fa> is designed to optimize PDF files for faster web viewing. Linearization, also known as \"web optimization\" or \"fast web view,\" restructures a PDF document so that its pages can be displayed one by one as they are downloaded, rather than waiting for the entire file to be downloaded. This is particularly useful for large PDFs that need to be viewed online, where users can start reading the PDF before the entire document has finished downloading.\u003C\u002Fp>\n\n\u003Cp>In this tutorial, we will demonstrate how to send an API call to the Linearize PDF endpoint using Python. This can be beneficial for developers who want to integrate PDF linearization into their web applications or services to enhance user experience.\u003C\u002Fp>\n\n\u003Ch2>Python Code for Linearization\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nlinearized_pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Flinearized-pdf'\n\n# The \u002Flinearized-pdf endpoint can take a single PDF file or id as input.\n# This sample demonstrates linearizing a PDF file.\nmp_encoder_linearizedPdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_linearizedPdf_out',\n    }\n)\n\n# Let's set the headers that the linearized-pdf endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_linearizedPdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to linearized-pdf endpoint...\")\nresponse = requests.post(linearized_pdf_endpoint_url, data=mp_encoder_linearizedPdf, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Flinearized-pdf.py\">pdf-rest-api-samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Python\u003C\u002Fh2>\n\n\u003Cp>The code block above demonstrates how to make a multipart\u002Fform-data POST request to the pdfRest Linearize PDF API endpoint using Python. Let's break down the key parts of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\u003C\u002Fpre>\n\n\u003Cp>This imports the necessary modules: \u003Ccode>MultipartEncoder\u003C\u002Fcode> for creating multipart-encoded files, \u003Ccode>requests\u003C\u002Fcode> for making HTTP requests, and \u003Ccode>json\u003C\u002Fcode> for handling JSON data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_linearizedPdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_linearizedPdf_out',\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>MultipartEncoder\u003C\u002Fcode> object is created with a dictionary specifying the fields to be sent. The 'file' field contains a tuple with the file name, the file object opened in binary read mode, and the MIME type. The 'output' field specifies the name of the output file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_linearizedPdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\n\u003C\u002Fpre>\n\n\u003Cp>Headers are set for the request, including the 'Accept' header indicating the response format, the 'Content-Type' header automatically set by the \u003Ccode>MultipartEncoder\u003C\u002Fcode>, and the 'Api-Key' header where you must insert your own API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(linearized_pdf_endpoint_url, data=mp_encoder_linearizedPdf, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>A POST request is sent to the linearized-pdf endpoint with the encoded data and headers. The response is stored in the \u003Ccode>response\u003C\u002Fcode> variable.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>If the request is successful, the JSON response is printed formatted. If not, the error text is printed.\u003C\u002Fp>\n\n\u003Ch2>So Much More with pdfRest\u003C\u002Fh2>\n\n\u003Cp>We have covered how to use Python to make an API call to the pdfRest Linearize PDF endpoint, including how to prepare the data, set the headers, and handle the response. This allows developers to easily integrate PDF linearization into their applications for a better user experience when viewing PDFs online.\u003C\u002Fp>\n\n\u003Cp>I encourage you to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for more information.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Flinearized-pdf.py\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","658071e92d4014c9499b39a4","2023-12-18T16:23:05.000+00:00","2026-09-02T18:29:02.000+00:00","2023-12-18T16:23:06.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Linearize PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-python\u002F\",\n      \"datePublished\": \"2023-12-18T16:23:06.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:59.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to enable Fast Web View with Python using the Linearize PDF API Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Linearize PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Flinearize-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Flinearized-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Flinearize-pdf\"\n        }\n      ],\n      \"keywords\": \"Linearize PDF, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Linearize PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-linearize-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9455,9456,9457,9458],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1887,"name":1888,"slug":1889,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-linearize-pdf-with-python\u002F","\n\n\n\n\nWhy Linearize PDF with Python?\n\n\n\nThe pdfRest Linearize PDF API Tool is designed to optimize PDF files for faster web viewing. Linearization, also known as \"web optimization\" or \"fast web view,\" restructures a PDF document so that its pages can be displayed one by one as they are downloaded, rather than waiting for the entire file to be downloaded. This is particularly useful for large PDFs that need to be viewed online, where users can start reading the PDF before the entire document has f","How to Linearize PDF with Python, Tutorial | pdfRest","Learn how to enable Fast Web View with Python using the Linearize PDF API Tool from pdfRest.",{"id":9465,"uuid":9466,"title":9467,"slug":9468,"html":9469,"comment_id":9465,"feature_image":48,"featured":284,"visibility":1257,"created_at":9470,"updated_at":9471,"published_at":9471,"custom_excerpt":9472,"codeinjection_head":9473,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9474,"primary_tag":9479,"url":9480,"excerpt":9472,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9481,"meta_description":9472,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a97640c533c9f26b943b7cc","027ccb96-df66-4249-8fba-8c44c98b9e3b","How to Merge Different File Formats Together as a PDF in .NET with C#","how-to-merge-different-file-formats-together-as-a-pdf-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Cp>In this tutorial, we'll use C# and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fmerge-pdfs\u002F\">Merge PDFs API Tool\u003C\u002Fa> to convert different file formats and merge them as one PDF. The complete Merge Different Formats Together as a PDF repository sample stays visible while we explain the request fields and response behavior a C# application must adapt safely.\u003C\u002Fp>\n\n\u003Ch2>Why Merge Different File Formats Together as a PDF in .NET with C#?\u003C\u002Fh2>\n\n\u003Cp>Mixed-format deliverables require a normalization step because Merge PDFs operates on PDF resources. The .NET flow converts each non-PDF source, reads its managed ID, and then assembles those outputs without saving intermediate files locally.\u003C\u002Fp>\n\n\u003Cp>For example, a project-delivery service may need to combine a PNG diagram with a PowerPoint briefing. The sample sends both files through \u003Ccode>\u002Fpdf\u003C\u002Fcode>, then passes their \u003Ccode>outputId\u003C\u002Fcode> values to \u003Ccode>\u002Fmerged-pdf\u003C\u002Fcode> to produce the ordered package.\u003C\u002Fp>\n\n\u003Cp>Each multipart group supplies an ID, input type, and page selection. Preserving the same order across those repeated fields is important because it defines both which resources participate and where their pages appear.\u003C\u002Fp>\n\n\u003Ch2>C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">\u002F*\n * What this sample does:\n * - Converts two different file types to PDF via multipart, then merges them.\n * - Routed from Program.cs as: `dotnet run -- merge-different-file-types \u003CimageFile> \u003CpptFile>`.\n *\n * Setup (environment):\n * - Copy .env.example to .env\n * - Set PDFREST_API_KEY=your_api_key_here\n * - Optional: set PDFREST_URL to override the API region. For EU\u002FGDPR compliance and proximity, use:\n *     PDFREST_URL=https:\u002F\u002Feu-api.pdfrest.com\n *   For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\n * Usage:\n *   dotnet run -- merge-different-file-types image.png slides.pptx\n *\n * Output:\n * - Prints JSON responses for the two pdf conversions and the final merge.\n *\u002F\n\nusing Newtonsoft.Json.Linq;\nusing System.Text;\n\nnamespace Samples.ComplexFlowExamples\n{\n    public static class MergeDifferentFileTypes\n    {\n        public static async Task Execute(string[] args)\n        {\n            if (args == null || args.Length \u003C 2)\n            {\n                Console.Error.WriteLine(\"merge-different-file-types requires \u003CimageFile> \u003CpptFile>\");\n                Environment.Exit(1);\n                return;\n            }\n\n            var imagePath = args[0];\n            var pptPath = args[1];\n            if (!File.Exists(imagePath) || !File.Exists(pptPath))\n            {\n                Console.Error.WriteLine(\"One or more input files not found.\");\n                Environment.Exit(1);\n                return;\n            }\n\n            var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\n            if (string.IsNullOrWhiteSpace(apiKey))\n            {\n                Console.Error.WriteLine(\"Missing required environment variable: PDFREST_API_KEY\");\n                Environment.Exit(1);\n                return;\n            }\n\n            var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n\n            using (var httpClient = new HttpClient { BaseAddress = new Uri(baseUrl) })\n            {\n                \u002F\u002F Begin first PDF conversion\n                using var imageRequest = new HttpRequestMessage(HttpMethod.Post, \"pdf\");\n                imageRequest.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\n                imageRequest.Headers.Accept.Add(new(\"application\u002Fjson\"));\n                var imageMultipartContent = new MultipartFormDataContent();\n\n                var imageByteArray = File.ReadAllBytes(imagePath);\n                var imageByteAryContent = new ByteArrayContent(imageByteArray);\n                imageMultipartContent.Add(imageByteAryContent, \"file\", Path.GetFileName(imagePath));\n                imageByteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Foctet-stream\");\n\n                imageRequest.Content = imageMultipartContent;\n                var imageResponse = await httpClient.SendAsync(imageRequest);\n\n                var imageResult = await imageResponse.Content.ReadAsStringAsync();\n                Console.WriteLine(\"Image to PDF response received.\");\n                Console.WriteLine(imageResult);\n\n                dynamic imageResponseData = JObject.Parse(imageResult);\n                string imageID = imageResponseData.outputId;\n\n                \u002F\u002F Begin second PDF conversion\n                using var powerpointRequest = new HttpRequestMessage(HttpMethod.Post, \"pdf\");\n                powerpointRequest.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\n                powerpointRequest.Headers.Accept.Add(new(\"application\u002Fjson\"));\n                var powerpointMultipartContent = new MultipartFormDataContent();\n\n                var powerpointByteArray = File.ReadAllBytes(pptPath);\n                var powerpointByteAryContent = new ByteArrayContent(powerpointByteArray);\n                powerpointMultipartContent.Add(powerpointByteAryContent, \"file\", Path.GetFileName(pptPath));\n                powerpointByteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Foctet-stream\");\n\n                powerpointRequest.Content = powerpointMultipartContent;\n                var powerpointResponse = await httpClient.SendAsync(powerpointRequest);\n\n                var powerpointResult = await powerpointResponse.Content.ReadAsStringAsync();\n                Console.WriteLine(\"powerpoint to PDF response received.\");\n                Console.WriteLine(powerpointResult);\n\n                dynamic powerpointResponseData = JObject.Parse(powerpointResult);\n                string powerpointID = powerpointResponseData.outputId;\n\n                \u002F\u002F Begin file merge\n                using var request = new HttpRequestMessage(HttpMethod.Post, \"merged-pdf\");\n                request.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\n                request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n                var multipartContent = new MultipartFormDataContent();\n\n                var imageByteArrayID = new ByteArrayContent(Encoding.UTF8.GetBytes(imageID));\n                multipartContent.Add(imageByteArrayID, \"id[]\");\n\n                var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"id\"));\n                multipartContent.Add(byteArrayOption, \"type[]\");\n                var byteArrayOption2 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"all\"));\n                multipartContent.Add(byteArrayOption2, \"pages[]\");\n\n                var powerpointByteArrayID = new ByteArrayContent(Encoding.UTF8.GetBytes(powerpointID));\n                multipartContent.Add(powerpointByteArrayID, \"id[]\");\n\n                var byteArrayOption3 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"id\"));\n                multipartContent.Add(byteArrayOption3, \"type[]\");\n                var byteArrayOption4 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"all\"));\n                multipartContent.Add(byteArrayOption4, \"pages[]\");\n\n                request.Content = multipartContent;\n                var response = await httpClient.SendAsync(request);\n                var apiResult = await response.Content.ReadAsStringAsync();\n\n                Console.WriteLine(\"Merge response received.\");\n                Console.WriteLine(apiResult);\n            }\n        }\n    }\n}\u003C\u002Fpre>\n\n\u003Cp>Source for Merge Different Formats Together as a PDF: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FComplex%20Flow%20Examples\u002Fmerge-different-file-types.cs\">View the C# sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the .NET request and JSON types\u003C\u002Fh3>\n\n\u003Cpre class=\"language-csharp\">using Newtonsoft.Json.Linq;\nusing System.Text;\u003C\u002Fpre>\n\n\u003Cp>The Merge Different Formats Together as a PDF sample uses .NET HTTP types for requests and \u003Ccode>Newtonsoft.Json.Linq\u003C\u002Fcode> for response parsing. Its supporting namespaces cover the text and multipart values needed by this C# Merge Different Formats Together as a PDF workflow.\u003C\u002Fp>\n\n\u003Ch3>Validate input and load runtime configuration\u003C\u002Fh3>\n\n\u003Cpre class=\"language-csharp\">Console.Error.WriteLine(\"One or more input files not found.\");\n                Environment.Exit(1);\n                return;\n            }\n\n            var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\n            if (string.IsNullOrWhiteSpace(apiKey))\n            {\n                Console.Error.WriteLine(\"Missing required environment variable: PDFREST_API_KEY\");\n                Environment.Exit(1);\n                return;\n            }\n\n            var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\u003C\u002Fpre>\n\n\u003Cp>The .NET Merge Different Formats Together as a PDF example reads \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode> and optionally \u003Ccode>PDFREST_URL\u003C\u002Fcode> from the environment. That arrangement keeps C# Merge Different Formats Together as a PDF credentials out of source and permits US or EU routing without recompilation.\u003C\u002Fp>\n\n\u003Ch3>Convert the first source and read its ID\u003C\u002Fh3>\n\n\u003Cpre class=\"language-csharp\">\u002F\u002F Begin first PDF conversion\n                using var imageRequest = new HttpRequestMessage(HttpMethod.Post, \"pdf\");\n                imageRequest.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\n                imageRequest.Headers.Accept.Add(new(\"application\u002Fjson\"));\n                var imageMultipartContent = new MultipartFormDataContent();\n\n                var imageByteArray = File.ReadAllBytes(imagePath);\n                var imageByteAryContent = new ByteArrayContent(imageByteArray);\n                imageMultipartContent.Add(imageByteAryContent, \"file\", Path.GetFileName(imagePath));\n                imageByteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Foctet-stream\");\n\n                imageRequest.Content = imageMultipartContent;\n                var imageResponse = await httpClient.SendAsync(imageRequest);\n\n                var imageResult = await imageResponse.Content.ReadAsStringAsync();\n                Console.WriteLine(\"Image to PDF response received.\");\n                Console.WriteLine(imageResult);\n\n                dynamic imageResponseData = JObject.Parse(imageResult);\n                string imageID = imageResponseData.outputId;\u003C\u002Fpre>\n\n\u003Cp>The first C# conversion sends the image to \u003Ccode>\u002Fpdf\u003C\u002Fcode> and captures its \u003Ccode>outputId\u003C\u002Fcode>. That ID becomes the first Merge Different Formats Together as a PDF input without an intermediate download back to C#.\u003C\u002Fp>\n\n\u003Ch3>Convert the presentation and read its ID\u003C\u002Fh3>\n\n\u003Cpre class=\"language-csharp\">\u002F\u002F Begin second PDF conversion\n                using var powerpointRequest = new HttpRequestMessage(HttpMethod.Post, \"pdf\");\n                powerpointRequest.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\n                powerpointRequest.Headers.Accept.Add(new(\"application\u002Fjson\"));\n                var powerpointMultipartContent = new MultipartFormDataContent();\n\n                var powerpointByteArray = File.ReadAllBytes(pptPath);\n                var powerpointByteAryContent = new ByteArrayContent(powerpointByteArray);\n                powerpointMultipartContent.Add(powerpointByteAryContent, \"file\", Path.GetFileName(pptPath));\n                powerpointByteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Foctet-stream\");\n\n                powerpointRequest.Content = powerpointMultipartContent;\n                var powerpointResponse = await httpClient.SendAsync(powerpointRequest);\n\n                var powerpointResult = await powerpointResponse.Content.ReadAsStringAsync();\n                Console.WriteLine(\"powerpoint to PDF response received.\");\n                Console.WriteLine(powerpointResult);\n\n                dynamic powerpointResponseData = JObject.Parse(powerpointResult);\n                string powerpointID = powerpointResponseData.outputId;\u003C\u002Fpre>\n\n\u003Cp>The second C# conversion repeats the normalization step for the presentation. The Merge Different Formats Together as a PDF workflow must receive this presentation \u003Ccode>outputId\u003C\u002Fcode> before C# constructs the complete merge request.\u003C\u002Fp>\n\n\u003Ch3>Build the ordered merge body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-csharp\">\u002F\u002F Begin file merge\n                using var request = new HttpRequestMessage(HttpMethod.Post, \"merged-pdf\");\n                request.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\n                request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n                var multipartContent = new MultipartFormDataContent();\n\n                var imageByteArrayID = new ByteArrayContent(Encoding.UTF8.GetBytes(imageID));\n                multipartContent.Add(imageByteArrayID, \"id[]\");\n\n                var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"id\"));\n                multipartContent.Add(byteArrayOption, \"type[]\");\n                var byteArrayOption2 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"all\"));\n                multipartContent.Add(byteArrayOption2, \"pages[]\");\n\n                var powerpointByteArrayID = new ByteArrayContent(Encoding.UTF8.GetBytes(powerpointID));\n                multipartContent.Add(powerpointByteArrayID, \"id[]\");\n\n                var byteArrayOption3 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"id\"));\n                multipartContent.Add(byteArrayOption3, \"type[]\");\n                var byteArrayOption4 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"all\"));\n                multipartContent.Add(byteArrayOption4, \"pages[]\");\n\n                request.Content = multipartContent;\n                var response = await httpClient.SendAsync(request);\n                var apiResult = await response.Content.ReadAsStringAsync();\n\n                Console.WriteLine(\"Merge response received.\");\n                Console.WriteLine(apiResult);\u003C\u002Fpre>\n\n\u003Cp>The C# merge body groups each resource ID with its input type and selected pages. Their repeated-field order controls how the converted sources appear in the Merge Different Formats Together as a PDF result returned to C#.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You have followed the complete C# sequence from source conversion through resource-ID handoff and final PDF assembly.\u003C\u002Fp>\n\n\u003Cp>Validate the HTTP and JSON result after each conversion instead of assuming that an \u003Ccode>outputId\u003C\u002Fcode> is present. Keep the source-to-ID mapping with the job so retries and diagnostics cannot silently reverse the intended merge order.\u003C\u002Fp>\n\n\u003Cp>Try the Merge Different Formats Together as a PDF workflow with a representative file in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, then adapt the request in C#. The \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fmerge-pdfs\u002F\">Merge PDFs API Tool documentation\u003C\u002Fa> provides the complete C# context for Merge Different Formats Together as a PDF values, defaults, and limitations.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T23:47:24.000+00:00","2026-09-03T17:04:40.000+00:00","Use .NET with C# to normalize two different file formats as PDFs and merge their resource IDs into one result.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Merge Different File Formats Together as a PDF in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-in-net-with-c\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Use .NET with C# to normalize two different file formats as PDFs and merge their resource IDs into one result.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Merge PDFs API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fmerge-pdfs\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fmerged-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fmerge-pdfs\"\n        }\n      ],\n      \"keywords\": \".NET, Merge PDFs\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Merge Different File Formats Together as a PDF in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9475,9476,9477,9478],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1595,"name":1596,"slug":1597,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-in-net-with-c\u002F","Merge Different File Formats Together as a PDF in .NET with C# | pdfRest",{"id":9483,"uuid":9484,"title":9485,"slug":9486,"html":9487,"comment_id":9483,"feature_image":48,"featured":284,"visibility":1257,"created_at":8835,"updated_at":9471,"published_at":9471,"custom_excerpt":9488,"codeinjection_head":9489,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9490,"primary_tag":9495,"url":9496,"excerpt":9488,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9497,"meta_description":9488,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a9750cd533c9f26b943b782","f8a8c241-1b9c-4507-9154-8adbfc1a1978","How to Merge Different File Formats Together as a PDF with cURL","how-to-merge-different-file-formats-together-as-a-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Cp>In this tutorial, we'll walk through how to merge different file formats together as a PDF using cURL and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fmerge-pdfs\u002F\">Merge PDFs API Tool\u003C\u002Fa>. The complete shell command stays visible, and each pdfRest-specific field is explained before you adapt the Merge Different Formats Together as a PDF request to your own workflow.\u003C\u002Fp>\n\n\u003Ch2>Why Merge Different File Formats Together as a PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>Business packets often combine images, presentations, office documents, and existing PDFs even though Merge PDFs accepts PDF inputs. Converting each non-PDF source first provides a common representation that can be assembled in a controlled order.\u003C\u002Fp>\n\n\u003Cp>A project-delivery script might receive a PNG diagram and a PowerPoint briefing. The sample converts both files through \u003Ccode>\u002Fpdf\u003C\u002Fcode>, captures their output IDs, and submits those IDs to \u003Ccode>\u002Fmerged-pdf\u003C\u002Fcode> to create one deliverable.\u003C\u002Fp>\n\n\u003Cp>The example uses \u003Ccode>jq\u003C\u002Fcode> to read each \u003Ccode>outputId\u003C\u002Fcode> from JSON. Keeping the IDs in shell variables avoids downloading and uploading the intermediate PDFs between API calls.\u003C\u002Fp>\n\n\u003Ch2>cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">#!\u002Fbin\u002Fsh\n\n# In this sample, we will show how to merge different file types together as\n# discussed in https:\u002F\u002Fpdfrest.com\u002Fsolutions\u002Fmerge-multiple-types-of-files-together\u002F.\n# First, we will upload an image file to the \u002Fpdf route and capture the output ID.\n# Next, we will upload a PowerPoint file to the \u002Fpdf route and capture its output\n# ID. Finally, we will pass both IDs to the \u002Fmerged-pdf route to combine both inputs\n# into a single PDF.\n#\n# Note that there is nothing special about an image and a PowerPoint file, and\n# this sample could be easily used to convert and combine any two file types\n# that the \u002Fpdf route takes as inputs.\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\nAPI_KEY=\"xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" # place your api key here\n\nIMAGE_ID=$(curl -X POST \"$API_URL\u002Fpdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: $API_KEY\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile.png\" \\\n  -F \"output=example_out\" \\\n  | jq -r '.outputId')\n\n\nPPT_ID=$(curl -X POST \"$API_URL\u002Fpdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: $API_KEY\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Fpowerpoint.ppt\" \\\n  -F \"output=example_out\" \\\n  | jq -r '.outputId')\n\n\ncurl -X POST \"$API_URL\u002Fmerged-pdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: $API_KEY\" \\\n  -F \"id=$IMAGE_ID\" \\\n  -F \"pages[]=all\" -F \"type[]=id\" \\\n  -F \"id=$PPT_ID\" \\\n  -F \"pages[]=all\" -F \"type[]=id\" \\\n  -F \"output=example_out\"\u003C\u002Fpre>\n\n\u003Cp>Source for Merge Different Formats Together as a PDF: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FComplex%20Flow%20Examples\u002Fmerge-different-file-types.sh\">View the cURL sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Choose the pdfRest service region\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>The active \u003Ccode>API_URL\u003C\u002Fcode> uses the US service. The commented alternative switches the whole multi-request workflow to the EU service without changing any endpoint paths.\u003C\u002Fp>\n\n\u003Ch3>Keep the API key available for every stage\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">API_KEY=\"xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" # place your api key here\u003C\u002Fpre>\n\n\u003Cp>The same placeholder credential is reused for both conversions and the final merge. Replace it securely at runtime rather than committing a real API key to the script.\u003C\u002Fp>\n\n\u003Ch3>Convert the image and capture its PDF resource ID\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">IMAGE_ID=$(curl -X POST \"$API_URL\u002Fpdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: $API_KEY\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile.png\" \\\n  -F \"output=example_out\" \\\n  | jq -r '.outputId')\u003C\u002Fpre>\n\n\u003Cp>The first command uploads a PNG to Convert to PDF. Command substitution assigns the resulting \u003Ccode>outputId\u003C\u002Fcode> to \u003Ccode>IMAGE_ID\u003C\u002Fcode>, and \u003Ccode>jq -r\u003C\u002Fcode> returns the string without JSON quotes.\u003C\u002Fp>\n\n\u003Ch3>Convert the presentation and retain its output ID\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">PPT_ID=$(curl -X POST \"$API_URL\u002Fpdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: $API_KEY\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Fpowerpoint.ppt\" \\\n  -F \"output=example_out\" \\\n  | jq -r '.outputId')\u003C\u002Fpre>\n\n\u003Cp>The second conversion repeats the pattern for PowerPoint. Nothing is downloaded between steps because pdfRest can accept the managed output ID directly in the merge request.\u003C\u002Fp>\n\n\u003Ch3>Merge the converted resources in order\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"$API_URL\u002Fmerged-pdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: $API_KEY\" \\\n  -F \"id=$IMAGE_ID\" \\\n  -F \"pages[]=all\" -F \"type[]=id\" \\\n  -F \"id=$PPT_ID\" \\\n  -F \"pages[]=all\" -F \"type[]=id\" \\\n  -F \"output=example_out\"\u003C\u002Fpre>\n\n\u003Cp>Each group of \u003Ccode>id\u003C\u002Fcode>, \u003Ccode>pages[]\u003C\u002Fcode>, and \u003Ccode>type[]\u003C\u002Fcode> fields describes one merge input. Their order in the multipart request controls the order of content in the final PDF.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This complete flow shows how cURL can orchestrate conversion and merging across several API calls while passing managed resource IDs between stages.\u003C\u002Fp>\n\n\u003Cp>Check every conversion response before starting the merge, and associate each ID with its original filename so ordering remains explicit. Save the final PDF and clean up intermediate resources according to the workflow retention policy.\u003C\u002Fp>\n\n\u003Cp>Continue exploring the Merge Different Formats Together as a PDF workflow in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the complete Merge Different Formats Together as a PDF request contract, accepted values, defaults, and limitations, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fmerge-pdfs\u002F\">Merge PDFs API Tool documentation\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Learn how to convert different source formats and merge the resulting PDF resources in one cURL workflow.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Merge Different File Formats Together as a PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-curl\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to convert different source formats and merge the resulting PDF resources in one cURL workflow.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Merge PDFs API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fmerge-pdfs\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fmerged-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fmerge-pdfs\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to PowerPoint API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-powerpoint\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpowerpoint API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-microsoft-powerpoint\"\n        }\n      ],\n      \"keywords\": \"Merge PDFs, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Merge Different File Formats Together as a PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9491,9492,9493,9494],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1595,"name":1596,"slug":1597,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-curl\u002F","How to Merge Different File Formats Together as a PDF with cURL, Tutorial | pdfRest",{"id":9499,"uuid":9500,"title":9501,"slug":9502,"html":9503,"comment_id":9499,"feature_image":48,"featured":284,"visibility":1257,"created_at":9504,"updated_at":9451,"published_at":9505,"custom_excerpt":9506,"codeinjection_head":9507,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9508,"primary_tag":9513,"url":9514,"excerpt":9506,"reading_time":394,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9515,"meta_description":9506,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c60533c9f26b943b591","bbf8f10a-c585-44a9-b736-bb4a1c98f0ed","How to Merge Different File Formats Together as a PDF with Java","how-to-merge-different-file-formats-together-as-a-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>By the end of this tutorial, you'll know how to merge different file formats together as a PDF with Java and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fmerge-pdfs\u002F\">Merge PDFs API Tool\u003C\u002Fa>. The multi-step code converts each non-PDF source, collects the resulting resource IDs, and sends them to Merge PDFs in the intended order. We'll explain the important request pieces so you can use the sample as the foundation for an integration that can merge different file formats together as a PDF.\u003C\u002Fp>\n\n\u003Ch2>Why Merge Different File Formats Together as a PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>A project package may combine a diagram image, presentation, and other source documents. Converting each input and passing their resource IDs into Merge PDFs produces one ordered deliverable.\u003C\u002Fp>\n\n\u003Cp>The Complex Flow example calls \u003Ccode>\u002Fpdf\u003C\u002Fcode> for each non-PDF input, reads each \u003Ccode>outputId\u003C\u002Fcode>, then supplies those IDs and page ranges to \u003Ccode>\u002Fmerged-pdf\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\n\u002F* In this sample, we will show how to merge different file types together as\n* discussed in https:\u002F\u002Fpdfrest.com\u002Fsolutions\u002Fmerge-multiple-types-of-files-together\u002F.\nFirst, we will upload an image file to the \u002Fpdf route and capture the output ID.\n* Next, we will upload a PowerPoint file to the \u002Fpdf route and capture its output\n* ID. Finally, we will pass both IDs to the \u002Fmerged-pdf route to combine both inputs\n* into a single PDF.\n*\n* Note that there is nothing special about an image and a PowerPoint file, and\n* this sample could be easily used to convert and combine any two file types\n* that the \u002Fpdf route takes as inputs.\n*\u002F\n\npublic class MergeDifferentFileTypes {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your first file here, or as the first argument when running the program.\n  private static final String DEFAULT_FIRST_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.png\";\n\n  \u002F\u002F Specify the path to your second file here, or as the second argument when running the\n  \u002F\u002F program.\n  private static final String DEFAULT_SECOND_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.ppt\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File firstFile, secondFile;\n    if (args.length > 1) {\n      firstFile = new File(args[0]);\n      secondFile = new File(args[1]);\n    } else {\n      firstFile = new File(DEFAULT_FIRST_FILE_PATH);\n      secondFile = new File(DEFAULT_SECOND_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody firstFileInputFileRequestBody =\n        RequestBody.create(firstFile, MediaType.parse(\"application\u002Fpng\"));\n    RequestBody firstFileRequestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", firstFile.getName(), firstFileInputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_pdf\")\n            .build();\n    Request firstFileRequest =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf\")\n            .post(firstFileRequestBody)\n            .build();\n    try {\n      OkHttpClient firstFileClient =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response firstFileResponse = firstFileClient.newCall(firstFileRequest).execute();\n\n      System.out.println(\"Result code from first PDF call: \" + firstFileResponse.code());\n      if (firstFileResponse.body() != null) {\n        String firstFileResponseString = firstFileResponse.body().string();\n\n        JSONObject firstFileJSON = new JSONObject(firstFileResponseString);\n        if (firstFileJSON.has(\"error\")) {\n          System.out.println(\"Error during first PDF call: \" + firstFileResponse.body().string());\n          return;\n        }\n\n        String firstFileID = firstFileJSON.get(\"outputId\").toString();\n\n        final RequestBody secondFileInputFileRequestBody =\n            RequestBody.create(secondFile, MediaType.parse(\"application\u002Fpowerpoint\"));\n        RequestBody secondFileRequestBody =\n            new MultipartBody.Builder()\n                .setType(MultipartBody.FORM)\n                .addFormDataPart(\"file\", secondFile.getName(), secondFileInputFileRequestBody)\n                .addFormDataPart(\"output\", \"pdfrest_pdf\")\n                .build();\n        Request secondFileRequest =\n            new Request.Builder()\n                .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n                .url(API_URL + \"\u002Fpdf\")\n                .post(secondFileRequestBody)\n                .build();\n        try {\n          OkHttpClient secondFileClient =\n              new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n          Response secondFileResponse = secondFileClient.newCall(secondFileRequest).execute();\n\n          System.out.println(\"Result code from second PDF call: \" + secondFileResponse.code());\n          if (secondFileResponse.body() != null) {\n            String secondFileResponseString = secondFileResponse.body().string();\n\n            JSONObject secondFileJSON = new JSONObject(secondFileResponseString);\n            if (secondFileJSON.has(\"error\")) {\n              System.out.println(\n                  \"Error during second PDF call: \" + secondFileResponse.body().string());\n              return;\n            }\n\n            String secondFileID = secondFileJSON.get(\"outputId\").toString();\n\n            RequestBody mergeRequestBody =\n                new MultipartBody.Builder()\n                    .setType(MultipartBody.FORM)\n                    .addFormDataPart(\"id[]\", firstFileID)\n                    .addFormDataPart(\"id[]\", secondFileID)\n                    .addFormDataPart(\"type[]\", \"id\")\n                    .addFormDataPart(\"type[]\", \"id\")\n                    .addFormDataPart(\"pages[]\", \"1-last\")\n                    .addFormDataPart(\"pages[]\", \"1-last\")\n                    .addFormDataPart(\"output\", \"pdfrest_merged\")\n                    .build();\n            Request mergeRequest =\n                new Request.Builder()\n                    .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n                    .url(API_URL + \"\u002Fmerged-pdf\")\n                    .post(mergeRequestBody)\n                    .build();\n            try {\n              OkHttpClient mergeClient =\n                  new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n              Response mergeResponse = mergeClient.newCall(mergeRequest).execute();\n              System.out.println(\"Result code from merge call: \" + mergeResponse.code());\n              if (mergeResponse.body() != null) {\n                System.out.println(prettyJson(mergeResponse.body().string()));\n              }\n            } catch (IOException e) {\n              throw new RuntimeException(e);\n            }\n          }\n        } catch (IOException e) {\n          throw new RuntimeException(e);\n        }\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FComplex%20Flow%20Examples\u002FMergeDifferentFileTypes.java\">Java sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The supporting code uses OkHttp for transport, dotenv for loading \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode>, and \u003Ccode>org.json\u003C\u002Fcode> for structured request or response data.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your first file here, or as the first argument when running the program.\n  private static final String DEFAULT_FIRST_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.png\";\n\n  \u002F\u002F Specify the path to your second file here, or as the second argument when running the\n  \u002F\u002F program.\n  private static final String DEFAULT_SECOND_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.ppt\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File firstFile, secondFile;\n    if (args.length > 1) {\n      firstFile = new File(args[0]);\n      secondFile = new File(args[1]);\n    } else {\n      firstFile = new File(DEFAULT_FIRST_FILE_PATH);\u003C\u002Fpre>\n\n\u003Cp>The complex-flow setup accepts several source paths, then loads one API key that is reused across every conversion and merge request.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody firstFileInputFileRequestBody =\n        RequestBody.create(firstFile, MediaType.parse(\"application\u002Fpng\"));\n    RequestBody firstFileRequestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", firstFile.getName(), firstFileInputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_pdf\")\n            .build();\n    Request firstFileRequest =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf\")\n            .post(firstFileRequestBody)\n            .build();\n    try {\n      OkHttpClient firstFileClient =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The Complex Flow example calls \u003Ccode>\u002Fpdf\u003C\u002Fcode> for each non-PDF input, reads each \u003Ccode>outputId\u003C\u002Fcode>, then supplies those IDs and page ranges to \u003Ccode>\u002Fmerged-pdf\u003C\u002Fcode>. The body construction uses the form multipart type required for combining uploaded content with operation parameters.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request firstFileRequest =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf\")\n            .post(firstFileRequestBody)\n            .build();\n    try {\n      OkHttpClient firstFileClient =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>This builder chain ties the body to its endpoint and applies the required \u003Ccode>Api-Key\u003C\u002Fcode> header before OkHttp sends it.\u003C\u002Fp>\n\n\u003Ch3>Pass resources between workflow stages\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">if (firstFileJSON.has(\"error\")) {\n          System.out.println(\"Error during first PDF call: \" + firstFileResponse.body().string());\n          return;\n        }\n\n        String firstFileID = firstFileJSON.get(\"outputId\").toString();\n\n        final RequestBody secondFileInputFileRequestBody =\n            RequestBody.create(secondFile, MediaType.parse(\"application\u002Fpowerpoint\"));\n        RequestBody secondFileRequestBody =\n            new MultipartBody.Builder()\n                .setType(MultipartBody.FORM)\n                .addFormDataPart(\"file\", secondFile.getName(), secondFileInputFileRequestBody)\n                .addFormDataPart(\"output\", \"pdfrest_pdf\")\n                .build();\n        Request secondFileRequest =\u003C\u002Fpre>\n\n\u003Cp>In the Merge Different Formats Together as a PDF workflow, Java reads the generated resource ID from one response and supplies it to the next endpoint, avoiding a download and another upload of the intermediate file.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">OkHttpClient firstFileClient =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response firstFileResponse = firstFileClient.newCall(firstFileRequest).execute();\n\n      System.out.println(\"Result code from first PDF call: \" + firstFileResponse.code());\n      if (firstFileResponse.body() != null) {\n        String firstFileResponseString = firstFileResponse.body().string();\n\n        JSONObject firstFileJSON = new JSONObject(firstFileResponseString);\n        if (firstFileJSON.has(\"error\")) {\n          System.out.println(\"Error during first PDF call: \" + firstFileResponse.body().string());\n          return;\n        }\n\n        String firstFileID = firstFileJSON.get(\"outputId\").toString();\u003C\u002Fpre>\n\n\u003Cp>This completion path uses both status and body to distinguish a successful resource from validation or processing failures.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By working through this example, you now have a Java pattern you can use to merge different file formats together as a PDF. With that foundation, you can extend the workflow to assemble submissions, onboarding packets, reports, and mixed-format evidence collections.\u003C\u002Fp>\n\n\u003Cp>When this becomes part of an application, make source order and page ranges explicit rather than relying on filesystem or upload order. Track intermediate IDs so failed conversions can be diagnosed and successful resources can be reused or deleted according to the application’s retention policy.\u003C\u002Fp>\n\n\u003Cp>\u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> lets you try the Merge Different Formats Together as a PDF operation without first building an application. When you are ready to implement it, see the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fmerge-pdfs\u002F\">Merge PDFs API Tool documentation\u003C\u002Fa> for the complete API contract.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T17:33:20.000+00:00","2026-09-01T21:57:40.000+00:00","Convert different source formats and merge the resulting PDFs in one Java workflow.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Merge Different File Formats Together as a PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:40.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:40.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert different source formats and merge the resulting PDFs in one Java workflow.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Merge PDFs API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fmerge-pdfs\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fmerged-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fmerge-pdfs\"\n        }\n      ],\n      \"keywords\": \"Java, Merge PDFs\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Merge Different File Formats Together as a PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9509,9510,9511,9512],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1595,"name":1596,"slug":1597,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-java\u002F","Merge Different File Formats Together as a PDF with Java | pdfRest",{"id":9517,"uuid":9518,"title":9519,"slug":9520,"html":9521,"comment_id":9517,"feature_image":48,"featured":284,"visibility":1257,"created_at":9470,"updated_at":9471,"published_at":9471,"custom_excerpt":9522,"codeinjection_head":9523,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9524,"primary_tag":9529,"url":9530,"excerpt":9522,"reading_time":369,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9531,"meta_description":9522,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a97640c533c9f26b943b7c3","01660ccf-103a-4751-b559-00d4a8bf7e24","How to Merge Different File Formats Together as a PDF with JavaScript in NodeJS","how-to-merge-different-file-formats-together-as-a-pdf-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Cp>Learn how to convert different file formats and merge them as one PDF using JavaScript in NodeJS and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fmerge-pdfs\u002F\">Merge PDFs API Tool\u003C\u002Fa>. This Merge Different Formats Together as a PDF tutorial keeps the official sample intact and breaks down authentication, payload construction, endpoint behavior, and result handling for JavaScript in NodeJS.\u003C\u002Fp>\n\n\u003Ch2>Why Merge Different File Formats Together as a PDF with JavaScript in NodeJS?\u003C\u002Fh2>\n\n\u003Cp>Applications frequently need to assemble a single PDF from source files that cannot be merged directly. A conversion stage normalizes each image, presentation, or office document before Merge PDFs combines the results.\u003C\u002Fp>\n\n\u003Cp>A NodeJS onboarding service might collect an identity image and a presentation-style orientation guide. By retaining the \u003Ccode>outputId\u003C\u002Fcode> from each \u003Ccode>\u002Fpdf\u003C\u002Fcode> response, it can submit both managed resources to \u003Ccode>\u002Fmerged-pdf\u003C\u002Fcode> in the desired sequence.\u003C\u002Fp>\n\n\u003Cp>The nested promise chain in the sample enforces the dependency between steps: presentation conversion starts after image conversion, and merging starts only after both IDs exist. A production service may express the same dependency with \u003Ccode>async\u003C\u002Fcode>\u002F\u003Ccode>await\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Ch2>JavaScript in NodeJS Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\n\n\u002F* In this sample, we will show how to merge different file types together as\n* discussed in https:\u002F\u002Fpdfrest.com\u002Fsolutions\u002Fmerge-multiple-types-of-files-together\u002F.\nFirst, we will upload an image file to the \u002Fpdf route and capture the output ID.\n* Next, we will upload a PowerPoint file to the \u002Fpdf route and capture its output\n* ID. Finally, we will pass both IDs to the \u002Fmerged-pdf route to combine both inputs\n* into a single PDF.\n*\n* Note that there is nothing special about an image and a PowerPoint file, and\n* this sample could be easily used to convert and combine any two file types\n* that the \u002Fpdf route takes as inputs.\n*\u002F\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\nvar apiKey = \"xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"; \u002F\u002F Replace with your API key\n\nvar imageData = new FormData();\nimageData.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Fimage.png\"));\n\nvar imageConfig = {\n  method: \"post\",\n  maxBodyLength: Infinity,\n  url: apiUrl + \"\u002Fpdf\",\n  headers: {\n    \"Api-Key\": apiKey,\n    ...imageData.getHeaders(),\n  },\n  data: imageData,\n};\n\naxios(imageConfig)\n  .then(function (response) {\n    var imagePDFID = response.data.outputId;\n\n    var pptData = new FormData();\n    pptData.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Fpowerpoint.ppt\"));\n\n    var pptConfig = {\n      method: \"post\",\n      maxBodyLength: Infinity,\n      url: apiUrl + \"\u002Fpdf\",\n      headers: {\n        \"Api-Key\": apiKey,\n        ...pptData.getHeaders(),\n      },\n      data: pptData,\n    };\n\n    axios(pptConfig)\n      .then(function (response) {\n        var pptPDFID = response.data.outputId;\n\n        var mergeData = new FormData();\n        mergeData.append(\"id\", imagePDFID);\n        mergeData.append(\"pages[]\", \"1-last\");\n        mergeData.append(\"type[]\", \"id\");\n        mergeData.append(\"id\", pptPDFID);\n        mergeData.append(\"pages[]\", \"1-last\");\n        mergeData.append(\"type[]\", \"id\");\n        mergeData.append(\"output\", \"pdfrest_merged_pdf\");\n\n        var mergeConfig = {\n          method: \"post\",\n          maxBodyLength: Infinity,\n          url: apiUrl + \"\u002Fmerged-pdf\",\n          headers: {\n            \"Api-Key\": apiKey,\n            ...mergeData.getHeaders(),\n          },\n          data: mergeData,\n        };\n\n        axios(mergeConfig)\n          .then(function (response) {\n            console.log(JSON.stringify(response.data)); \u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample\n          })\n          .catch(function (error) {\n            console.log(error);\n          });\n      })\n      .catch(function (error) {\n        console.log(error);\n      });\n  })\n  .catch(function (error) {\n    console.log(error);\n  });\u003C\u002Fpre>\n\n\u003Cp>Source for Merge Different Formats Together as a PDF: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FComplex%20Flow%20Examples\u002Fmerge-different-file-types.js\">View the JavaScript in NodeJS sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the NodeJS request and file modules\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\u003C\u002Fpre>\n\n\u003Cp>Axios sends the HTTP calls for Merge Different Formats Together as a PDF, \u003Ccode>FormData\u003C\u002Fcode> constructs multipart bodies when needed, and Node's \u003Ccode>fs\u003C\u002Fcode> module opens local files as streams. Together, these packages provide the transport and file handling required by the JavaScript Merge Different Formats Together as a PDF sample.\u003C\u002Fp>\n\n\u003Ch3>Select the pdfRest service region\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\nvar apiKey = \"xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"; \u002F\u002F Replace with your API key\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>apiUrl\u003C\u002Fcode> centralizes regional routing for Merge Different Formats Together as a PDF. The NodeJS Merge Different Formats Together as a PDF flow can switch to the documented EU hostname without changing the endpoint paths that follow.\u003C\u002Fp>\n\n\u003Ch3>Convert the image and capture its ID\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">var imageData = new FormData();\nimageData.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Fimage.png\"));\n\nvar imageConfig = {\n  method: \"post\",\n  maxBodyLength: Infinity,\n  url: apiUrl + \"\u002Fpdf\",\n  headers: {\n    \"Api-Key\": apiKey,\n    ...imageData.getHeaders(),\n  },\n  data: imageData,\n};\n\naxios(imageConfig)\n  .then(function (response) {\n    var imagePDFID = response.data.outputId;\u003C\u002Fpre>\n\n\u003Cp>The first JavaScript in NodeJS conversion sends the image to \u003Ccode>\u002Fpdf\u003C\u002Fcode> and captures its \u003Ccode>outputId\u003C\u002Fcode>. That ID becomes the first Merge Different Formats Together as a PDF input without an intermediate download back to JavaScript in NodeJS.\u003C\u002Fp>\n\n\u003Ch3>Convert the presentation after the first response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">var pptData = new FormData();\n    pptData.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Fpowerpoint.ppt\"));\n\n    var pptConfig = {\n      method: \"post\",\n      maxBodyLength: Infinity,\n      url: apiUrl + \"\u002Fpdf\",\n      headers: {\n        \"Api-Key\": apiKey,\n        ...pptData.getHeaders(),\n      },\n      data: pptData,\n    };\n\n    axios(pptConfig)\n      .then(function (response) {\n        var pptPDFID = response.data.outputId;\u003C\u002Fpre>\n\n\u003Cp>The second JavaScript in NodeJS conversion repeats the normalization step for the presentation. The Merge Different Formats Together as a PDF workflow must receive this presentation \u003Ccode>outputId\u003C\u002Fcode> before JavaScript in NodeJS constructs the complete merge request.\u003C\u002Fp>\n\n\u003Ch3>Build the ordered merge payload\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">var mergeData = new FormData();\n        mergeData.append(\"id\", imagePDFID);\n        mergeData.append(\"pages[]\", \"1-last\");\n        mergeData.append(\"type[]\", \"id\");\n        mergeData.append(\"id\", pptPDFID);\n        mergeData.append(\"pages[]\", \"1-last\");\n        mergeData.append(\"type[]\", \"id\");\n        mergeData.append(\"output\", \"pdfrest_merged_pdf\");\n\n        var mergeConfig = {\n          method: \"post\",\n          maxBodyLength: Infinity,\n          url: apiUrl + \"\u002Fmerged-pdf\",\n          headers: {\n            \"Api-Key\": apiKey,\n            ...mergeData.getHeaders(),\n          },\n          data: mergeData,\n        };\u003C\u002Fpre>\n\n\u003Cp>The JavaScript in NodeJS merge body groups each resource ID with its input type and selected pages. Their repeated-field order controls how the converted sources appear in the Merge Different Formats Together as a PDF result returned to JavaScript in NodeJS.\u003C\u002Fp>\n\n\u003Ch3>Read the final merge response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">axios(mergeConfig)\n          .then(function (response) {\n            console.log(JSON.stringify(response.data)); \u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample\n          })\n          .catch(function (error) {\n            console.log(error);\n          });\u003C\u002Fpre>\n\n\u003Cp>The final Merge Different Formats Together as a PDF handling in JavaScript in NodeJS exposes the HTTP result and JSON body. Before using a Merge Different Formats Together as a PDF output or request ID, production JavaScript in NodeJS code should verify the status and retain the identifier required by the next step.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You have followed the complete JavaScript in NodeJS sequence from source conversion through resource-ID handoff and final PDF assembly.\u003C\u002Fp>\n\n\u003Cp>Handle failure independently at each stage and record which source produced each ID. Intermediate resources are temporary, so complete the merge and retain the final result within the configured file-retention period.\u003C\u002Fp>\n\n\u003Cp>Try the Merge Different Formats Together as a PDF workflow with a representative file in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, then adapt the request in JavaScript in NodeJS. The \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fmerge-pdfs\u002F\">Merge PDFs API Tool documentation\u003C\u002Fa> provides the complete JavaScript in NodeJS context for Merge Different Formats Together as a PDF values, defaults, and limitations.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Build a NodeJS workflow that converts mixed file types to PDF and merges the resulting resources into one document.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Merge Different File Formats Together as a PDF with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Build a NodeJS workflow that converts mixed file types to PDF and merges the resulting resources into one document.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Merge PDFs API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fmerge-pdfs\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fmerged-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fmerge-pdfs\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to PowerPoint API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-powerpoint\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpowerpoint API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-microsoft-powerpoint\"\n        }\n      ],\n      \"keywords\": \"JavaScript, Merge PDFs\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Merge Different File Formats Together as a PDF with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9525,9526,9527,9528],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1595,"name":1596,"slug":1597,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-javascript-in-nodejs\u002F","Merge Different File Formats Together as a PDF with JavaScript in NodeJS | pdfRest",{"id":9533,"uuid":9534,"title":9535,"slug":9536,"html":9537,"comment_id":9533,"feature_image":48,"featured":284,"visibility":1257,"created_at":9470,"updated_at":9471,"published_at":9471,"custom_excerpt":9538,"codeinjection_head":9539,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9540,"primary_tag":9545,"url":9546,"excerpt":9538,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9547,"meta_description":9538,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a97640c533c9f26b943b7ba","0db9d1f0-1674-4c4c-bdfe-9c99c45c4183","How to Merge Different File Formats Together as a PDF with PHP","how-to-merge-different-file-formats-together-as-a-pdf-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This step-by-step guide demonstrates how to convert different file formats and merge them as one PDF from a PHP application through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fmerge-pdfs\u002F\">Merge PDFs API Tool\u003C\u002Fa>. Along the way, we'll distinguish the PHP syntax from the Merge Different Formats Together as a PDF API contract and show how its returned data supports the next step.\u003C\u002Fp>\n\n\u003Ch2>Why Merge Different File Formats Together as a PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>Merge PDFs accepts PDF inputs, while real business packets often begin as a mixture of images, presentations, and existing documents. Converting the non-PDF sources first gives every item a common format for ordered assembly.\u003C\u002Fp>\n\n\u003Cp>A PHP claims system could receive a damage photograph and a PowerPoint assessment from different contributors. The sample converts each source through Convert to PDF, captures both output IDs, and merges them into one review packet without transferring the intermediate PDFs back to the application.\u003C\u002Fp>\n\n\u003Cp>This is a three-request workflow rather than a single conversion call. Each conversion must succeed before its resource ID is added to the merge payload, and the order of those payload groups determines the order in the final document.\u003C\u002Fp>\n\n\u003Ch2>PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n\u002F* In this sample, we will show how to merge different file types together as\n* discussed in https:\u002F\u002Fpdfrest.com\u002Fsolutions\u002Fmerge-multiple-types-of-files-together\u002F.\n* First, we will upload an image file to the \u002Fpdf route and capture the output ID.\n* Next, we will upload a PowerPoint file to the \u002Fpdf route and capture its output\n* ID. Finally, we will pass both IDs to the \u002Fmerged-pdf route to combine both inputs\n* into a single PDF.\n*\n* Note that there is nothing special about an image and a PowerPoint file, and\n* this sample could be easily used to convert and combine any two file types\n* that the \u002Fpdf route takes as inputs.\n*\u002F\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' => 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\n$imageToPDFOptions = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Fimage.png', 'r'),\n      'filename' => 'image.png',\n      'headers' => [\n        'Content-Type' => '\u003CContent-type header>'\n      ]\n    ]\n  ]\n];\n\n$imageToPDFRequest = new Request('POST', $apiUrl.'\u002Fpdf', $headers);\n\n$imageToPDFResponse = $client->sendAsync($imageToPDFRequest, $imageToPDFOptions)->wait();\n\n$convertedImageID = json_decode($imageToPDFResponse->getBody())->{'outputId'};\n\n\n\n$powerpointToPDFOptions = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Fpowerpoint.ppt', 'r'),\n      'filename' => 'powerpoint.ppt',\n      'headers' => [\n        'Content-Type' => '\u003CContent-type header>'\n      ]\n    ]\n  ]\n];\n\n$powerpointToPDFRequest = new Request('POST', $apiUrl.'\u002Fpdf', $headers);\n\n$powerpointToPDFResponse = $client->sendAsync($powerpointToPDFRequest, $powerpointToPDFOptions)->wait();\n\n$convertedPowerpointID = json_decode($powerpointToPDFResponse->getBody())->{'outputId'};\n\n\n$mergeOptions = [\n  'multipart' => [\n    [\n      'name' => 'id[]',\n      'contents' => $convertedImageID\n    ],\n    [\n      'name' => 'pages[]',\n      'contents' => '1-last'\n    ],\n    [\n      'name' => 'type[]',\n      'contents' => 'id'\n    ],\n    [\n      'name' => 'id[]',\n      'contents' => $convertedPowerpointID\n\n    ],\n    [\n      'name' => 'pages[]',\n      'contents' => '1-last'\n    ],\n    [\n      'name' => 'type[]',\n      'contents' => 'id'\n    ]\n  ]\n];\n\n$mergeRequest = new Request('POST', $apiUrl.'\u002Fmerged-pdf', $headers);\n\n$mergeResponse = $client->sendAsync($mergeRequest, $mergeOptions)->wait();\n\necho $mergeResponse->getBody();\u003C\u002Fpre>\n\n\u003Cp>Source for Merge Different Formats Together as a PDF: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FComplex%20Flow%20Examples\u002Fmerge-different-file-types.php\">View the PHP sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load Guzzle and its stream helpers\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\u003C\u002Fpre>\n\n\u003Cp>Guzzle supplies the HTTP client and PSR-7 request objects used throughout the Merge Different Formats Together as a PDF example. For this PHP Merge Different Formats Together as a PDF flow, \u003Ccode>Utils::tryFopen\u003C\u002Fcode> creates readable multipart streams without loading every uploaded byte into one string.\u003C\u002Fp>\n\n\u003Ch3>Select the pdfRest service region\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n$client = new Client();\u003C\u002Fpre>\n\n\u003Cp>The active \u003Ccode>$apiUrl\u003C\u002Fcode> selects the US service for Merge Different Formats Together as a PDF; the commented assignment shows the EU alternative. Keep the PHP uploads, request IDs, and generated resources for Merge Different Formats Together as a PDF on that same regional host.\u003C\u002Fp>\n\n\u003Ch3>Convert the image to PDF\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">$imageToPDFOptions = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Fimage.png', 'r'),\n      'filename' => 'image.png',\n      'headers' => [\n        'Content-Type' => '\u003CContent-type header>'\n      ]\n    ]\n  ]\n];\n\n$imageToPDFRequest = new Request('POST', $apiUrl.'\u002Fpdf', $headers);\n\n$imageToPDFResponse = $client->sendAsync($imageToPDFRequest, $imageToPDFOptions)->wait();\n\n$convertedImageID = json_decode($imageToPDFResponse->getBody())->{'outputId'};\u003C\u002Fpre>\n\n\u003Cp>The first PHP conversion sends the image to \u003Ccode>\u002Fpdf\u003C\u002Fcode> and captures its \u003Ccode>outputId\u003C\u002Fcode>. That ID becomes the first Merge Different Formats Together as a PDF input without an intermediate download back to PHP.\u003C\u002Fp>\n\n\u003Ch3>Convert the presentation to PDF\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">$powerpointToPDFOptions = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Fpowerpoint.ppt', 'r'),\n      'filename' => 'powerpoint.ppt',\n      'headers' => [\n        'Content-Type' => '\u003CContent-type header>'\n      ]\n    ]\n  ]\n];\n\n$powerpointToPDFRequest = new Request('POST', $apiUrl.'\u002Fpdf', $headers);\n\n$powerpointToPDFResponse = $client->sendAsync($powerpointToPDFRequest, $powerpointToPDFOptions)->wait();\n\n$convertedPowerpointID = json_decode($powerpointToPDFResponse->getBody())->{'outputId'};\u003C\u002Fpre>\n\n\u003Cp>The second PHP conversion repeats the normalization step for the presentation. The Merge Different Formats Together as a PDF workflow must receive this presentation \u003Ccode>outputId\u003C\u002Fcode> before PHP constructs the complete merge request.\u003C\u002Fp>\n\n\u003Ch3>Assemble and send the merge request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">$mergeOptions = [\n  'multipart' => [\n    [\n      'name' => 'id[]',\n      'contents' => $convertedImageID\n    ],\n    [\n      'name' => 'pages[]',\n      'contents' => '1-last'\n    ],\n    [\n      'name' => 'type[]',\n      'contents' => 'id'\n    ],\n    [\n      'name' => 'id[]',\n      'contents' => $convertedPowerpointID\n\n    ],\n    [\n      'name' => 'pages[]',\n      'contents' => '1-last'\n    ],\n    [\n      'name' => 'type[]',\n      'contents' => 'id'\n    ]\n  ]\n];\n\n$mergeRequest = new Request('POST', $apiUrl.'\u002Fmerged-pdf', $headers);\n\n$mergeResponse = $client->sendAsync($mergeRequest, $mergeOptions)->wait();\n\necho $mergeResponse->getBody();\u003C\u002Fpre>\n\n\u003Cp>The PHP merge body groups each resource ID with its input type and selected pages. Their repeated-field order controls how the converted sources appear in the Merge Different Formats Together as a PDF result returned to PHP.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You have followed the complete PHP sequence from source conversion through resource-ID handoff and final PDF assembly.\u003C\u002Fp>\n\n\u003Cp>Associate every returned ID with its original filename and check both conversion responses before merging. That bookkeeping makes ordering explicit and prevents a partial job from producing a packet with the wrong source or a missing section.\u003C\u002Fp>\n\n\u003Cp>Try the Merge Different Formats Together as a PDF workflow with a representative file in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, then adapt the request in PHP. The \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fmerge-pdfs\u002F\">Merge PDFs API Tool documentation\u003C\u002Fa> provides the complete PHP context for Merge Different Formats Together as a PDF values, defaults, and limitations.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Convert different source formats and merge their PDF results in an ordered PHP workflow using managed resource IDs.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-php\u002F#article\",\n      \"headline\": \"How to Merge Different File Formats Together as a PDF with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-php\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Convert different source formats and merge their PDF results in an ordered PHP workflow using managed resource IDs.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Merge PDFs API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fmerge-pdfs\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fmerged-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fmerge-pdfs\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to PowerPoint API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-powerpoint\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpowerpoint API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-microsoft-powerpoint\"\n        }\n      ],\n      \"keywords\": \"Merge PDFs, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Merge Different File Formats Together as a PDF with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9541,9542,9543,9544],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1595,"name":1596,"slug":1597,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-php\u002F","Merge Different File Formats Together as a PDF with PHP | pdfRest",{"id":9549,"uuid":9550,"title":9551,"slug":9552,"html":9553,"comment_id":9549,"feature_image":48,"featured":284,"visibility":1257,"created_at":9554,"updated_at":9555,"published_at":9554,"custom_excerpt":9556,"codeinjection_head":9557,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9558,"primary_tag":9563,"url":9564,"excerpt":9556,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9565,"meta_description":9556,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"670007c2533c9f26b94386ff","5f323779-78d0-4e4f-b3ea-e4a5be9e5f74","How to Merge Different File Formats Together as a PDF with Python","how-to-merge-different-file-formats-together-as-a-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Merge PDFs with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest Merge PDFs API Tool is a powerful resource for developers looking to combine multiple PDF files into a single document programmatically. With this tool, you can streamline workflows that require merging PDFs, making it a valuable asset for automation and efficiency. This tutorial will guide you through the process of sending an API call to merge PDFs using Python, demonstrating how to leverage the capabilities of pdfRest.\u003C\u002Fp>\n\n\u003Cp>Consider a scenario where a user needs to compile various types of documents, such as images, PowerPoint presentations, and PDFs, into a single cohesive PDF file for a business report. By using the Merge PDFs API Tool, this task can be automated, saving time and reducing the potential for human error. This is just one example of how the Merge PDFs feature can be utilized in real-world applications, enhancing productivity and document management.\u003C\u002Fp>\n\n\u003Ch2>Merge PDFs with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\n\n# In this sample, we will show how to merge different file types together as\n# discussed in https:\u002F\u002Fpdfrest.com\u002Fsolutions\u002Fmerge-multiple-types-of-files-together\u002F.\n# First, we will upload an image file to the \u002Fpdf route and capture the output ID.\n# Next, we will upload a PowerPoint file to the \u002Fpdf route and capture its output\n# ID. Finally, we will pass both IDs to the \u002Fmerged-pdf route to combine both inputs\n# into a single PDF.\n#\n# Note that there is nothing special about an image and a PowerPoint file, and\n# this sample could be easily used to convert and combine any two file types\n# that the \u002Fpdf route takes as inputs.\n\napi_key = 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n\npdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf'\nmp_encoder_image_pdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.png', open('\u002Fpath\u002Fto\u002Ffile.png', 'rb'), 'image\u002Fpng'),\n    }\n)\n\nimage_headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_image_pdf.content_type,\n    'Api-Key': api_key\n}\n\nprint(\"Sending POST request to pdf endpoint...\")\nresponse = requests.post(pdf_endpoint_url, data=mp_encoder_image_pdf, headers=image_headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n\n    response_json = response.json()\n    image_id = response_json[\"outputId\"]\n    print(\"Got the first output ID: \" + image_id)\n\n\n    mp_encoder_ppt_pdf = MultipartEncoder(\n        fields={\n            'file': ('file_name.ppt', open('\u002Fpath\u002Fto\u002Ffile.ppt', 'rb'), 'application\u002Fvnd.ms-powerpoint'),\n\n        }\n    )\n\n    ppt_headers = {\n        'Accept': 'application\u002Fjson',\n        'Content-Type': mp_encoder_ppt_pdf.content_type,\n        'Api-Key': api_key\n    }\n\n    print(\"Sending POST request to pdf endpoint...\")\n    response = requests.post(pdf_endpoint_url, data=mp_encoder_ppt_pdf, headers=ppt_headers)\n\n    print(\"Response status code: \" + str(response.status_code))\n\n    if response.ok:\n        response_json = response.json()\n\n        ppt_id = response_json[\"outputId\"]\n        print(\"Got the second output ID: \" + image_id)\n\n        merged_pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fmerged-pdf'\n\n        merge_request_data = [('id', image_id), ('pages', '1-last'), ('type', 'id'), ('id', ppt_id), ('pages', '1-last'), ('type', 'id'), ('output', 'multiple_file_types')]\n        mp_encoder_merge = MultipartEncoder(\n            fields=merge_request_data\n        )\n\n        merge_headers = {\n            'Accept': 'application\u002Fjson',\n            'Content-Type': mp_encoder_merge.content_type,\n            'Api-Key': api_key\n        }\n\n        print(\"Sending POST request to merged-pdf endpoint...\")\n        response = requests.post(merged_pdf_endpoint_url, data=mp_encoder_merge, headers=merge_headers)\n\n        print(\"Merge response status code: \" + str(response.status_code))\n\n        if response.ok:\n            response_json = response.json()\n            print(json.dumps(response_json, indent = 2))\n        else:\n            print(response.text)\n\n    else:\n        print(response.text)\n\n\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FComplex%20Flow%20Examples\u002Fmerge-different-file-types.py\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary modules and setting up the API key:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\napi_key = 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n\u003C\u002Fpre>\n\n\u003Cp>Here, `requests_toolbelt` is used to handle multipart form data, and `requests` is for making HTTP requests. The `api_key` is a placeholder for your actual API key.\u003C\u002Fp>\n\n\u003Cp>Next, the code prepares to upload an image file to the `\u002Fpdf` endpoint:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf'\nmp_encoder_image_pdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.png', open('\u002Fpath\u002Fto\u002Ffile.png', 'rb'), 'image\u002Fpng'),\n    }\n)\n\nimage_headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_image_pdf.content_type,\n    'Api-Key': api_key\n}\n\u003C\u002Fpre>\n\n\u003Cp>The `MultipartEncoder` is used to encode the image file. The `image_headers` dictionary specifies the headers for the request, including the API key and content type.\u003C\u002Fp>\n\n\u003Cp>The same process is repeated for a PowerPoint file:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_ppt_pdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.ppt', open('\u002Fpath\u002Fto\u002Ffile.ppt', 'rb'), 'application\u002Fvnd.ms-powerpoint'),\n    }\n)\n\nppt_headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_ppt_pdf.content_type,\n    'Api-Key': api_key\n}\n\u003C\u002Fpre>\n\n\u003Cp>After obtaining the output IDs for both files, they are sent to the `\u002Fmerged-pdf` endpoint to be combined:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">merge_request_data = [('id', image_id), ('pages', '1-last'), ('type', 'id'), ('id', ppt_id), ('pages', '1-last'), ('type', 'id'), ('output', 'multiple_file_types')]\nmp_encoder_merge = MultipartEncoder(\n    fields=merge_request_data\n)\n\nmerge_headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_merge.content_type,\n    'Api-Key': api_key\n}\n\u003C\u002Fpre>\n\n\u003Cp>The `merge_request_data` specifies the files to be merged, the pages to include, and the output format. The `merge_headers` are similar to the previous headers but adapted for the merge request.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use Python to merge different file types into a single PDF using the pdfRest API. This process can be adapted for various file types supported by the API, providing flexibility and efficiency in document management.\u003C\u002Fp>\n\n\u003Cp>To explore more capabilities of pdfRest, try out the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">pdfRest API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for detailed documentation on all available API tools.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-10-04T15:20:34.000+00:00","2026-09-02T18:29:03.000+00:00","Learn how to use pdfRest API Toolkit to convert Word, Excel, JPG to PDF and then merge them together","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Merge Different File Formats Together as a PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-python\u002F\",\n      \"datePublished\": \"2024-10-04T15:20:34.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:25.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest API Toolkit to convert Word, Excel, JPG to PDF and then merge them together\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Merge PDFs API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fmerge-pdfs\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fmerged-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fmerge-pdfs\"\n        }\n      ],\n      \"keywords\": \"Merge PDFs, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Merge Different File Formats Together as a PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9559,9560,9561,9562],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1595,"name":1596,"slug":1597,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-merge-different-file-formats-together-as-a-pdf-with-python\u002F","How to Merge Different File Formats Together as a PDF with Python, Tutorial | pdfRest",{"id":9567,"uuid":9568,"title":9569,"slug":9570,"html":9571,"comment_id":9572,"feature_image":48,"featured":284,"visibility":1257,"created_at":9573,"updated_at":9555,"published_at":9573,"custom_excerpt":48,"codeinjection_head":9574,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9575,"primary_tag":9580,"url":9581,"excerpt":9582,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9583,"meta_description":9584,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1344","8300dbca-c773-4a88-9a3f-d8738bfab997","How to Merge PDF Files in .NET with C#","how-to-merge-pdfs-with-dot-net-c-sharp","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Merge PDFs with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fmerge-pdfs\u002F'>Merge PDFs API Tool\u003C\u002Fa> allows users to combine multiple PDF files into a single PDF document. This can be particularly useful in scenarios such as consolidating reports, merging scanned documents, or combining chapters of a book into a single file. This tutorial will demonstrate how to make an API call to the Merge PDFs endpoint using C#.\u003C\u002Fp>\n\n\u003Ch2>Merge PDFs with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"merged-pdf\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"file\"));\n        multipartContent.Add(byteArrayOption, \"type[]\");\n        var byteArrayOption2 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"all\"));\n        multipartContent.Add(byteArrayOption2, \"pages[]\");\n\n        var byteArray2 = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\n        var byteAryContent2 = new ByteArrayContent(byteArray2);\n        multipartContent.Add(byteAryContent2, \"file\", \"file_name.pdf\");\n        byteAryContent2.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArrayOption3 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"file\"));\n        multipartContent.Add(byteArrayOption3, \"type[]\");\n        var byteArrayOption4 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"all\"));\n        multipartContent.Add(byteArrayOption4, \"pages[]\");\n\n        var byteArrayOption5 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"merged\"));\n        multipartContent.Add(byteArrayOption5, \"output\");\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fmerged-pdf.cs\">pdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code block above demonstrates how to merge PDF files using the pdfRest API in C#. Let's break down each part of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>This creates an \u003Ccode>HttpClient\u003C\u002Fcode> instance with the base address set to the pdfRest API endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var request = new HttpRequestMessage(HttpMethod.Post, \"merged-pdf\"))\n\u003C\u002Fpre>\n\n\u003Cp>A new \u003Ccode>HttpRequestMessage\u003C\u002Fcode> is created to make a POST request to the \"merged-pdf\" endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>This adds your API key to the request headers. Replace \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n\u003C\u002Fpre>\n\n\u003Cp>A \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> object is created to hold the parts of the multipart request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n\u003C\u002Fpre>\n\n\u003Cp>These lines read a PDF file into a byte array, wrap it in a \u003Ccode>ByteArrayContent\u003C\u002Fcode>, and add it to the multipart content with the name \"file\". The \"file_name.pdf\" should be replaced with the actual name of the file you want to merge.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"file\"));\nmultipartContent.Add(byteArrayOption, \"type[]\");\n\u003C\u002Fpre>\n\n\u003Cp>This specifies the type of the content being added. In this case, \"file\" indicates that a file is being sent.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption5 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"merged\"));\nmultipartContent.Add(byteArrayOption5, \"output\");\n\u003C\u002Fpre>\n\n\u003Cp>This specifies the desired output type, which is \"merged\" in this case, indicating that the API should merge the provided files.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've learned how to use C# to make an API call to pdfRest's Merge PDFs endpoint. The provided code demonstrates how to set up the request, add files and options, and handle the response.\u003C\u002Fp>\n\n\u003Cp>For further exploration and to demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fmerged-pdf.cs\">pdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","657bbbec2d4014c9499b3840","2023-12-15T02:37:32.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdfs-with-dot-net-c-sharp\u002F#article\",\n      \"headline\": \"How to Merge PDF Files in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdfs-with-dot-net-c-sharp\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdfs-with-dot-net-c-sharp\u002F\",\n      \"datePublished\": \"2023-12-15T02:37:32.000Z\",\n      \"dateModified\": \"2026-09-01T14:24:02.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to combine PDF documents in .NET projects with the Merge PDF API tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Merge PDFs API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fmerge-pdfs\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fmerged-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fmerge-pdfs\"\n        }\n      ],\n      \"keywords\": \".NET, Merge PDFs\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Merge PDF Files in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdfs-with-dot-net-c-sharp\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9576,9577,9578,9579],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1595,"name":1596,"slug":1597,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-merge-pdfs-with-dot-net-c-sharp\u002F","\n\n\n\n\nWhy Use Merge PDFs with C#?\n\n\n\nThe pdfRest Merge PDFs API Tool allows users to combine multiple PDF files into a single PDF document. This can be particularly useful in scenarios such as consolidating reports, merging scanned documents, or combining chapters of a book into a single file. This tutorial will demonstrate how to make an API call to the Merge PDFs endpoint using C#.\n\n\n\n\nMerge PDFs with C# Code Example\n\n\n\nusing System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = ","How to Merge PDF Files in .NET with C#, Tutorial | pdfRest","Learn how to combine PDF documents in .NET projects with the Merge PDF API tool from pdfRest.",{"id":9586,"uuid":9587,"title":9588,"slug":9589,"html":9590,"comment_id":9586,"feature_image":48,"featured":284,"visibility":1257,"created_at":9591,"updated_at":9592,"published_at":9591,"custom_excerpt":9593,"codeinjection_head":9594,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9595,"primary_tag":9600,"url":9601,"excerpt":9593,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9602,"meta_description":9603,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65d90ad1533c9f26b94365d8","d164f1ee-0f70-4653-8a81-9367417f3c80","How to Merge PDF Files with cURL","how-to-merge-pdf-files-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Merge PDFs with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fmerge-pdfs\u002F'>Merge PDFs API Tool\u003C\u002Fa> is a powerful resource that allows users to combine multiple PDF files into a single document programmatically. This tutorial will demonstrate how to send an API call to Merge PDFs using cURL, a command-line tool for making HTTP requests. cURL is widely used for its simplicity and versatility in interacting with web APIs, making it an ideal choice for developers looking to automate tasks or integrate PDF processing capabilities into their applications.\u003C\u002Fp>\n\n\u003Cp>Consider a scenario where a business needs to consolidate several reports into one document for a quarterly review. Instead of manually combining these files, which can be time-consuming and prone to errors, the business can use the Merge PDFs API to automate the process. This ensures a consistent and efficient workflow, especially when dealing with a large number of documents or when such tasks need to be performed regularly.\u003C\u002Fp>\n\n\u003Ch2>Merge PDFs with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fmerged-pdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"pages[]=all\" -F \"type[]=file\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"pages[]=all\" -F \"type[]=file\" \\\n  -F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>Reference to the code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fmerged-pdf.sh\">pdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This section will explain the different parts of the cURL command used to call the Merge PDFs API:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-X POST\n\u003C\u002Fpre>\n\n\u003Cp>This specifies the HTTP method for the request, which is POST in this case, indicating that data will be sent to the server to create or update a resource.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\n\u003C\u002Fpre>\n\n\u003Cp>This header tells the server that the client expects a response in JSON format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\n\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the data being sent in the request is in multipart\u002Fform-data format, which is used for uploading files.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>The API key is required for authentication with the pdfRest API. Replace the placeholder with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\n-F \"pages[]=all\" -F \"type[]=file\"\n\u003C\u002Fpre>\n\n\u003Cp>Here, -F adds a multipart form field called \u003Ccode>file\u003C\u002Fcode> with the file to be uploaded. The '@' symbol indicates that the following string is a file path, which you should replace with the actual path to your PDF file. Next, the \u003Ccode>pages[]\u003C\u002Fcode> form field specifies the pages of the uploaded file to be included. Finally, the \u003Ccode>type[]\u003C\u002Fcode> field indicates that this resource is a file.\u003C\u002Fp>\n\n\u003Cp>Each of these three fields must be included for each file that will be merged.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>This form field sets the name of the output file that will be generated after merging the PDFs.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you've learned how to merge PDF files using the pdfRest Merge PDFs API with a cURL command. This is just one of the many capabilities offered by pdfRest. To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information and additional endpoints, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. For code samples using JSON payloads, visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fmerged-pdf.sh\">pdf-rest-api-samples with JSON payloads\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-23T21:14:57.000+00:00","2026-09-02T18:29:04.000+00:00","Learn how to merge PDF documents using cURL to call the Merge PDFs API Tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdf-files-with-curl\u002F#article\",\n      \"headline\": \"How to Merge PDF Files with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdf-files-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdf-files-with-curl\u002F\",\n      \"datePublished\": \"2024-02-23T21:14:57.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:45.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to merge PDF documents using cURL to call the Merge PDFs API Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Merge PDFs API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fmerge-pdfs\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fmerged-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fmerge-pdfs\"\n        }\n      ],\n      \"keywords\": \"Merge PDFs, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Merge PDF Files with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdf-files-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9596,9597,9598,9599],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1595,"name":1596,"slug":1597,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-merge-pdf-files-with-curl\u002F","How to Merge PDFs using Curl, Tutorial | pdfRest","Learn how to merge PDF documents using Curl to call the Merge PDFs API Tool from pdfRest.",{"id":9605,"uuid":9606,"title":9607,"slug":9608,"html":9609,"comment_id":9605,"feature_image":48,"featured":284,"visibility":1257,"created_at":9610,"updated_at":9592,"published_at":9610,"custom_excerpt":9611,"codeinjection_head":9612,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9613,"primary_tag":9618,"url":9619,"excerpt":9611,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9620,"meta_description":9611,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65eb7d14533c9f26b9436875","3f0c654e-aa71-4b38-adcb-f39066da6d21","How to Merge PDF Files with Java","how-to-merge-pdf-files-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Merge PDFs with Java?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fmerge-pdfs\u002F'>Merge PDFs API Tool\u003C\u002Fa> is a powerful resource for developers looking to automate the process of combining multiple PDF files into a single document. This tutorial will guide you through the steps to send an API call to Merge PDFs using Java, which can be particularly useful when dealing with document processing in server-side applications or batch processing systems.\u003C\u002Fp>\n\n\u003Cp>Merging PDFs is a common requirement for many businesses and services. For instance, an insurance company might need to merge various documents related to a claim into a single PDF before archiving or sending it to a client. Similarly, a legal firm may need to compile case files and evidence into a single document. Automating this process with Java and the pdfRest API saves time and reduces the potential for human error.\u003C\u002Fp>\n\n\u003Ch2>Merge PDFs with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONObject;\n\npublic class MergedPDF {\n\n  \u002F\u002F Specify the paths to your file here, or as the arguments when running the program.\n  private static final String[] DEFAULT_FILE_PATHS =\n      new String[] {\"\u002Fpath\u002Fto\u002Ffile1.pdf\", \"\u002Fpath\u002Fto\u002Ffile2.pdf\"};\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    String[] inputFilePaths;\n    if (args.length > 0) {\n      inputFilePaths = args;\n    } else {\n      inputFilePaths = DEFAULT_FILE_PATHS;\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    MultipartBody.Builder bodyBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM);\n\n    for (String inputFilePath : inputFilePaths) {\n      final File inputFile = new File(inputFilePath);\n      final RequestBody inputFileRequestBody =\n          RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n      bodyBuilder\n          .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n          .addFormDataPart(\"pages\", \"1-last\")\n          .addFormDataPart(\"type\", \"file\");\n    }\n\n    RequestBody requestBody = bodyBuilder.addFormDataPart(\"output\", \"pdfrest_merged_pdf\").build();\n\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fmerged-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client = new OkHttpClient().newBuilder().build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source code reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FMergedPDF.java\">pdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code provided is a Java program that uses the pdfRest Merge PDFs API to combine multiple PDF files into a single document. It includes all necessary imports and a main class called \u003Ccode>MergedPDF\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cp>Firstly, the program defines default file paths and an API key. These can be overridden by command-line arguments or environment variables. The \u003Ccode>Dotenv\u003C\u002Fcode> library is used to load API keys from a .env file, providing a secure way to handle credentials.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>MultipartBody.Builder\u003C\u002Fcode> is used to construct the request body, which includes the PDF files to be merged. Each file is added as a form data part with the content type \"application\u002Fpdf\". Additionally, the \"pages\" parameter specifies which pages to include from each file (\"1-last\" meaning all pages), and the \"type\" parameter indicates that the uploaded items are files.\u003C\u002Fp>\n\n\u003Cp>The request is built with the necessary headers, including the API key, and the endpoint URL. The \u003Ccode>OkHttpClient\u003C\u002Fcode> is then used to execute the request, and the response is printed out. If the response body is not null, it is formatted into a pretty-printed JSON string using the \u003Ccode>prettyJson\u003C\u002Fcode> method.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial demonstrated how to make an API call to pdfRest's Merge PDFs endpoint using Java. By following the steps outlined, you can integrate PDF merging capabilities into your Java applications, streamlining document management tasks.\u003C\u002Fp>\n\n\u003Cp>To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information on the API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. For code samples using JSON payloads, check out \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FMergedPDF.java\">pdf-rest-api-samples with JSON Payload\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-08T21:03:16.000+00:00","Learn how to use pdfRest Merge PDFs API Tool with Java to combine PDF files together","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdf-files-with-java\u002F#article\",\n      \"headline\": \"How to Merge PDF Files with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdf-files-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdf-files-with-java\u002F\",\n      \"datePublished\": \"2024-03-08T21:03:16.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:42.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Merge PDFs API Tool with Java to combine PDF files together\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Merge PDFs API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fmerge-pdfs\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fmerged-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fmerge-pdfs\"\n        }\n      ],\n      \"keywords\": \"Java, Merge PDFs\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Merge PDF Files with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdf-files-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9614,9615,9616,9617],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1595,"name":1596,"slug":1597,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-merge-pdf-files-with-java\u002F","How to Merge PDF Files with Java, Tutorial | pdfRest",{"id":9622,"uuid":9623,"title":9624,"slug":9625,"html":9626,"comment_id":9627,"feature_image":48,"featured":284,"visibility":1257,"created_at":9628,"updated_at":9592,"published_at":9628,"custom_excerpt":48,"codeinjection_head":9629,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9630,"primary_tag":9635,"url":9636,"excerpt":9637,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9638,"meta_description":9639,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1345","1ffd8788-dca0-4b12-849e-78e1e99bd5b0","How to Merge PDF Files with JavaScript in NodeJS","how-to-merge-pdf-files-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Merge PDFs with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fmerge-pdfs\u002F\">Merge PDFs API Tool\u003C\u002Fa> allows users to combine multiple PDF files into a single document. This can be incredibly useful in various scenarios, such as consolidating reports, combining scanned documents, or merging chapters of a book.\u003C\u002Fp>\n\n\u003Cp>In this tutorial, we will demonstrate how to send an API call to the Merge PDFs tool using JavaScript.\u003C\u002Fp>\n\n\u003Ch2>JavaScript Code Sample\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to merge multiple PDFs into a single document.\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('pages[]', '1-last');\ndata.append('type[]', 'file');\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('pages[]', '1-last');\ndata.append('type[]', 'file');\ndata.append('output', 'pdfrest_merged_pdf');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fmerged-pdf', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fmerged-pdf.js\">pdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the JavaScript Code\u003C\u002Fh2>\n\n\u003Cp>The NodeJS example uses \u003Ccode>axios\u003C\u002Fcode> for the request, \u003Ccode>form-data\u003C\u002Fcode> to assemble repeated multipart fields, and \u003Ccode>fs\u003C\u002Fcode> to stream each local PDF. Install the external packages with \u003Ccode>npm install axios form-data\u003C\u002Fcode> if they are not already part of the project.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffirst.pdf'));\ndata.append('pages[]', '1-last');\ndata.append('type[]', 'file');\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Fsecond.pdf'));\ndata.append('pages[]', '1-last');\ndata.append('type[]', 'file');\u003C\u002Fpre>\n\n\u003Cp>The repeated fields are positional. Every \u003Ccode>file\u003C\u002Fcode> or \u003Ccode>id[]\u003C\u002Fcode> input needs one corresponding \u003Ccode>pages[]\u003C\u002Fcode> value and one \u003Ccode>type[]\u003C\u002Fcode> value in the same merge order. Here, \u003Ccode>type[]\u003C\u002Fcode> is \u003Ccode>file\u003C\u002Fcode> for both uploads, and \u003Ccode>1-last\u003C\u002Fcode> includes every page from each document.\u003C\u002Fp>\n\n\u003Cp>Page expressions also support comma-separated pages and ranges, reversed ranges, \u003Ccode>even\u003C\u002Fcode>, and \u003Ccode>odd\u003C\u002Fcode>. To reuse a previously uploaded PDF, submit its \u003Ccode>id[]\u003C\u002Fcode> with a matching \u003Ccode>type[]\u003C\u002Fcode> value of \u003Ccode>id\u003C\u002Fcode>. A multipart request may mix uploaded files and resource IDs as long as all corresponding fields preserve the same order.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">data.append('output', 'pdfrest_merged_pdf');\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>output\u003C\u002Fcode> sets the merged filename without the \u003Ccode>.pdf\u003C\u002Fcode> extension. If omitted, the service applies its default output name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fmerged-pdf',\n  headers: {\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data: data\n};\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>data.getHeaders()\u003C\u002Fcode> provides the multipart boundary. \u003Ccode>maxBodyLength: Infinity\u003C\u002Fcode> prevents Axios from applying its own finite request-body limit before the service receives the PDFs.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error);\n});\u003C\u002Fpre>\n\n\u003Cp>The response identifies the newly merged PDF resource. In production, inspect \u003Ccode>error.response\u003C\u002Fcode> for API validation details, especially when the number or order of \u003Ccode>file\u003C\u002Fcode>, \u003Ccode>id[]\u003C\u002Fcode>, \u003Ccode>pages[]\u003C\u002Fcode>, and \u003Ccode>type[]\u003C\u002Fcode> values do not correspond.\u003C\u002Fp>\n\n\u003Ch2>Next Steps with pdfRest\u003C\u002Fh2>\n\n\u003Cp>We've covered how to use JavaScript to call the pdfRest Merge PDFs API. This allows you to programmatically merge multiple PDF files into a single document. You can now experiment with all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for more details.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fmerged-pdf.js\">https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fmerged-pdf.js\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","657bbc172d4014c9499b384a","2023-12-15T02:38:15.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdf-files-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Merge PDF Files with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdf-files-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdf-files-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2023-12-15T02:38:15.000Z\",\n      \"dateModified\": \"2026-09-01T14:52:13.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to combine PDF documents with JavaScript using the Merge PDFs API tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Merge PDFs API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fmerge-pdfs\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fmerged-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fmerge-pdfs\"\n        }\n      ],\n      \"keywords\": \"JavaScript, Merge PDFs\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Merge PDF Files with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdf-files-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9631,9632,9633,9634],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1595,"name":1596,"slug":1597,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-merge-pdf-files-with-javascript-in-nodejs\u002F","\n\n\n\n\nWhy Use Merge PDFs with JavaScript?\n\n\n\nThe pdfRest Merge PDFs API Tool allows users to combine multiple PDF files into a single document. This can be incredibly useful in various scenarios, such as consolidating reports, combining scanned documents, or merging chapters of a book.\n\n\n\nIn this tutorial, we will demonstrate how to send an API call to the Merge PDFs tool using JavaScript.\n\n\n\n\nJavaScript Code Sample\n\n\n\n\u002F\u002F This request demonstrates how to merge multiple PDFs into a single document","How to Merge PDFs with JavaScript in NodeJS, Tutorial | pdfRest","Learn how to combine PDF documents with JavaScript using the Merge PDFs API tool from pdfRest.",{"id":9641,"uuid":9642,"title":9643,"slug":9644,"html":9645,"comment_id":9646,"feature_image":48,"featured":284,"visibility":1257,"created_at":9647,"updated_at":9648,"published_at":9647,"custom_excerpt":48,"codeinjection_head":9649,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9650,"primary_tag":9655,"url":9656,"excerpt":9657,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9658,"meta_description":9659,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1343","bd904fd9-cdc6-46d2-883e-4920f1c39cc9","How to Merge PDF Files with PHP","how-to-merge-pdfs-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Merge PDFs with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fmerge-pdfs\u002F\">Merge PDFs API Tool\u003C\u002Fa> allows users to combine multiple PDF files into a single PDF document programmatically. This tutorial will guide you through the process of making an API call to the Merge PDFs endpoint using PHP.\u003C\u002Fp>\n\n\u003Cp>This can be particularly useful in scenarios where you need to consolidate reports, invoices, or any documents that are better served as a single file for easier distribution or archiving.\u003C\u002Fp>\n\n\u003Ch2>Merge PDFs with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    \u002F\u002F ... (multipart data here)\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fmerged-pdf', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\u003C\u002Fpre>\n\n\u003Cp>Source of the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fmerged-pdf.php\">GitHub - datalogics\u002Fpdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by loading the required libraries and setting up the Guzzle HTTP client:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\nuse GuzzleHttp\\Client;\n$client = new Client();\n\u003C\u002Fpre>\n\n\u003Cp>Next, we define the headers with the API key for authentication:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The options array is where the magic happens. It contains the 'multipart' data which represents each file and its options:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">'options' => [\n  'multipart' => [\n    \u002F\u002F ... (multipart data here)\n  ]\n];\n\u003C\u002Fpre>\n\n\u003Cp>Each element in the 'multipart' array corresponds to a field in the form data that the API expects. The 'name' key specifies the field name, 'contents' is the value, and 'filename' is the name of the file when uploading a file.\u003C\u002Fp>\n\n\u003Cp>The 'pages[]' and 'type[]' fields are used to specify which pages to include from each file and the type of the input (file or ID).\u003C\u002Fp>\n\n\u003Cp>The 'output' field defines the name of the resulting merged PDF:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">[\n  'name' => 'output',\n  'contents' => 'pdfrest_merged_pdf'\n]\n\u003C\u002Fpre>\n\n\u003Cp>Finally, we send the request and output the response:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fmerged-pdf', $headers);\n$res = $client->sendAsync($request, $options)->wait();\necho $res->getBody();\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've successfully walked through the process of making an API call to the pdfRest Merge PDFs endpoint using PHP. By sending the appropriate multipart form data, we can merge multiple PDF files into a single document.\u003C\u002Fp>\n\n\u003Cp>To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fmerged-pdf.php\">GitHub - datalogics\u002Fpdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","657bbb6a2d4014c9499b3836","2023-12-15T02:35:22.000+00:00","2026-09-10T20:19:17.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdfs-with-php\u002F#article\",\n      \"headline\": \"How to Merge PDF Files with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdfs-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdfs-with-php\u002F\",\n      \"datePublished\": \"2023-12-15T02:35:22.000Z\",\n      \"dateModified\": \"2026-09-01T14:24:02.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to combine PDFs in PHP through the easy-to-use Merge PDF API endpoint from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Merge PDFs API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fmerge-pdfs\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fmerged-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fmerge-pdfs\"\n        }\n      ],\n      \"keywords\": \"Merge PDFs, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Merge PDF Files with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdfs-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9651,9652,9653,9654],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1595,"name":1596,"slug":1597,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-merge-pdfs-with-php\u002F","\n\n\n\n\nWhy Use Merge PDFs with PHP?\n\n\n\nThe pdfRest Merge PDFs API Tool allows users to combine multiple PDF files into a single PDF document programmatically. This tutorial will guide you through the process of making an API call to the Merge PDFs endpoint using PHP.\n\n\n\nThis can be particularly useful in scenarios where you need to consolidate reports, invoices, or any documents that are better served as a single file for easier distribution or archiving.\n\n\n\n\nMerge PDFs with PHP Code Example\n\n\n\nre","How to Merge PDFs with PHP, Tutorial | pdfRest","Learn how to combine PDFs in PHP through the easy-to-use Merge PDF API endpoint from pdfRest.",{"id":9661,"uuid":9662,"title":9663,"slug":9664,"html":9665,"comment_id":9666,"feature_image":48,"featured":284,"visibility":1257,"created_at":9667,"updated_at":9668,"published_at":9667,"custom_excerpt":48,"codeinjection_head":9669,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9670,"primary_tag":9675,"url":9676,"excerpt":9677,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9678,"meta_description":9679,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1342","83ef49c6-7d17-48ff-8381-8e25138acc67","How to Merge PDF Files with Python","how-to-merge-pdf-documents-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Merge PDFs with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fmerge-pdfs\u002F'>Merge PDFs API Tool\u003C\u002Fa> is a powerful feature that allows you to combine multiple PDF documents into a single PDF file. This tutorial will guide you through the process of making an API call to the Merge PDFs endpoint using Python.\u003C\u002Fp>\n\u003Cp>Merging PDFs can be useful in various real-world scenarios, such as combining scanned documents, consolidating reports, or assembling a portfolio of work.\u003C\u002Fp>\n\n\u003Ch2>Merge PDFs with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nmerged_pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fmerged-pdf'\n\n# The \u002Fmerged-pdf endpoint can take one or more PDF files or ids as input.\n# This sample takes 2 PDF files and merges all the pages in the document into a single document.\n\nmerge_request_data = []\n\n# Array of tuples that contains information about the 2 files that will be merged\nfiles = [\n    ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n    ('file_name2.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf')\n]\n\n# Structure the data that will be sent to POST merge request as an array of tuples\nfor i in range(len(files)):\n    merge_request_data.append((\"file\", files[i]))\n    merge_request_data.append((\"pages\", \"1-last\"))\n    merge_request_data.append((\"type\", \"file\"))\n\nmerge_request_data.append(('output', 'example_mergedPdf_out'))\n\nmp_encoder_mergedPdf = MultipartEncoder(\n    fields=merge_request_data\n)\n\n# Let's set the headers that the merged-pdf endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_mergedPdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to merged-pdf endpoint...\")\nresponse = requests.post(merged_pdf_endpoint_url, data=mp_encoder_mergedPdf, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>The source of the provided code is available on GitHub at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fmerged-pdf.py\">pdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided code performs the following steps:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\u003C\u002Fpre>\n\n\u003Cp>This imports the necessary libraries: \u003Ccode>requests_toolbelt\u003C\u002Fcode> for creating a multipart encoder, \u003Ccode>requests\u003C\u002Fcode> for making HTTP requests, and \u003Ccode>json\u003C\u002Fcode> for JSON processing.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">merged_pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fmerged-pdf'\n\u003C\u002Fpre>\n\n\u003Cp>Defines the API endpoint URL for merging PDFs.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">merge_request_data = []\n\u003C\u002Fpre>\n\n\u003Cp>Initializes an empty list to store the request data for the merge operation.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">files = [\n    ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n    ('file_name2.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf')\n]\n\u003C\u002Fpre>\n\n\u003Cp>Creates a list of tuples representing the files to be merged. Each tuple contains the file name, a file object opened in binary read mode, and the MIME type.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">for i in range(len(files)):\n    merge_request_data.append((\"file\", files[i]))\n    merge_request_data.append((\"pages\", \"1-last\"))\n    merge_request_data.append((\"type\", \"file\"))\n\u003C\u002Fpre>\n\n\u003Cp>Iterates over the files, appending the file data, page range, and type to the request data list.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">merge_request_data.append(('output', 'example_mergedPdf_out'))\n\u003C\u002Fpre>\n\n\u003Cp>Appends the desired output file name to the request data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_mergedPdf = MultipartEncoder(\n    fields=merge_request_data\n)\n\u003C\u002Fpre>\n\n\u003Cp>Creates a \u003Ccode>MultipartEncoder\u003C\u002Fcode> object with the request data, which helps in encoding the files for the HTTP request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_mergedPdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\n\u003C\u002Fpre>\n\n\u003Cp>Sets the HTTP headers, including the API key which you must replace with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(merged_pdf_endpoint_url, data=mp_encoder_mergedPdf, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>Makes a POST request to the API endpoint with the encoded data and headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Checks the response status and prints the JSON response if successful, or the error message if not.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>The tutorial has demonstrated how to use Python to call the pdfRest Merge PDFs API to merge multiple PDF documents into a single file. You are encouraged to explore and demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for more details.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fmerged-pdf.py\">pdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","657bbb5a2d4014c9499b382c","2023-12-15T02:35:06.000+00:00","2026-09-02T18:29:05.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdf-documents-with-python\u002F#article\",\n      \"headline\": \"How to Merge PDF Files with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdf-documents-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdf-documents-with-python\u002F\",\n      \"datePublished\": \"2023-12-15T02:35:06.000Z\",\n      \"dateModified\": \"2026-09-01T14:24:02.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to combine PDF documents in Python with the Merge PDF API tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Merge PDFs API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fmerge-pdfs\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fmerged-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fmerge-pdfs\"\n        }\n      ],\n      \"keywords\": \"Merge PDFs, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Merge PDF Files with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-merge-pdf-documents-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9671,9672,9673,9674],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1595,"name":1596,"slug":1597,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-merge-pdf-documents-with-python\u002F","\n\n\n\n\nWhy Use Merge PDFs with Python?\n\n\n\nThe pdfRest Merge PDFs API Tool is a powerful feature that allows you to combine multiple PDF documents into a single PDF file. This tutorial will guide you through the process of making an API call to the Merge PDFs endpoint using Python.\n\n\nMerging PDFs can be useful in various real-world scenarios, such as combining scanned documents, consolidating reports, or assembling a portfolio of work.\n\n\n\n\nMerge PDFs with Python Code Example\n\n\n\nfrom requests_toolbe","How to Merge PDF Documents with Python, Tutorial | pdfRest","Learn how to combine PDF documents in Python with the Merge PDF API tool from pdfRest.",{"id":9681,"uuid":9682,"title":9683,"slug":9684,"html":9685,"comment_id":9681,"feature_image":48,"featured":284,"visibility":1257,"created_at":9686,"updated_at":9471,"published_at":9471,"custom_excerpt":9687,"codeinjection_head":9688,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9689,"primary_tag":9694,"url":9695,"excerpt":9687,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9696,"meta_description":9687,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a9764e1533c9f26b943b7f2","e4949c0d-b856-4387-bb63-533c2b11e6b7","How to Poll for API Request Status in .NET with C#","how-to-poll-for-api-request-status-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Cp>In this tutorial, we'll use C# and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fapi-polling\u002F\">API Polling Tool\u003C\u002Fa> to submit asynchronous document work and poll its request status. The complete Poll for API Request Status repository sample stays visible while we explain the request fields and response behavior a C# application must adapt safely.\u003C\u002Fp>\n\n\u003Ch2>Why Poll for API Request Status in .NET with C#?\u003C\u002Fh2>\n\n\u003Cp>Background services and web applications benefit from decoupling document submission from completion. API Polling gives the .NET caller a request ID immediately and exposes the eventual processing response through a GET request.\u003C\u002Fp>\n\n\u003Cp>An ASP.NET job coordinator might begin a BMP rendering operation, persist the identifier, and let a hosted worker check it every few seconds. The web request can finish quickly while the worker owns timeout, retry, and completion behavior.\u003C\u002Fp>\n\n\u003Cp>The C# sample isolates initial submission and status retrieval in separate methods. That separation makes the two contracts clear: the first POST asks for \u003Ccode>requestId\u003C\u002Fcode>, while each later GET authenticates normally and addresses that identifier in the route.\u003C\u002Fp>\n\n\u003Ch2>C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">\u002F*\n * What this sample does:\n * - Demonstrates polling with response-type header and request-status.\n * - Routed from Program.cs as: `dotnet run -- request-status-multipart \u003CinputFile>`.\n *\n * Setup (environment):\n * - Copy .env.example to .env\n * - Set PDFREST_API_KEY=your_api_key_here\n * - Optional: set PDFREST_URL to override the API region. For EU\u002FGDPR compliance and proximity, use:\n *     PDFREST_URL=https:\u002F\u002Feu-api.pdfrest.com\n *   For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\n * Usage:\n *   dotnet run -- request-status-multipart \u002Fpath\u002Fto\u002Finput.pdf\n *\n * Output:\n * - Prints interim responses and final JSON; validation errors exit non-zero.\n *\u002F\n\nusing System.Text;\nusing Newtonsoft.Json.Linq;\n\nnamespace Samples.EndpointExamples.MultipartPayload\n{\n    public static class RequestStatus\n    {\n        public static async Task Execute(string[] args)\n        {\n            if (args == null || args.Length \u003C 1)\n            {\n                Console.Error.WriteLine(\"request-status-multipart requires \u003CinputFile>\");\n                Environment.Exit(1);\n                return;\n            }\n            var inputPath = args[0];\n            if (!File.Exists(inputPath))\n            {\n                Console.Error.WriteLine($\"File not found: {inputPath}\");\n                Environment.Exit(1);\n                return;\n            }\n\n            var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\n            if (string.IsNullOrWhiteSpace(apiKey))\n            {\n                Console.Error.WriteLine(\"Missing required environment variable: PDFREST_API_KEY\");\n                Environment.Exit(1);\n                return;\n            }\n            var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n\n            \u002F\u002F Send initial request to an arbitrary route (bmp) with response-type header to get requestId\n            string bmpResponse = await GetBmpResponseAsync(baseUrl, apiKey, inputPath, Path.GetFileName(inputPath));\n            dynamic bmpJson = JObject.Parse(bmpResponse);\n            if (bmpJson.ContainsKey(\"error\"))\n            {\n                Console.Error.WriteLine($\"Error from initial request: {bmpJson.error}\");\n                Environment.Exit(1);\n                return;\n            }\n            string requestId = bmpJson.requestId;\n            Console.WriteLine($\"Received request ID: {requestId}\");\n\n            \u002F\u002F Poll request-status until not pending\n            string statusResponse = await GetRequestStatusAsync(baseUrl, apiKey, requestId);\n            dynamic statusJson = JObject.Parse(statusResponse);\n            while (statusJson.status == \"pending\")\n            {\n                const int delay = 5;\n                Console.WriteLine($\"Response from \u002Frequest-status for request {requestId}: {statusJson}\");\n                Console.WriteLine($\"Request status was \\\"pending\\\". Checking again in {delay} seconds...\");\n                await Task.Delay(TimeSpan.FromSeconds(delay));\n                statusResponse = await GetRequestStatusAsync(baseUrl, apiKey, requestId);\n                statusJson = JObject.Parse(statusResponse);\n            }\n            Console.WriteLine($\"Response from \u002Frequest-status: {statusJson}\");\n            Console.WriteLine(\"Done!\");\n        }\n\n        private static async Task\u003Cstring> GetBmpResponseAsync(string baseUrl, string apiKey, string pathToFile, string fileName)\n        {\n            using var httpClient = new HttpClient { BaseAddress = new Uri(baseUrl) };\n            using var bmpRequest = new HttpRequestMessage(HttpMethod.Post, \"bmp\");\n            bmpRequest.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\n            bmpRequest.Headers.Accept.Add(new(\"application\u002Fjson\"));\n            var multipartContent = new MultipartFormDataContent();\n            var byteArray = File.ReadAllBytes(pathToFile);\n            var byteAryContent = new ByteArrayContent(byteArray);\n            multipartContent.Add(byteAryContent, \"file\", fileName);\n            byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Foctet-stream\");\n            bmpRequest.Headers.Add(\"response-type\", \"requestId\");\n            bmpRequest.Content = multipartContent;\n            var bmpResponse = await httpClient.SendAsync(bmpRequest);\n            return await bmpResponse.Content.ReadAsStringAsync();\n        }\n\n        private static async Task\u003Cstring> GetRequestStatusAsync(string baseUrl, string apiKey, string requestId)\n        {\n            using var httpClient = new HttpClient { BaseAddress = new Uri(baseUrl) };\n            using var request = new HttpRequestMessage(HttpMethod.Get, $\"request-status\u002F{requestId}\");\n            request.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\n            var response = await httpClient.SendAsync(request);\n            return await response.Content.ReadAsStringAsync();\n        }\n    }\n}\u003C\u002Fpre>\n\n\u003Cp>Source for Poll for API Request Status: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Frequest-status.cs\">View the C# sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the .NET request and JSON types\u003C\u002Fh3>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\nusing Newtonsoft.Json.Linq;\u003C\u002Fpre>\n\n\u003Cp>The Poll for API Request Status sample uses .NET HTTP types for requests and \u003Ccode>Newtonsoft.Json.Linq\u003C\u002Fcode> for response parsing. Its supporting namespaces cover the text and multipart values needed by this C# Poll for API Request Status workflow.\u003C\u002Fp>\n\n\u003Ch3>Validate input and load runtime configuration\u003C\u002Fh3>\n\n\u003Cpre class=\"language-csharp\">Console.Error.WriteLine($\"File not found: {inputPath}\");\n                Environment.Exit(1);\n                return;\n            }\n\n            var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\n            if (string.IsNullOrWhiteSpace(apiKey))\n            {\n                Console.Error.WriteLine(\"Missing required environment variable: PDFREST_API_KEY\");\n                Environment.Exit(1);\n                return;\n            }\n            var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n\n            \u002F\u002F Send initial request to an arbitrary route (bmp) with response-type header to get requestId\u003C\u002Fpre>\n\n\u003Cp>The .NET Poll for API Request Status example reads \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode> and optionally \u003Ccode>PDFREST_URL\u003C\u002Fcode> from the environment. That arrangement keeps C# Poll for API Request Status credentials out of source and permits US or EU routing without recompilation.\u003C\u002Fp>\n\n\u003Ch3>Submit work and retain the request ID\u003C\u002Fh3>\n\n\u003Cpre class=\"language-csharp\">\u002F\u002F Send initial request to an arbitrary route (bmp) with response-type header to get requestId\n            string bmpResponse = await GetBmpResponseAsync(baseUrl, apiKey, inputPath, Path.GetFileName(inputPath));\n            dynamic bmpJson = JObject.Parse(bmpResponse);\n            if (bmpJson.ContainsKey(\"error\"))\n            {\n                Console.Error.WriteLine($\"Error from initial request: {bmpJson.error}\");\n                Environment.Exit(1);\n                return;\n            }\n            string requestId = bmpJson.requestId;\n            Console.WriteLine($\"Received request ID: {requestId}\");\u003C\u002Fpre>\n\n\u003Cp>Adding \u003Ccode>response-type: requestId\u003C\u002Fcode> changes the initial C# processing response into an asynchronous identifier. The Poll for API Request Status operation continues normally while the C# caller prepares its status checks.\u003C\u002Fp>\n\n\u003Ch3>Poll until the status changes\u003C\u002Fh3>\n\n\u003Cpre class=\"language-csharp\">\u002F\u002F Poll request-status until not pending\n            string statusResponse = await GetRequestStatusAsync(baseUrl, apiKey, requestId);\n            dynamic statusJson = JObject.Parse(statusResponse);\n            while (statusJson.status == \"pending\")\n            {\n                const int delay = 5;\n                Console.WriteLine($\"Response from \u002Frequest-status for request {requestId}: {statusJson}\");\n                Console.WriteLine($\"Request status was \\\"pending\\\". Checking again in {delay} seconds...\");\n                await Task.Delay(TimeSpan.FromSeconds(delay));\n                statusResponse = await GetRequestStatusAsync(baseUrl, apiKey, requestId);\n                statusJson = JObject.Parse(statusResponse);\n            }\n            Console.WriteLine($\"Response from \u002Frequest-status: {statusJson}\");\n            Console.WriteLine(\"Done!\");\u003C\u002Fpre>\n\n\u003Cp>The C# status request addresses \u003Ccode>\u002Frequest-status\u002F{requestId}\u003C\u002Fcode> and repeats while the state is \u003Ccode>pending\u003C\u002Fcode>. A production C# Poll for API Request Status implementation should impose a deadline and handle every terminal error explicitly.\u003C\u002Fp>\n\n\u003Ch3>Define the initial asynchronous request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-csharp\">private static async Task\u003Cstring> GetBmpResponseAsync(string baseUrl, string apiKey, string pathToFile, string fileName)\n        {\n            using var httpClient = new HttpClient { BaseAddress = new Uri(baseUrl) };\n            using var bmpRequest = new HttpRequestMessage(HttpMethod.Post, \"bmp\");\n            bmpRequest.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\n            bmpRequest.Headers.Accept.Add(new(\"application\u002Fjson\"));\n            var multipartContent = new MultipartFormDataContent();\n            var byteArray = File.ReadAllBytes(pathToFile);\n            var byteAryContent = new ByteArrayContent(byteArray);\n            multipartContent.Add(byteAryContent, \"file\", fileName);\n            byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Foctet-stream\");\n            bmpRequest.Headers.Add(\"response-type\", \"requestId\");\n            bmpRequest.Content = multipartContent;\n            var bmpResponse = await httpClient.SendAsync(bmpRequest);\n            return await bmpResponse.Content.ReadAsStringAsync();\n        }\u003C\u002Fpre>\n\n\u003Cp>The C# request joins the Poll for API Request Status endpoint, authentication header, and prepared body. For this Poll for API Request Status call, the multipart metadata generated by C# must remain paired with the body so pdfRest can separate files from options.\u003C\u002Fp>\n\n\u003Ch3>Define the status lookup request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-csharp\">private static async Task\u003Cstring> GetRequestStatusAsync(string baseUrl, string apiKey, string requestId)\n        {\n            using var httpClient = new HttpClient { BaseAddress = new Uri(baseUrl) };\n            using var request = new HttpRequestMessage(HttpMethod.Get, $\"request-status\u002F{requestId}\");\n            request.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\n            var response = await httpClient.SendAsync(request);\n            return await response.Content.ReadAsStringAsync();\n        }\n    }\u003C\u002Fpre>\n\n\u003Cp>The final Poll for API Request Status handling in C# exposes the HTTP result and JSON body. Before using a Poll for API Request Status output or request ID, production C# code should verify the status and retain the identifier required by the next step.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You can now separate pdfRest submission from completion in C#, retain the returned request ID, and retrieve the terminal response on your own schedule.\u003C\u002Fp>\n\n\u003Cp>Treat the five-second delay as a configurable policy and cap the total polling duration. Record terminal error responses with the original input so operators can distinguish failed processing from network interruption or an expired job.\u003C\u002Fp>\n\n\u003Cp>Try the Poll for API Request Status workflow with a representative file in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, then adapt the request in C#. The \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fapi-polling\u002F\">API Polling Tool documentation\u003C\u002Fa> provides the complete C# context for Poll for API Request Status values, defaults, and limitations.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T23:50:57.000+00:00","Use .NET with C# to request asynchronous pdfRest processing and poll the returned request ID to a terminal status.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Poll for API Request Status in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-in-net-with-c\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Use .NET with C# to request asynchronous pdfRest processing and poll the returned request ID to a terminal status.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"API Polling API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fapi-polling\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"GET \u002Frequest-status\u002F{requestId} API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fapi-polling\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fbmp API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\"\n        }\n      ],\n      \"keywords\": \".NET, API Polling\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Poll for API Request Status in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9690,9691,9692,9693],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1919,"name":1920,"slug":1921,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-poll-for-api-request-status-in-net-with-c\u002F","Poll for API Request Status in .NET with C# | pdfRest",{"id":9698,"uuid":9699,"title":9700,"slug":9701,"html":9702,"comment_id":9698,"feature_image":48,"featured":284,"visibility":1257,"created_at":9703,"updated_at":9704,"published_at":9703,"custom_excerpt":9705,"codeinjection_head":9706,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9707,"primary_tag":9712,"url":9713,"excerpt":9705,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9714,"meta_description":9705,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"66297fa8533c9f26b9437408","3710405e-a94a-4b8c-adea-5e56e8c3b104","How to Poll for API Request Status with cURL","how-to-poll-for-api-request-status-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use API Polling with cURL?\u003C\u002Fh2>\n\n\u003Cp>\nThe pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fapi-polling\u002F\">API Polling Tool\u003C\u002Fa> offers a powerful solution for developers working with cURL and asynchronous pdfRest functionalities. cURL, a popular command-line tool, excels at making API calls. However, when dealing with complex tasks, requests can take longer to complete, which can result in timeouts, depending on your tools and implementation.\n\u003C\u002Fp>\n\n\u003Cp>\nImagine you're building a script that compresses a batch of large PDFs. Traditionally, you'd use cURL to send each conversion request and wait for each response to be returned before moving on. With API Polling enabled, the response immediately returns a unique \u003Ccode>requestID\u003C\u002Fcode>. Your script can then move on to other tasks while the conversion runs in the background. Later, when your script is ready, it can use cURL to send a separate request to the \u003Ccode>\u002Frequest-status\u003C\u002Fcode> endpoint with the \u003Ccode>requestID\u003C\u002Fcode> This provides a real-time update on the compression's status.  Based on the response, your script can then initiate the next step, such as downloading the compressed document. This approach allows your script to work efficiently, avoiding unnecessary waiting and streamlining the overall process.\n\u003C\u002Fp>\n\n\u003Ch2>API Polling with cURL Code Example\u003C\u002Fh2>\n\n\u003Ch3>Enable API Polling with Processing Step\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Response-Type: requestId\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\"\n\u003C\u002Fpre>\n\n\u003Ch3>Poll for Status of Processing Request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">curl -X GET \"https:\u002F\u002Fapi.pdfrest.com\u002Frequest-status\u002Fxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n    -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cbr>\n\n\u003Ch2>Breaking Down the POST Request Code\u003C\u002Fh2>\n\n\u003Cp>\nThe cURL commands provided above are structured to communicate with the pdfRest API to send a processing request with API Polling enabled and then to poll the status of the request. Here's a breakdown of  each part of the initial POST request:\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf\"\u003C\u002Fpre>\n\n\u003Cp>\nThis initializes a cURL request using the POST method to the specified URL, which is the endpoint for converting files to PDF - an example we use here to illustrate how to enable API Polling.  Note that API Polling can be enabled for any endpoint.\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\u003C\u002Fpre>\n\n\u003Cp>\nThis header tells the server that the client expects a response in JSON format.\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\u003C\u002Fpre>\n\n\u003Cp>\nThis header indicates that the data being sent is in multipart\u002Fform-data format, which is necessary for uploading files.\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Response-Type: requestId\"\u003C\u002Fpre>\n\n\u003Cp>\nThis is the important header parameter we are adding to the POST request that enables API Polling.  This tells pdfRest to immediately return a \u003Ccode>requestId\u003C\u002Fcode> instead of waiting for the processing to complete and returning the full response at that time. The \u003Ccode>requestId\u003C\u002Fcode> will be used to poll for the response status instead.\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\u003C\u002Fpre>\n\n\u003Cp>\nThe Api-Key header is used for authentication. Replace the placeholder with your actual API key provided by pdfRest.\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\u003C\u002Fpre>\n\n\u003Cp>\nThe -F flag is used to specify each file being uploaded. The '@' symbol is followed by the file path, which tells cURL to get the file content from the specified location. Repeat this flag for each file you wish to upload.\n\u003C\u002Fp>\n\n\u003Cp>\nInstead of returning a full JSON response after processing finishes, this will immediately return a JSON response with a single requestId, like:\n\u003C\u002Fp>\n\n\u003Cpre>{\n   \"requestId\": \"xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n}\n\u003C\u002Fpre>\n\n\u003Cbr>\n\n\u003Ch2>Breaking Down the GET Request Code\u003C\u002Fh2>\n\n\u003Cp>\nHere's a breakdown of  each part of the GET request to poll for the status to the previous POST request:\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">curl -X GET \"https:\u002F\u002Fapi.pdfrest.com\u002Frequest-status\u002Fxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\u003C\u002Fpre>\n\n\u003Cp>\nThis initializes a cURL request using the GET method to the specified URL, which is the endpoint for polling request statuses. Replace the placeholder with your actual \u003Ccode>requestID\u003C\u002Fcode> returned from the processing step.\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\u003C\u002Fpre>\n\n\u003Cp>\nAn Api-Key header is also required to use API Polling - replace with your actual key.\n\u003C\u002Fp>\n\n\u003Cp>\nIf the request has not yet completed, the response will look like this:\n\u003C\u002Fp>\n\n\u003Cpre>{\n   \"status\": \"pending\",\n   \"requestId\": \"xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n}\n\u003C\u002Fpre>\n\n\u003Cp>\nIf the request has completed, the response will look like this:\n\u003C\u002Fp>\n\n\u003Cpre>{\n   \"status\": \"completed\",\n   \"requestId\": \"xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n   \"outputUrl\": \"https:\u002F\u002Fapi.pdfrest.com\u002Fresource\u002F01240b25a-8936-4437-8652-8410130f1199?format=file\",\n   \"outputId\": \"01240b25a-8936-4437-8652-8410130f1199\",\n   \"inputId\": \"112f7ea0d-0e56-44bc-a3d2-42fdff96d993\"\n}\n\u003C\u002Fpre>\n\n\u003Cbr>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>\nBy following the above steps, you have learned how to use cURL to enable API Polling with your processing requests and poll for the status of the request. This offers flexibility in the design of your workflow and helps to prevent timeouts for longer-running processes. To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For a comprehensive understanding of the available endpoints and their functionalities, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fapi-polling\u002F\">API Reference Guide\u003C\u002Fa>.\n\u003C\u002Fp>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Frequest-status.sh\">GitHub\u003C\u002Fa>. This sample demonstrates a multipart processing request followed by status polling.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-04-24T21:54:48.000+00:00","2026-09-02T18:29:06.000+00:00","Learn how to use cURL with the pdfRest API Polling Tool to retrieve the status of a request","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-with-curl\u002F#article\",\n      \"headline\": \"How to Poll for API Request Status with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-with-curl\u002F\",\n      \"datePublished\": \"2024-04-24T21:54:48.000Z\",\n      \"dateModified\": \"2026-09-01T15:58:14.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use cURL with the pdfRest API Polling Tool to retrieve the status of a request\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"API Polling API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fapi-polling\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"GET \u002Frequest-status\u002F{requestId} API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fapi-polling\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"GET \u002Fresource\u002F{id} API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fretrieve-files\"\n        }\n      ],\n      \"keywords\": \"API Polling, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Poll for API Request Status with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9708,9709,9710,9711],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1919,"name":1920,"slug":1921,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-poll-for-api-request-status-with-curl\u002F","How to Poll for API Request Status with cURL, Tutorial | pdfRest",{"id":9716,"uuid":9717,"title":9718,"slug":9719,"html":9720,"comment_id":9716,"feature_image":48,"featured":284,"visibility":1257,"created_at":9504,"updated_at":9721,"published_at":9505,"custom_excerpt":9722,"codeinjection_head":9723,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9724,"primary_tag":9729,"url":9730,"excerpt":9722,"reading_time":369,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9731,"meta_description":9722,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c60533c9f26b943b59a","a2b35477-e157-4232-9617-b42454749c9b","How to Poll for API Request Status with Java","how-to-poll-for-api-request-status-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>In this tutorial, we'll walk through how to poll for API request status with Java using the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fapi-polling\u002F\">API Polling API Tool\u003C\u002Fa>. The workflow requests asynchronous PDF\u002FA processing, extracts the returned request ID, and checks its status through authenticated GET calls until completion or failure. You'll see how the request is assembled and how to work with the response returned when you poll for API request status.\u003C\u002Fp>\n\n\u003Ch2>Why Poll for API Request Status with Java?\u003C\u002Fh2>\n\n\u003Cp>Longer document operations can exceed the response window preferred by an application or gateway. Request polling lets the Java service receive a request ID immediately and check completion separately.\u003C\u002Fp>\n\n\u003Cp>The initial POST uses the \u003Ccode>response-type: requestId\u003C\u002Fcode> header. Java then calls \u003Ccode>\u002Frequest-status\u002F{requestId}\u003C\u002Fcode> until the response is completed or reports a terminal failure.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class RequestStatus {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  public static void main(String[] args) {\n\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n    String apiKey = dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY);\n\n    \u002F\u002F Using PDF\u002FA as an arbitrary example, send a request with a 'response-type' header.\n    String pdfaResponse = getPdfaResponse(inputFile, apiKey);\n    JSONObject pdfaJson = new JSONObject(pdfaResponse);\n    if (pdfaJson.has(\"error\")) {\n      System.out.println(\"Error during PDFA call: \" + pdfaJson.getString(\"error\"));\n    } else {\n      \u002F\u002F Get a request ID from the response.\n      String requestID = pdfaJson.getString(\"requestId\");\n\n      \u002F\u002F Check the request status.\n      String requestStatusResponse = getRequestStatusResponse(requestID, apiKey);\n      JSONObject requestStatusJson = new JSONObject(requestStatusResponse);\n\n      \u002F\u002F If still pending, check periodically for updates.\n      while (requestStatusJson.getString(\"status\").equals(\"pending\")) {\n        final int delay = 5000;\n        try {\n          Thread.sleep(delay);\n          requestStatusResponse = getRequestStatusResponse(requestID, apiKey);\n          requestStatusJson = new JSONObject(requestStatusResponse);\n        } catch (InterruptedException e) {\n          System.out.println(e);\n        }\n      }\n    }\n  }\n\n  private static String getPdfaResponse(File inputFile, String apiKey) {\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output_type\", \"PDF\u002FA-2u\")\n            .addFormDataPart(\"output\", \"pdfrest_pdfa\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", apiKey)\n            .header(\"response-type\", \"requestId\")\n            .url(API_URL + \"\u002Fpdfa\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      String responseBody = response.body().string();\n      System.out.println(prettyJson(responseBody));\n      return responseBody;\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String getRequestStatusResponse(String requestId, String apiKey) {\n    String urlString = String.format(API_URL + \"\u002Frequest-status\u002F%s\", requestId);\n    Request request = new Request.Builder().header(\"Api-Key\", apiKey).url(urlString).get().build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      String responseBody = response.body().string();\n      System.out.println(prettyJson(responseBody));\n      return responseBody;\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FRequestStatus.java\">Java sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The import block relies on OkHttp to send the call, dotenv to resolve credentials, and \u003Ccode>org.json\u003C\u002Fcode> to inspect or format JSON.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  public static void main(String[] args) {\n\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n    String apiKey = dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY);\n\n    \u002F\u002F Using PDF\u002FA as an arbitrary example, send a request with a 'response-type' header.\u003C\u002Fpre>\n\n\u003Cp>The constants section supports quick local testing while allowing normal callers to provide their own path and \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output_type\", \"PDF\u002FA-2u\")\n            .addFormDataPart(\"output\", \"pdfrest_pdfa\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", apiKey)\n            .header(\"response-type\", \"requestId\")\n            .url(API_URL + \"\u002Fpdfa\")\n            .post(requestBody)\n            .build();\n    try {\u003C\u002Fpre>\n\n\u003Cp>The initial POST uses the \u003Ccode>response-type: requestId\u003C\u002Fcode> header. Java then calls \u003Ccode>\u002Frequest-status\u002F{requestId}\u003C\u002Fcode> until the response is completed or reports a terminal failure. This payload builder collects the named parts before OkHttp calculates the final multipart header and body encoding.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", apiKey)\n            .header(\"response-type\", \"requestId\")\n            .url(API_URL + \"\u002Fpdfa\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The outbound call adds the API key header, selects the operation URL, and attaches the prepared body; changing the base constant switches between US and EU service hosts.\u003C\u002Fp>\n\n\u003Ch3>Read the request ID and wait for completion\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">JSONObject pdfaJson = new JSONObject(pdfaResponse);\n    if (pdfaJson.has(\"error\")) {\n      System.out.println(\"Error during PDFA call: \" + pdfaJson.getString(\"error\"));\n    } else {\n      \u002F\u002F Get a request ID from the response.\n      String requestID = pdfaJson.getString(\"requestId\");\n\n      \u002F\u002F Check the request status.\n      String requestStatusResponse = getRequestStatusResponse(requestID, apiKey);\n      JSONObject requestStatusJson = new JSONObject(requestStatusResponse);\n\n      \u002F\u002F If still pending, check periodically for updates.\n      while (requestStatusJson.getString(\"status\").equals(\"pending\")) {\n        final int delay = 5000;\n        try {\n          Thread.sleep(delay);\n          requestStatusResponse = getRequestStatusResponse(requestID, apiKey);\n          requestStatusJson = new JSONObject(requestStatusResponse);\n        } catch (InterruptedException e) {\n          System.out.println(e);\n        }\n      }\n    }\n  }\n\n  private static String getPdfaResponse(File inputFile, String apiKey) {\u003C\u002Fpre>\n\n\u003Cp>The initial PDF\u002FA response supplies \u003Ccode>requestId\u003C\u002Fcode>. The loop waits while the status remains \u003Ccode>pending\u003C\u002Fcode>, then asks the status endpoint again instead of resubmitting the document operation.\u003C\u002Fp>\n\n\u003Ch3>Build the status request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">private static String getRequestStatusResponse(String requestId, String apiKey) {\n    String urlString = String.format(API_URL + \"\u002Frequest-status\u002F%s\", requestId);\n    Request request = new Request.Builder().header(\"Api-Key\", apiKey).url(urlString).get().build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      String responseBody = response.body().string();\n      System.out.println(prettyJson(responseBody));\n      return responseBody;\n    } catch (IOException e) {\u003C\u002Fpre>\n\n\u003Cp>Status checks are authenticated GET requests whose URL includes the request ID; they do not send the original file or multipart body again.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      String responseBody = response.body().string();\n      System.out.println(prettyJson(responseBody));\n      return responseBody;\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String getRequestStatusResponse(String requestId, String apiKey) {\n    String urlString = String.format(API_URL + \"\u002Frequest-status\u002F%s\", requestId);\n    Request request = new Request.Builder().header(\"Api-Key\", apiKey).url(urlString).get().build();\u003C\u002Fpre>\n\n\u003Cp>The response describes the asynchronous request state and returns its eventual result when processing is complete, so callers should also handle pending and terminal failure states.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we walked through how to poll for API request status with Java. With that foundation, you can use asynchronous polling for long-running conversions, large documents, and queue-based systems that should not hold one HTTP request open.\u003C\u002Fp>\n\n\u003Cp>As you adapt this example for production, keep in mind that production polling should use a bounded interval, an overall timeout, and clear handling for completed and terminal failure states. Keep the request ID with the originating job so retries do not accidentally submit the expensive document operation again.\u003C\u002Fp>\n\n\u003Cp>To continue exploring the Poll for API Request Status operation, visit \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For complete request fields, defaults, and limitations, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fapi-polling\u002F\">API Polling API Tool documentation\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-02T18:29:07.000+00:00","Submit asynchronous pdfRest work and poll its status from Java.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-with-java\u002F#article\",\n      \"headline\": \"How to Poll for API Request Status with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:40.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:40.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Submit asynchronous pdfRest work and poll its status from Java.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"API Polling API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fapi-polling\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"GET \u002Frequest-status\u002F{requestId} API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fapi-polling\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF\u002FA API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfa\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdfa API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-pdfa\"\n        }\n      ],\n      \"keywords\": \"API Polling, Java\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Poll for API Request Status with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9725,9726,9727,9728],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1919,"name":1920,"slug":1921,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-poll-for-api-request-status-with-java\u002F","Poll for API Request Status with Java | pdfRest",{"id":9733,"uuid":9734,"title":9735,"slug":9736,"html":9737,"comment_id":9733,"feature_image":48,"featured":284,"visibility":1257,"created_at":9738,"updated_at":9471,"published_at":9471,"custom_excerpt":9739,"codeinjection_head":9740,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9741,"primary_tag":9746,"url":9747,"excerpt":9739,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9748,"meta_description":9739,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a9764e0533c9f26b943b7e0","9528e2be-b696-4a46-8aeb-8cdcbea1096b","How to Poll for API Request Status with JavaScript in NodeJS","how-to-poll-for-api-request-status-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This step-by-step guide demonstrates how to submit asynchronous document work and poll its request status from a NodeJS service through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fapi-polling\u002F\">API Polling Tool\u003C\u002Fa>. Along the way, we'll distinguish the JavaScript in NodeJS syntax from the Poll for API Request Status API contract and show how its returned data supports the next step.\u003C\u002Fp>\n\n\u003Ch2>Why Poll for API Request Status with JavaScript in NodeJS?\u003C\u002Fh2>\n\n\u003Cp>A NodeJS service does not need to keep a long document-processing request open until the result is ready. Asking for a request ID separates submission from completion and allows other application work to continue.\u003C\u002Fp>\n\n\u003Cp>Imagine an API gateway that starts a large PDF-to-image job but has a short upstream timeout. The service can return control after submission, place the request ID on a queue, and let a worker call the status route until the output or an error becomes available.\u003C\u002Fp>\n\n\u003Cp>The example uses an asynchronous sleep between GET requests and stops when the reported status is no longer \u003Ccode>pending\u003C\u002Fcode>. Production logic should treat completion and failure as distinct terminal outcomes rather than assuming every non-pending response succeeded.\u003C\u002Fp>\n\n\u003Ch2>JavaScript in NodeJS Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">const axios = require(\"axios\");\nconst FormData = require(\"form-data\");\nconst fs = require(\"fs\");\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\nconst apiKey = \"xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"; \u002F\u002F Replace with your API key\nconst pathToFile = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n\nconst sleep = (ms) => {\n  return new Promise(resolve => setTimeout(resolve, ms));\n}\n\nconst sendBmpReq = async (config) => {\n  return await axios(config);\n};\n\nconst pollUntilFulfilled = async (requestId) => {\n  const pollConfig = {\n    method: \"get\",\n    maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n    url: `${apiUrl}\u002Frequest-status\u002F${requestId}`,\n    headers: { \"Api-Key\": apiKey }\n  };\n  requestStatusResponse = await axios(pollConfig);\n  let status = requestStatusResponse.data.status;\n\n  \u002F\u002F This example will repeat the GET request until the BMP request is completed.\n  while (status === \"pending\") {\n    console.log(JSON.stringify(requestStatusResponse.data));\n    await sleep(5000);\n    requestStatusResponse = await axios(pollConfig);\n    status = requestStatusResponse.data.status;\n  }\n  console.log(JSON.stringify(requestStatusResponse.data));\n};\n\nconst demoApiPolling = async () => {\n  try {\n    \u002F\u002F Send a request with the Response-Type header (using \u002Fbmp as an arbitrary example)\n    const bmpRequestData = new FormData();\n    bmpRequestData.append(\"file\", fs.createReadStream(pathToFile));\n\n    const bmpConfig = {\n      method: \"post\",\n      maxBodyLength: Infinity,\n      url: apiUrl + \"\u002Fbmp\",\n      headers: {\n        \"Api-Key\": apiKey,\n        \"Response-Type\": \"requestId\", \u002F\u002F Use this header to get a request ID.\n        ...bmpRequestData.getHeaders(),\n      },\n      data: bmpRequestData,\n    };\n    bmpResponse = await sendBmpReq(bmpConfig);\n    console.log(JSON.stringify(bmpResponse.data));\n\n    \u002F\u002F Get the request ID from the initial response.\n    const requestId = bmpResponse.data.requestId;\n    await pollUntilFulfilled(requestId);\n  } catch (err) {\n    console.error(err);\n  }\n};\n\ndemoApiPolling();\u003C\u002Fpre>\n\n\u003Cp>Source for Poll for API Request Status: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Frequest-status.js\">View the JavaScript in NodeJS sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the NodeJS request and file modules\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">const axios = require(\"axios\");\nconst FormData = require(\"form-data\");\nconst fs = require(\"fs\");\u003C\u002Fpre>\n\n\u003Cp>Axios sends the HTTP calls for Poll for API Request Status, \u003Ccode>FormData\u003C\u002Fcode> constructs multipart bodies when needed, and Node's \u003Ccode>fs\u003C\u002Fcode> module opens local files as streams. Together, these packages provide the transport and file handling required by the JavaScript Poll for API Request Status sample.\u003C\u002Fp>\n\n\u003Ch3>Select the pdfRest service region\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\nconst apiKey = \"xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"; \u002F\u002F Replace with your API key\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>apiUrl\u003C\u002Fcode> centralizes regional routing for Poll for API Request Status. The NodeJS Poll for API Request Status flow can switch to the documented EU hostname without changing the endpoint paths that follow.\u003C\u002Fp>\n\n\u003Ch3>Define the asynchronous status loop\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">const sleep = (ms) => {\n  return new Promise(resolve => setTimeout(resolve, ms));\n}\n\nconst sendBmpReq = async (config) => {\n  return await axios(config);\n};\n\nconst pollUntilFulfilled = async (requestId) => {\n  const pollConfig = {\n    method: \"get\",\n    maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n    url: `${apiUrl}\u002Frequest-status\u002F${requestId}`,\n    headers: { \"Api-Key\": apiKey }\n  };\n  requestStatusResponse = await axios(pollConfig);\n  let status = requestStatusResponse.data.status;\n\n  \u002F\u002F This example will repeat the GET request until the BMP request is completed.\n  while (status === \"pending\") {\n    console.log(JSON.stringify(requestStatusResponse.data));\n    await sleep(5000);\n    requestStatusResponse = await axios(pollConfig);\n    status = requestStatusResponse.data.status;\n  }\n  console.log(JSON.stringify(requestStatusResponse.data));\n};\u003C\u002Fpre>\n\n\u003Cp>The JavaScript in NodeJS status request addresses \u003Ccode>\u002Frequest-status\u002F{requestId}\u003C\u002Fcode> and repeats while the state is \u003Ccode>pending\u003C\u002Fcode>. A production JavaScript in NodeJS Poll for API Request Status implementation should impose a deadline and handle every terminal error explicitly.\u003C\u002Fp>\n\n\u003Ch3>Submit the initial operation for a request ID\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">const demoApiPolling = async () => {\n  try {\n    \u002F\u002F Send a request with the Response-Type header (using \u002Fbmp as an arbitrary example)\n    const bmpRequestData = new FormData();\n    bmpRequestData.append(\"file\", fs.createReadStream(pathToFile));\n\n    const bmpConfig = {\n      method: \"post\",\n      maxBodyLength: Infinity,\n      url: apiUrl + \"\u002Fbmp\",\n      headers: {\n        \"Api-Key\": apiKey,\n        \"Response-Type\": \"requestId\", \u002F\u002F Use this header to get a request ID.\n        ...bmpRequestData.getHeaders(),\n      },\n      data: bmpRequestData,\n    };\n    bmpResponse = await sendBmpReq(bmpConfig);\n    console.log(JSON.stringify(bmpResponse.data));\n\n    \u002F\u002F Get the request ID from the initial response.\n    const requestId = bmpResponse.data.requestId;\n    await pollUntilFulfilled(requestId);\n  } catch (err) {\u003C\u002Fpre>\n\n\u003Cp>Adding \u003Ccode>response-type: requestId\u003C\u002Fcode> changes the initial JavaScript in NodeJS processing response into an asynchronous identifier. The Poll for API Request Status operation continues normally while the JavaScript in NodeJS caller prepares its status checks.\u003C\u002Fp>\n\n\u003Ch3>Pass the returned ID into the poller\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F Get the request ID from the initial response.\n    const requestId = bmpResponse.data.requestId;\n    await pollUntilFulfilled(requestId);\n  } catch (err) {\n    console.error(err);\u003C\u002Fpre>\n\n\u003Cp>The final Poll for API Request Status handling in JavaScript in NodeJS exposes the HTTP result and JSON body. Before using a Poll for API Request Status output or request ID, production JavaScript in NodeJS code should verify the status and retain the identifier required by the next step.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You can now separate pdfRest submission from completion in JavaScript in NodeJS, retain the returned request ID, and retrieve the terminal response on your own schedule.\u003C\u002Fp>\n\n\u003Cp>Persist the request ID with the originating job and apply a timeout or retry ceiling. This prevents an interrupted process from losing track of work and keeps an unexpected status response from creating an endless polling loop.\u003C\u002Fp>\n\n\u003Cp>Try the Poll for API Request Status workflow with a representative file in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, then adapt the request in JavaScript in NodeJS. The \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fapi-polling\u002F\">API Polling Tool documentation\u003C\u002Fa> provides the complete JavaScript in NodeJS context for Poll for API Request Status values, defaults, and limitations.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T23:50:56.000+00:00","Implement asynchronous pdfRest request polling with JavaScript in NodeJS and retrieve the completed operation response.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Poll for API Request Status with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Implement asynchronous pdfRest request polling with JavaScript in NodeJS and retrieve the completed operation response.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"API Polling API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fapi-polling\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"GET \u002Frequest-status\u002F{requestId} API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fapi-polling\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fbmp API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\"\n        }\n      ],\n      \"keywords\": \"API Polling, JavaScript\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Poll for API Request Status with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9742,9743,9744,9745],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1919,"name":1920,"slug":1921,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-poll-for-api-request-status-with-javascript-in-nodejs\u002F","Poll for API Request Status with JavaScript in NodeJS | pdfRest",{"id":9750,"uuid":9751,"title":9752,"slug":9753,"html":9754,"comment_id":9750,"feature_image":48,"featured":284,"visibility":1257,"created_at":9738,"updated_at":9755,"published_at":9755,"custom_excerpt":9756,"codeinjection_head":9757,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9758,"primary_tag":9763,"url":9764,"excerpt":9756,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9765,"meta_description":9756,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a9764e0533c9f26b943b7d7","8852f62d-162f-401f-93f1-ccc2bf471148","How to Poll for API Request Status with PHP","how-to-poll-for-api-request-status-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Cp>Follow this PHP walkthrough to submit asynchronous document work and poll its request status with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fapi-polling\u002F\">API Polling Tool\u003C\u002Fa>. You'll see the complete Poll for API Request Status sample first, then examine the transport code and API fields that matter when this PHP pattern moves into an application.\u003C\u002Fp>\n\n\u003Ch2>Why Poll for API Request Status with PHP?\u003C\u002Fh2>\n\n\u003Cp>Document operations can run longer than an application server, proxy, or worker should keep one HTTP response open. API Polling returns a request ID promptly and lets the caller retrieve progress through a separate status endpoint.\u003C\u002Fp>\n\n\u003Cp>A PHP queue worker processing large page images can submit the conversion, release the original request path, and check status on a controlled interval. Once the job leaves \u003Ccode>pending\u003C\u002Fcode>, the worker can store the completed response or route an error for review.\u003C\u002Fp>\n\n\u003Cp>The initial operation needs the \u003Ccode>response-type: requestId\u003C\u002Fcode> header. The returned identifier belongs in \u003Ccode>\u002Frequest-status\u002F{requestId}\u003C\u002Fcode>; it is not a file resource ID and should not be passed to document-processing endpoints.\u003C\u002Fp>\n\n\u003Ch2>PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client\n\n$apiKey = 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'; \u002F\u002F Your API key goes here.\n\n$headers = [\n  'Api-Key' => $apiKey,\n  'response-type' => 'requestId' \u002F\u002F Use this header to obtain a request status.\n];\n\n$pngOptions = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile.pdf', 'r'),\n      'filename' => 'file.pdf',\n      'headers' => [\n        'Content-Type' => '\u003CContent-type header>'\n      ]\n    ]\n  ]\n];\n\n\u002F\u002F Using \u002Fpng as an arbitrary example, send a request with the Request-Type header.\n$pngRequest = new Request('POST', $apiUrl.'\u002Fpng', $headers);\n\n$pngResponse = $client->sendAsync($pngRequest, $pngOptions)->wait();\n\necho $pngResponse->getBody();\necho \"\\r\\n\";\n\n\u002F\u002F Get the request ID from the response.\n$requestId = json_decode($pngResponse->getBody())->{'requestId'};\n\n\u002F\u002F Get the status of the PNG request by its ID.\n$request_status_endpoint_url = $apiUrl.'\u002Frequest-status\u002F'.$requestId;\n\n$headers = [\n  'Api-Key' => $apiKey\n];\n\n$request = new Request('GET', $request_status_endpoint_url, $headers);\n\n$res = $client->sendAsync($request)->wait();\n\n$status = json_decode($res->getBody())->{'status'};\n\n\u002F\u002F This example repeats the status request until the request is fulfilled.\nwhile (strcmp($status, \"pending\") == 0):\n  echo $res->getBody(); \u002F\u002F Output the response body, which contains the status information.\n  echo \"\\r\\n\";\n  sleep(5);\n  $res = $client->sendAsync($request)->wait();\n  $status = json_decode($res->getBody())->{'status'};\nendwhile;\n\necho $res->getBody();\necho \"\\r\\n\";\u003C\u002Fpre>\n\n\u003Cp>Source for Poll for API Request Status: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Frequest-status.php\">View the PHP sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load Guzzle and its stream helpers\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\u003C\u002Fpre>\n\n\u003Cp>Guzzle supplies the HTTP client and PSR-7 request objects used throughout the Poll for API Request Status example. For this PHP Poll for API Request Status flow, \u003Ccode>Utils::tryFopen\u003C\u002Fcode> creates readable multipart streams without loading every uploaded byte into one string.\u003C\u002Fp>\n\n\u003Ch3>Select the pdfRest service region\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client\u003C\u002Fpre>\n\n\u003Cp>The active \u003Ccode>$apiUrl\u003C\u002Fcode> selects the US service for Poll for API Request Status; the commented assignment shows the EU alternative. Keep the PHP uploads, request IDs, and generated resources for Poll for API Request Status on that same regional host.\u003C\u002Fp>\n\n\u003Ch3>Submit work for asynchronous processing\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">$headers = [\n  'Api-Key' => $apiKey,\n  'response-type' => 'requestId' \u002F\u002F Use this header to obtain a request status.\n];\n\n$pngOptions = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile.pdf', 'r'),\n      'filename' => 'file.pdf',\n      'headers' => [\n        'Content-Type' => '\u003CContent-type header>'\n      ]\n    ]\n  ]\n];\n\n\u002F\u002F Using \u002Fpng as an arbitrary example, send a request with the Request-Type header.\n$pngRequest = new Request('POST', $apiUrl.'\u002Fpng', $headers);\n\n$pngResponse = $client->sendAsync($pngRequest, $pngOptions)->wait();\n\necho $pngResponse->getBody();\necho \"\\r\\n\";\u003C\u002Fpre>\n\n\u003Cp>Adding \u003Ccode>response-type: requestId\u003C\u002Fcode> changes the initial PHP processing response into an asynchronous identifier. The Poll for API Request Status operation continues normally while the PHP caller prepares its status checks.\u003C\u002Fp>\n\n\u003Ch3>Build the status request from the returned ID\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">\u002F\u002F Get the status of the PNG request by its ID.\n$request_status_endpoint_url = $apiUrl.'\u002Frequest-status\u002F'.$requestId;\n\n$headers = [\n  'Api-Key' => $apiKey\n];\n\n$request = new Request('GET', $request_status_endpoint_url, $headers);\n\n$res = $client->sendAsync($request)->wait();\n\n$status = json_decode($res->getBody())->{'status'};\n\n\u002F\u002F This example repeats the status request until the request is fulfilled.\nwhile (strcmp($status, \"pending\") == 0):\u003C\u002Fpre>\n\n\u003Cp>The PHP code places the returned request ID into \u003Ccode>\u002Frequest-status\u002F{requestId}\u003C\u002Fcode> and authenticates the GET call. Within the PHP Poll for API Request Status flow, this tracks processing state rather than an uploaded or generated file resource.\u003C\u002Fp>\n\n\u003Ch3>Repeat status checks while work is pending\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">while (strcmp($status, \"pending\") == 0):\n  echo $res->getBody(); \u002F\u002F Output the response body, which contains the status information.\n  echo \"\\r\\n\";\n  sleep(5);\n  $res = $client->sendAsync($request)->wait();\n  $status = json_decode($res->getBody())->{'status'};\nendwhile;\n\necho $res->getBody();\necho \"\\r\\n\";\u003C\u002Fpre>\n\n\u003Cp>The PHP status request addresses \u003Ccode>\u002Frequest-status\u002F{requestId}\u003C\u002Fcode> and repeats while the state is \u003Ccode>pending\u003C\u002Fcode>. A production PHP Poll for API Request Status implementation should impose a deadline and handle every terminal error explicitly.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You can now separate pdfRest submission from completion in PHP, retain the returned request ID, and retrieve the terminal response on your own schedule.\u003C\u002Fp>\n\n\u003Cp>Use a bounded polling interval, a maximum wait time, and explicit handling for terminal failure states. The sample sleeps five seconds between checks, which is a useful starting point but should fit the latency and load expectations of the calling system.\u003C\u002Fp>\n\n\u003Cp>Try the Poll for API Request Status workflow with a representative file in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, then adapt the request in PHP. The \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fapi-polling\u002F\">API Polling Tool documentation\u003C\u002Fa> provides the complete PHP context for Poll for API Request Status values, defaults, and limitations.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-03T17:04:41.000+00:00","Submit longer pdfRest work asynchronously and poll its request status from PHP without holding one processing response open.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-with-php\u002F#article\",\n      \"headline\": \"How to Poll for API Request Status with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-with-php\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Submit longer pdfRest work asynchronously and poll its request status from PHP without holding one processing response open.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"API Polling API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fapi-polling\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"GET \u002Frequest-status\u002F{requestId} API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fapi-polling\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"PDF to Images API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-images\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpng API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-images\"\n        }\n      ],\n      \"keywords\": \"API Polling, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Poll for API Request Status with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9759,9760,9761,9762],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1919,"name":1920,"slug":1921,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-poll-for-api-request-status-with-php\u002F","Poll for API Request Status with PHP | pdfRest",{"id":9767,"uuid":9768,"title":9769,"slug":9770,"html":9771,"comment_id":9767,"feature_image":48,"featured":284,"visibility":1257,"created_at":9686,"updated_at":9755,"published_at":9755,"custom_excerpt":9772,"codeinjection_head":9773,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9774,"primary_tag":9779,"url":9780,"excerpt":9772,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9781,"meta_description":9772,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a9764e1533c9f26b943b7e9","a69f272d-5fe3-4084-ad90-791e77bdc0ca","How to Poll for API Request Status with Python","how-to-poll-for-api-request-status-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Cp>Learn how to submit asynchronous document work and poll its request status using Python and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fapi-polling\u002F\">API Polling Tool\u003C\u002Fa>. This Poll for API Request Status tutorial keeps the official sample intact and breaks down authentication, payload construction, endpoint behavior, and result handling for Python.\u003C\u002Fp>\n\n\u003Ch2>Why Poll for API Request Status with Python?\u003C\u002Fh2>\n\n\u003Cp>Batch pipelines often submit work that may outlast a convenient synchronous HTTP window. API Polling lets Python receive a lightweight request identifier, continue other tasks, and return for the completed response later.\u003C\u002Fp>\n\n\u003Cp>A data-processing job converting a large archive to PDF\u002FA can submit one item, retain its request ID in the batch record, and periodically inspect status while other documents move through the queue. This avoids tying progress to one continuously open connection.\u003C\u002Fp>\n\n\u003Cp>The sample demonstrates the pattern with \u003Ccode>\u002Fpdfa\u003C\u002Fcode>, but the polling contract applies to supported pdfRest processing requests generally. The \u003Ccode>Response-Type\u003C\u002Fcode> header changes the immediate response shape; it does not change the operation being performed.\u003C\u002Fp>\n\n\u003Ch2>Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\nimport time\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\n\napi_key = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n\npdfa_endpoint_url = api_url+'\u002Fpdfa'\n\nmp_encoder_pdfa = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile.pdf', 'rb'), 'application\u002Fpdf'),\n        'output_type': 'PDF\u002FA-1b',\n    }\n)\n\n# Send a request to a pdfRest tool with the Response-Type header to get a request ID,\npdfa_headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdfa.content_type,\n    'Response-Type': \"requestId\",\n    'Api-Key': api_key\n}\n\nprint(\"Sending POST request to pdfa endpoint...\")\nresponse = requests.post(pdfa_endpoint_url, data=mp_encoder_pdfa, headers=pdfa_headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n\n    response_json = response.json()\n    request_id = response_json[\"requestId\"]\n    api_polling_endpoint_url = f'{api_url}\u002Frequest-status\u002F{request_id}'\n\n    headers = {\n        'Api-Key': api_key\n    }\n\n    print(\"Sending GET request to request-status endpoint...\")\n    response = requests.get(api_polling_endpoint_url, headers=headers)\n\n    print(\"Response status code: \" + str(response.status_code))\n\n    if response.ok:\n        response_json = response.json()\n        while response_json[\"status\"] == \"pending\":\n            # This example will get the request status every 5 seconds until the request is completed.\n            print(json.dumps(response_json, indent = 2))\n            time.sleep(5)\n            response = requests.get(api_polling_endpoint_url, headers=headers)\n            response_json = response.json()\n        print(json.dumps(response_json, indent = 2))\n    else:\n        print(response.text)\u003C\u002Fpre>\n\n\u003Cp>Source for Poll for API Request Status: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Frequest-status.py\">View the Python sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Import the HTTP and multipart helpers\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\nimport time\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>requests\u003C\u002Fcode> handles the HTTP exchange for Poll for API Request Status, while \u003Ccode>MultipartEncoder\u003C\u002Fcode> constructs form-data bodies with a boundary that the request header can reuse. The remaining Python modules support the response or timing behavior used specifically by Poll for API Request Status.\u003C\u002Fp>\n\n\u003Ch3>Select the pdfRest service region\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\"># By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\n\napi_key = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\u003C\u002Fpre>\n\n\u003Cp>The Python configuration keeps the pdfRest hostname separate from each Poll for API Request Status route. Using one regional base URL throughout this Python Poll for API Request Status job keeps its returned identifiers available to later requests.\u003C\u002Fp>\n\n\u003Ch3>Prepare the operation and request an ID\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\">mp_encoder_pdfa = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile.pdf', 'rb'), 'application\u002Fpdf'),\n        'output_type': 'PDF\u002FA-1b',\n    }\n)\n\n# Send a request to a pdfRest tool with the Response-Type header to get a request ID,\npdfa_headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdfa.content_type,\n    'Response-Type': \"requestId\",\n    'Api-Key': api_key\n}\n\nprint(\"Sending POST request to pdfa endpoint...\")\nresponse = requests.post(pdfa_endpoint_url, data=mp_encoder_pdfa, headers=pdfa_headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\u003C\u002Fpre>\n\n\u003Cp>Adding \u003Ccode>response-type: requestId\u003C\u002Fcode> changes the initial Python processing response into an asynchronous identifier. The Poll for API Request Status operation continues normally while the Python caller prepares its status checks.\u003C\u002Fp>\n\n\u003Ch3>Build the status route from the returned ID\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\">response_json = response.json()\n    request_id = response_json[\"requestId\"]\n    api_polling_endpoint_url = f'{api_url}\u002Frequest-status\u002F{request_id}'\n\n    headers = {\n        'Api-Key': api_key\n    }\n\n    print(\"Sending GET request to request-status endpoint...\")\n    response = requests.get(api_polling_endpoint_url, headers=headers)\n\n    print(\"Response status code: \" + str(response.status_code))\n\n    if response.ok:\n        response_json = response.json()\n        while response_json[\"status\"] == \"pending\":\u003C\u002Fpre>\n\n\u003Cp>The Python code places the returned request ID into \u003Ccode>\u002Frequest-status\u002F{requestId}\u003C\u002Fcode> and authenticates the GET call. Within the Python Poll for API Request Status flow, this tracks processing state rather than an uploaded or generated file resource.\u003C\u002Fp>\n\n\u003Ch3>Wait and check until processing finishes\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\">while response_json[\"status\"] == \"pending\":\n            # This example will get the request status every 5 seconds until the request is completed.\n            print(json.dumps(response_json, indent = 2))\n            time.sleep(5)\n            response = requests.get(api_polling_endpoint_url, headers=headers)\n            response_json = response.json()\n        print(json.dumps(response_json, indent = 2))\n    else:\n        print(response.text)\u003C\u002Fpre>\n\n\u003Cp>The Python status request addresses \u003Ccode>\u002Frequest-status\u002F{requestId}\u003C\u002Fcode> and repeats while the state is \u003Ccode>pending\u003C\u002Fcode>. A production Python Poll for API Request Status implementation should impose a deadline and handle every terminal error explicitly.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You can now separate pdfRest submission from completion in Python, retain the returned request ID, and retrieve the terminal response on your own schedule.\u003C\u002Fp>\n\n\u003Cp>Add a deadline, backoff policy, and logging around every request ID. If the process restarts, durable storage should provide enough context to resume checking rather than submit duplicate document work unnecessarily.\u003C\u002Fp>\n\n\u003Cp>Try the Poll for API Request Status workflow with a representative file in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, then adapt the request in Python. The \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fapi-polling\u002F\">API Polling Tool documentation\u003C\u002Fa> provides the complete Python context for Poll for API Request Status values, defaults, and limitations.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Poll asynchronous pdfRest operations with Python by requesting an ID first and checking status until processing finishes.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-with-python\u002F#article\",\n      \"headline\": \"How to Poll for API Request Status with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-with-python\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Poll asynchronous pdfRest operations with Python by requesting an ID first and checking status until processing finishes.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"API Polling API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fapi-polling\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"GET \u002Frequest-status\u002F{requestId} API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fapi-polling\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF\u002FA API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdfa\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdfa API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-pdf-to-pdfa\"\n        }\n      ],\n      \"keywords\": \"API Polling, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Poll for API Request Status with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-poll-for-api-request-status-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9775,9776,9777,9778],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1919,"name":1920,"slug":1921,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-poll-for-api-request-status-with-python\u002F","Poll for API Request Status with Python | pdfRest",{"id":9783,"uuid":9784,"title":9785,"slug":9786,"html":9787,"comment_id":9783,"feature_image":48,"featured":284,"visibility":1257,"created_at":9788,"updated_at":9789,"published_at":9788,"custom_excerpt":9790,"codeinjection_head":9791,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9792,"primary_tag":9799,"url":9800,"excerpt":9790,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9801,"meta_description":9790,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6793e0a9533c9f26b94391fe","97b207f8-fcb5-437b-9b31-2ec66955c793","How to Rasterize PDF Files in .NET with C#","how-to-rasterize-pdf-files-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Rasterize PDF Files with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frasterize-pdf\u002F'>Rasterize PDF API Tool\u003C\u002Fa> allows developers to convert PDF documents into rasterized images using a simple API call. This tutorial will guide you through the process of sending an API request to the Rasterize PDF endpoint using C#. By leveraging this tool, you can easily integrate PDF rasterization capabilities into your C# applications, enabling you to convert PDFs into images for various use cases.\u003C\u002Fp>\n\n\u003Cp>You might want to use the Rasterize PDF functionality to generate image previews of PDF documents for a web application. This can be particularly useful for displaying thumbnails or preview images of PDFs, allowing users to quickly view the content without downloading the entire document. Rasterizing PDFs can also be helpful when you need to ensure consistent rendering of PDF content across different platforms and devices.\u003C\u002Fp>\n\n\u003Ch2>Rasterize PDF with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"rasterized-pdf\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Frasterized-pdf.cs\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by setting up an \u003Ccode>HttpClient\u003C\u002Fcode> with the base address of the pdfRest API:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") }\n\u003C\u002Fpre>\n\n\u003Cp>This initializes the HTTP client to communicate with the pdfRest API server.\u003C\u002Fp>\n\n\u003Cp>Next, a \u003Ccode>HttpRequestMessage\u003C\u002Fcode> is created for the POST method to the \"rasterized-pdf\" endpoint:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var request = new HttpRequestMessage(HttpMethod.Post, \"rasterized-pdf\")\n\u003C\u002Fpre>\n\n\u003Cp>This specifies the API endpoint to which the request will be sent.\u003C\u002Fp>\n\n\u003Cp>The API key is added to the request headers for authentication:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\")\n\u003C\u002Fpre>\n\n\u003Cp>Replace \u003Ccode>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\u003C\u002Fcode> with your actual API key.\u003C\u002Fp>\n\n\u003Cp>The request is set to accept JSON responses:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.Accept.Add(new(\"application\u002Fjson\"))\n\u003C\u002Fpre>\n\n\u003Cp>This indicates that the client expects a JSON response from the server.\u003C\u002Fp>\n\n\u003Cp>A \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> is created to hold the PDF file:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent()\n\u003C\u002Fpre>\n\n\u003Cp>This is used to send the PDF file as part of the request payload.\u003C\u002Fp>\n\n\u003Cp>The PDF file is read into a byte array and added to the multipart content:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\")\nvar byteAryContent = new ByteArrayContent(byteArray)\nmultipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\")\n\u003C\u002Fpre>\n\n\u003Cp>Ensure to replace \u003Ccode>\u002Fpath\u002Fto\u002Ffile\u003C\u002Fcode> and \u003Ccode>file_name.pdf\u003C\u002Fcode> with the actual file path and name.\u003C\u002Fp>\n\n\u003Cp>The content type for the file is set to \"application\u002Fpdf\":\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\")\n\u003C\u002Fpre>\n\n\u003Cp>This specifies that the file being sent is a PDF.\u003C\u002Fp>\n\n\u003Cp>The request content is set to the multipart content, and the request is sent asynchronously:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Content = multipartContent\nvar response = await httpClient.SendAsync(request)\n\u003C\u002Fpre>\n\n\u003Cp>This sends the request to the server and waits for a response.\u003C\u002Fp>\n\n\u003Cp>The response content is read as a string and printed to the console:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiResult = await response.Content.ReadAsStringAsync()\nConsole.WriteLine(\"API response received.\")\nConsole.WriteLine(apiResult)\n\u003C\u002Fpre>\n\n\u003Cp>This outputs the API response to the console for review.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use the pdfRest Rasterize PDF API Tool to flatten each page of a PDF into a rasterized image using C#. This example demonstrated how to construct and send a multipart API request to the pdfRest server and handle the response.\u003C\u002Fp>\n\n\u003Cp>To explore more about pdfRest API Tools, you can try out the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed documentation, visit the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. Additionally, note that this example uses a multipart API call, and code samples using JSON payloads can be found \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Frasterized-pdf.cs\">here\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-01-24T18:49:13.000+00:00","2026-09-02T18:29:15.000+00:00","Learn how to flatten each page of a PDF document to a rasterized image with C# using pdfRest Rasterize PDF API tool.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Rasterize PDF Files in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-in-net-with-c\u002F\",\n      \"datePublished\": \"2025-01-24T18:49:13.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:19.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to flatten each page of a PDF document to a rasterized image with C# using pdfRest Rasterize PDF API tool.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Rasterize PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frasterize-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Frasterized-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Frasterize-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Optimization, Print, Rasterize PDF\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Rasterize PDF Files in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9793,9794,9795,9796,9797,9798],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1931,"name":1932,"slug":1933,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2137,"name":2138,"slug":2139,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1891,"name":1892,"slug":1893,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-rasterize-pdf-files-in-net-with-c\u002F","How to Rasterize PDF Files in .NET with C#, Tutorial | pdfRest",{"id":9803,"uuid":9804,"title":9805,"slug":9806,"html":9807,"comment_id":9803,"feature_image":48,"featured":284,"visibility":1257,"created_at":9808,"updated_at":9809,"published_at":9808,"custom_excerpt":9810,"codeinjection_head":9811,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9812,"primary_tag":9819,"url":9820,"excerpt":9810,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9821,"meta_description":9810,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6793e135533c9f26b9439212","00e91c3d-fbde-45ee-b5ab-d8903720d967","How to Rasterize PDF Files with cURL","how-to-rasterize-pdf-files-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Rasterize PDF Files with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frasterize-pdf\u002F'>Rasterize PDF API Tool\u003C\u002Fa> is a powerful utility that allows users to convert vector-based PDF files into rasterized images. This process can be beneficial for ensuring consistent rendering across different platforms and devices. In this tutorial, we will demonstrate how to send an API call to the Rasterize PDF endpoint using cURL, a command-line tool for transferring data with URLs.\u003C\u002Fp>\n\n\u003Cp>A user might need to rasterize a PDF to ensure that the document's appearance remains consistent when viewed on various devices or platforms that may not support vector graphics. For example, a graphic designer might rasterize a PDF to ensure that complex designs or fonts display correctly when shared with clients who might use different software or devices.\u003C\u002Fp>\n\n\u003Ch2>Rasterize PDF with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Frasterized-pdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Frasterized-pdf.sh\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code provided is a cURL command that sends a POST request to the pdfRest API to rasterize a PDF file. Let's break down each part:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Frasterized-pdf\"\u003C\u002Fpre>\n\n\u003Cp>This line specifies the use of cURL to make a POST request to the specified URL, which is the endpoint for the Rasterize PDF API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the client expects a JSON response from the server, which is a common format for API responses.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\u003C\u002Fpre>\n\n\u003Cp>This header specifies that the request body will be sent as multipart\u002Fform-data. This is necessary when uploading files to the server.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\u003C\u002Fpre>\n\n\u003Cp>The API key is required for authentication. It should be replaced with your actual API key, which you can obtain from your pdfRest account.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\u003C\u002Fpre>\n\n\u003Cp>This option specifies the file to be uploaded. Replace \u003Ccode>\u002Fpath\u002Fto\u002Ffile\u003C\u002Fcode> with the actual path to the PDF file you want to rasterize.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\u003C\u002Fpre>\n\n\u003Cp>This option specifies the desired name for the output file. The rasterized PDF will be saved with this name.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we successfully demonstrated how to use cURL to send a POST request to the pdfRest Rasterize PDF API. This allows you to convert vector-based PDFs into rasterized images, ensuring consistent rendering across different platforms.\u003C\u002Fp>\n\n\u003Cp>We encourage you to explore all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information about each API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Frasterized-pdf.sh\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-01-24T18:51:33.000+00:00","2026-09-02T18:29:16.000+00:00","Learn how to use cURL to flatten each page of a PDF document to a rasterized image with pdfRest Rasterize PDF API tool.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-curl\u002F#article\",\n      \"headline\": \"How to Rasterize PDF Files with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-curl\u002F\",\n      \"datePublished\": \"2025-01-24T18:51:33.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:18.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use cURL to flatten each page of a PDF document to a rasterized image with pdfRest Rasterize PDF API tool.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Rasterize PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frasterize-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Frasterized-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Frasterize-pdf\"\n        }\n      ],\n      \"keywords\": \"Optimization, Print, Rasterize PDF, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Rasterize PDF Files with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9813,9814,9815,9816,9817,9818],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1931,"name":1932,"slug":1933,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2137,"name":2138,"slug":2139,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1891,"name":1892,"slug":1893,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-rasterize-pdf-files-with-curl\u002F","How to Rasterize PDF Files with cURL, Tutorial | pdfRest",{"id":9823,"uuid":9824,"title":9825,"slug":9826,"html":9827,"comment_id":9823,"feature_image":48,"featured":284,"visibility":1257,"created_at":9828,"updated_at":9809,"published_at":9828,"custom_excerpt":9829,"codeinjection_head":9830,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9831,"primary_tag":9838,"url":9839,"excerpt":9829,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9840,"meta_description":9829,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6793ed57533c9f26b943924f","a96e2ed7-6c26-449a-ac03-cb9736265072","How to Rasterize PDF Files with Java","how-to-rasterize-pdf-files-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Rasterize PDF Files with Java?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frasterize-pdf\u002F'>Rasterize PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to convert PDF documents into rasterized images. This tutorial will guide you through the process of sending an API call to the Rasterize PDF endpoint using Java, allowing you to integrate this functionality into your applications seamlessly.\u003C\u002Fp>\n\n\u003Cp>A user might want to rasterize a PDF to ensure that all elements, including text and vector graphics, are flattened into a single image. This can be particularly useful for preserving the visual integrity of a document across different platforms and devices, or for preparing a PDF for printing where certain elements might otherwise be altered or misinterpreted.\u003C\u002Fp>\n\n\u003Ch2>Rasterize PDF with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class RasterizedPDF {\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_rasterized\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Frasterized-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FRasterizedPDF.java\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary libraries, such as \u003Ccode>io.github.cdimascio.dotenv.Dotenv\u003C\u002Fcode> for environment variable management, \u003Ccode>okhttp3\u003C\u002Fcode> for HTTP requests, and \u003Ccode>org.json.JSONObject\u003C\u002Fcode> for JSON handling.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\nprivate static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\u003C\u002Fpre>\n\n\u003Cp>These lines define the default file path and API key. The API key can be set directly in the code or through an environment variable, enhancing security and flexibility.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\u003C\u002Fpre>\n\n\u003Cp>This line loads environment variables, allowing the program to retrieve the API key from a \u003Ccode>.env\u003C\u002Fcode> file if available.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">RequestBody requestBody = new MultipartBody.Builder()\n    .setType(MultipartBody.FORM)\n    .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n    .addFormDataPart(\"output\", \"pdfrest_rasterized\")\n    .build();\n\u003C\u002Fpre>\n\n\u003Cp>This snippet constructs a multipart form request body. It includes the PDF file and specifies the output format as \u003Ccode>pdfrest_rasterized\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Request request = new Request.Builder()\n    .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n    .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Frasterized-pdf\")\n    .post(requestBody)\n    .build();\n\u003C\u002Fpre>\n\n\u003Cp>A new HTTP request is built with the API key in the header, targeting the \u003Ccode>https:\u002F\u002Fapi.pdfrest.com\u002Frasterized-pdf\u003C\u002Fcode> endpoint. The request method is POST, which is suitable for sending data to the server.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial demonstrated how to use Java to call the pdfRest Rasterize PDF API, converting a PDF into a rasterized format. To explore more capabilities, you can try other pdfRest API tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Frasterize-pdf\u002F\">API Reference Guide\u003C\u002Fa>. This example showcases a multipart API call; for JSON payload examples, visit the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FRasterizedPDF.java\">GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-01-24T19:43:19.000+00:00","Learn how to flatten each page of a PDF document to a rasterized image using pdfRest Rasterize PDF API tool with Java.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-java\u002F#article\",\n      \"headline\": \"How to Rasterize PDF Files with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-java\u002F\",\n      \"datePublished\": \"2025-01-24T19:43:19.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:18.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to flatten each page of a PDF document to a rasterized image using pdfRest Rasterize PDF API tool with Java.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Rasterize PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frasterize-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Frasterized-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Frasterize-pdf\"\n        }\n      ],\n      \"keywords\": \"Java, Optimization, Print, Rasterize PDF\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Rasterize PDF Files with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9832,9833,9834,9835,9836,9837],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1931,"name":1932,"slug":1933,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2137,"name":2138,"slug":2139,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1891,"name":1892,"slug":1893,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-rasterize-pdf-files-with-java\u002F","How to Rasterize PDF Files with Java, Tutorial | pdfRest",{"id":9842,"uuid":9843,"title":9844,"slug":9845,"html":9846,"comment_id":9842,"feature_image":48,"featured":284,"visibility":1257,"created_at":9847,"updated_at":9809,"published_at":9847,"custom_excerpt":9848,"codeinjection_head":9849,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9850,"primary_tag":9857,"url":9858,"excerpt":9848,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9859,"meta_description":9848,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6793e0fd533c9f26b9439208","d4b2c5e0-c848-4b71-abf4-c9b8a4ecfe62","How to Rasterize PDF Files with JavaScript in NodeJS","how-to-rasterize-pdf-files-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Rasterize PDF Files with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frasterize-pdf\u002F'>Rasterize PDF API Tool\u003C\u002Fa> offers a powerful way to convert PDF files into rasterized images using JavaScript. This tutorial will guide you through the process of sending an API call to the Rasterize PDF endpoint using JavaScript. By understanding this process, developers can integrate PDF rasterization into their applications, enabling the conversion of vector-based PDFs into pixel-based images for various use cases.\u003C\u002Fp>\n\n\u003Cp>Rasterizing a PDF can be useful for ensuring consistent rendering across different devices and platforms. For instance, a graphic designer might need to convert a PDF into a raster image format to ensure that complex vector graphics are displayed correctly on web pages or mobile apps, where vector rendering might not be supported or could lead to performance issues.\u003C\u002Fp>\n\n\u003Ch2>Rasterize PDF with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to rasterize a PDF file.\nvar axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\n\n\u002F\u002F Create a new form data instance and append the file and parameters to it\nvar data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\ndata.append(\"output\", \"pdfrest_rasterized\");\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: \"post\",\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: \"https:\u002F\u002Fapi.pdfrest.com\u002Frasterized-pdf\",\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", \u002F\u002F Replace with your API key\n    ...data.getHeaders(), \u002F\u002F set headers for the request\n  },\n  data: data, \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error);\n  });\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Frasterized-pdf.js\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by requiring necessary modules: \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests, \u003Ccode>form-data\u003C\u002Fcode> for handling form submissions, and \u003Ccode>fs\u003C\u002Fcode> for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\n\u003C\u002Fpre>\n\n\u003Cp>Next, a new instance of \u003Ccode>FormData\u003C\u002Fcode> is created, and the PDF file to be rasterized is appended along with the output parameter, which specifies the desired output format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\ndata.append(\"output\", \"pdfrest_rasterized\");\n\u003C\u002Fpre>\n\n\u003Cp>The configuration for the axios request is then defined. The \u003Ccode>method\u003C\u002Fcode> is set to \"post\", and the \u003Ccode>url\u003C\u002Fcode> is the endpoint for the Rasterize PDF API. The \u003Ccode>headers\u003C\u002Fcode> include the API key for authentication and any additional headers generated by the \u003Ccode>FormData\u003C\u002Fcode> instance.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: \"post\",\n  maxBodyLength: Infinity,\n  url: \"https:\u002F\u002Fapi.pdfrest.com\u002Frasterized-pdf\",\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    ...data.getHeaders(),\n  },\n  data: data,\n};\n\u003C\u002Fpre>\n\n\u003Cp>The request is then sent using \u003Ccode>axios\u003C\u002Fcode>, and the response is logged to the console. If an error occurs, it is caught and logged as well.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error);\n  });\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial demonstrated how to use JavaScript to send an API call to the pdfRest Rasterize PDF endpoint, allowing you to flatten each page of a PDF into a rasterized image. By following these steps, you can integrate similar functionality into your own applications.\u003C\u002Fp>\n\n\u003Cp>For further exploration, you are encouraged to try out all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. Additionally, the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> provides comprehensive documentation on all available endpoints and parameters.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Frasterized-pdf.js\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-01-24T18:50:37.000+00:00","Learn how to use pdfRest Rasterize PDF API tool with JavaScript to flatten each page of a PDF document to a rasterized image.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Rasterize PDF Files with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2025-01-24T18:50:37.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:18.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Rasterize PDF API tool with JavaScript to flatten each page of a PDF document to a rasterized image.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Rasterize PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frasterize-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Frasterized-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Frasterize-pdf\"\n        }\n      ],\n      \"keywords\": \"JavaScript, Optimization, Print, Rasterize PDF\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Rasterize PDF Files with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9851,9852,9853,9854,9855,9856],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1931,"name":1932,"slug":1933,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2137,"name":2138,"slug":2139,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1891,"name":1892,"slug":1893,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-rasterize-pdf-files-with-javascript-in-nodejs\u002F","How to Rasterize PDF Files with JavaScript in NodeJS, Tutorial | pdfRest",{"id":9861,"uuid":9862,"title":9863,"slug":9864,"html":9865,"comment_id":9861,"feature_image":48,"featured":284,"visibility":1257,"created_at":9866,"updated_at":9867,"published_at":9866,"custom_excerpt":9868,"codeinjection_head":9869,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9870,"primary_tag":9877,"url":9878,"excerpt":9868,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9879,"meta_description":9868,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6793e074533c9f26b94391f4","115ca0ec-8e97-4f02-9b31-4567db370c25","How to Rasterize PDF Files with PHP","how-to-rasterize-pdf-files-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Rasterize PDF Files with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frasterize-pdf\u002F'>Rasterize PDF API Tool\u003C\u002Fa> provides a powerful way to convert PDF documents into rasterized images using a simple API call. This tutorial will guide you through the process of sending an API call to the Rasterize PDF endpoint using PHP, allowing you to integrate this functionality into your own applications seamlessly.\u003C\u002Fp>\n\n\u003Cp>You might need to rasterize a PDF to ensure that it displays consistently across different platforms and devices, as rasterized images are less prone to rendering issues. For instance, a company might use this to prepare PDF documents for a web application, ensuring that users see the same content regardless of their browser or device capabilities.\u003C\u002Fp>\n\n\u003Ch2>Rasterize PDF with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">\nrequire 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\n$headers = [\n  'Api-Key' =--> 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => 'filename.pdf', \u002F\u002F Set the filename for the file to be converted, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'output', \u002F\u002F Specify the field name for the output option.\n      'contents' => 'pdfrest_rasterize' \u002F\u002F Set the value for the output option (in this case, 'pdfrest_rasterize').\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Frasterized-pdf', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the rasterized PDF.\n\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Frasterized-pdf.php\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by requiring the 'vendor\u002Fautoload.php' file, which is essential for loading the Guzzle HTTP client, a popular PHP HTTP client used for making requests.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">require 'vendor\u002Fautoload.php';\n\u003C\u002Fpre>\n\n\u003Cp>Next, the code imports necessary classes from the Guzzle library. These include the 'Client', 'Request', and 'Utils' classes, which are used to create an HTTP client, form requests, and handle file streams, respectively.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">use GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\u003C\u002Fpre>\n\n\u003Cp>An instance of the Guzzle HTTP client is created, which will be used to send the API request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$client = new Client();\n\u003C\u002Fpre>\n\n\u003Cp>The headers array contains the 'Api-Key', which is necessary for authenticating the request. Replace 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The 'options' array is configured for a multipart request. The 'file' part specifies the PDF file to be rasterized, including its path and filename. The 'output' part specifies the desired output format, 'pdfrest_rasterize'.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => 'filename.pdf',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_rasterize'\n    ]\n  ]\n];\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>A new HTTP POST request is created with the specified endpoint and headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Frasterized-pdf', $headers);\n\u003C\u002Fpre>\n\n\u003Cp>The request is sent asynchronously, and the response is awaited. The response body, which contains the rasterized PDF, is then printed to the console.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$res = $client->sendAsync($request, $options)->wait();\necho $res->getBody();\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use PHP to make an API call to the pdfRest Rasterize PDF endpoint, allowing you to convert all pages of a PDF into rasterized images. This can be particularly useful for ensuring consistent display across various platforms.\u003C\u002Fp>\n\n\u003Cp>To explore more about pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed documentation, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. This example demonstrates a multipart API call; for JSON payload examples, visit the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Frasterized-pdf.php\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-01-24T18:48:20.000+00:00","2026-09-02T18:29:17.000+00:00","Learn how to flatten each page of a PDF document to a rasterized image using pdfRest Rasterize PDF API tool with PHP.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-php\u002F#article\",\n      \"headline\": \"How to Rasterize PDF Files with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-php\u002F\",\n      \"datePublished\": \"2025-01-24T18:48:20.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:19.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to flatten each page of a PDF document to a rasterized image using pdfRest Rasterize PDF API tool with PHP.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Rasterize PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frasterize-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Frasterized-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Frasterize-pdf\"\n        }\n      ],\n      \"keywords\": \"Optimization, PHP, Print, Rasterize PDF\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Rasterize PDF Files with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9871,9872,9873,9874,9875,9876],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1931,"name":1932,"slug":1933,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2137,"name":2138,"slug":2139,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1891,"name":1892,"slug":1893,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-rasterize-pdf-files-with-php\u002F","How to Rasterize PDF Files with PHP, Tutorial | pdfRest",{"id":9881,"uuid":9882,"title":9883,"slug":9884,"html":9885,"comment_id":9881,"feature_image":48,"featured":284,"visibility":1257,"created_at":9886,"updated_at":9867,"published_at":9886,"custom_excerpt":9887,"codeinjection_head":9888,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9889,"primary_tag":9896,"url":9897,"excerpt":9887,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9898,"meta_description":9887,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6793dfcc533c9f26b94391e8","62a6e289-069b-4ae4-9099-8eb248715c53","How to Rasterize PDF Files with Python","how-to-rasterize-pdf-files-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Rasterize PDF Files with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frasterize-pdf\u002F'>Rasterize PDF API Tool\u003C\u002Fa> is a powerful utility designed to convert PDF documents into rasterized images. This tutorial will guide you through the process of sending an API call to the Rasterize PDF endpoint using Python, enabling you to automate this task within your applications or workflows. By utilizing this tool, you can easily transform vector-based PDFs into raster images, which can be beneficial for various use cases.\u003C\u002Fp>\n\n\u003Cp>You might need to rasterize a PDF to ensure that all elements, such as fonts and vector graphics, are flattened into a single image layer. This can be particularly useful for ensuring consistent rendering across different devices and platforms, or for preparing a document for printing or archiving where vector elements might otherwise be lost or altered.\u003C\u002Fp>\n\n\u003Ch2>Rasterize PDF with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nrasterize_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Frasterized-pdf'\n\n# The \u002Frasterized endpoint can take a single PDF file or id as input and turn it into a rasterized PDF file.\nmp_encoder_rasterize = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_rasterize_out',\n    }\n)\n\n# Let's set the headers that the rasterized-pdf endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_rasterize.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to rasterized-pdf endpoint...\")\nresponse = requests.post(rasterize_endpoint_url, data=mp_encoder_rasterize, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Frasterized-pdf.py\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary libraries: \u003Ccode>MultipartEncoder\u003C\u002Fcode> from \u003Ccode>requests_toolbelt\u003C\u002Fcode>, \u003Ccode>requests\u003C\u002Fcode>, and \u003Ccode>json\u003C\u002Fcode>. These are used for handling multipart form data, making HTTP requests, and parsing JSON responses, respectively.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">rasterize_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Frasterized-pdf'\n\u003C\u002Fpre>\n\n\u003Cp>This line defines the endpoint URL for the Rasterize PDF API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_rasterize = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_rasterize_out',\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>MultipartEncoder\u003C\u002Fcode> is used to encode the file and other data into a format suitable for a multipart form submission. The \u003Ccode>fields\u003C\u002Fcode> dictionary includes:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Ccode>file\u003C\u002Fcode>: The PDF file to be rasterized, specified with its filename, opened in binary read mode, and its MIME type.\u003C\u002Fli>\n\u003Cli>\u003Ccode>output\u003C\u002Fcode>: The desired output file name for the rasterized PDF.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_rasterize.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>headers\u003C\u002Fcode> dictionary sets the necessary HTTP headers, including:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Ccode>Accept\u003C\u002Fcode>: Specifies that the client expects a JSON response.\u003C\u002Fli>\n\u003Cli>\u003Ccode>Content-Type\u003C\u002Fcode>: Automatically set to \u003Ccode>multipart\u002Fform-data\u003C\u002Fcode> by the \u003Ccode>MultipartEncoder\u003C\u002Fcode>.\u003C\u002Fli>\n\u003Cli>\u003Ccode>Api-Key\u003C\u002Fcode>: Your unique API key for authentication.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-python\">response = requests.post(rasterize_endpoint_url, data=mp_encoder_rasterize, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This line sends a POST request to the Rasterize PDF endpoint using the URL, encoded data, and headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the response is checked. If successful, the JSON response is printed; otherwise, the error text is displayed.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use Python to send an API call to the pdfRest Rasterize PDF endpoint, which converts each page of a PDF into a rasterized image. This process can be integrated into larger applications or automated workflows. To explore more functionalities, try out the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Frasterize-pdf\u002F\">API Reference Guide\u003C\u002Fa> for detailed documentation.\u003C\u002Fp>\n\n\u003Cp>Note: This example uses a multipart API call. For code samples using JSON payloads, visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Frasterized-pdf.py\">here\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-01-24T18:45:32.000+00:00","Learn how to use pdfRest Rasterize PDF API tool with Python to flatten each page of a PDF document to a rasterized image.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-python\u002F#article\",\n      \"headline\": \"How to Rasterize PDF Files with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-python\u002F\",\n      \"datePublished\": \"2025-01-24T18:45:32.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:19.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Rasterize PDF API tool with Python to flatten each page of a PDF document to a rasterized image.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Rasterize PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frasterize-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Frasterized-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Frasterize-pdf\"\n        }\n      ],\n      \"keywords\": \"Optimization, Print, Python, Rasterize PDF\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Rasterize PDF Files with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-rasterize-pdf-files-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9890,9891,9892,9893,9894,9895],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1931,"name":1932,"slug":1933,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2137,"name":2138,"slug":2139,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1891,"name":1892,"slug":1893,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-rasterize-pdf-files-with-python\u002F","How to Rasterize PDF Files with Python, Tutorial | pdfRest",{"id":9900,"uuid":9901,"title":9902,"slug":9903,"html":9904,"comment_id":9900,"feature_image":48,"featured":284,"visibility":1257,"created_at":9905,"updated_at":9906,"published_at":9905,"custom_excerpt":9907,"codeinjection_head":9908,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9909,"primary_tag":9917,"url":9918,"excerpt":9907,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9919,"meta_description":9907,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"680a8155533c9f26b943955b","1e19c3fa-5399-4831-9371-15e4fb731a97","How to Redact PDF Text in .NET with C#","how-to-redact-pdf-text-in-net-with-c-code","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Permanently Redact PDF Text with C# and .NET\u003C\u002Fh2>\n\n\u003Cp>PDF redaction must remove sensitive text, not simply cover it visually. The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fredact-pdf-api\u002F\">Redact PDF API Tool\u003C\u002Fa> uses two endpoints to make that distinction explicit. \u003Ccode>\u002Fpdf-with-redacted-text-preview\u003C\u002Fcode> identifies and marks the text selected by your rules, while \u003Ccode>\u002Fpdf-with-redacted-text-applied\u003C\u002Fcode> permanently removes the approved content. The workflow helps .NET teams automate recurring redaction work with clear visibility into matches before the source information is removed.\u003C\u002Fp>\n\n\u003Cp>This tutorial uses both endpoints in one C# workflow. The example immediately applies the preview so developers can see how to chain the calls. A production process can also insert an authorized approval rule between them when that step is part of the organization's redaction policy.\u003C\u002Fp>\n\n\u003Cp>For example, a .NET customer-support archive can remove email addresses and phone numbers from case attachments before the documents are supplied to an analytics team. The application can use maintained presets to find common data formats, route preview files for approval, and release only the permanently redacted results.\u003C\u002Fp>\n\n\u003Ch2>Create Redaction Rules in C#\u003C\u002Fh2>\n\n\u003Cp>The preview endpoint expects \u003Ccode>redactions\u003C\u002Fcode> as a JSON array. Each entry can use:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>A \u003Ccode>literal\u003C\u002Fcode> value for an exact word, phrase, name, or identifier\u003C\u002Fli>\n\u003Cli>A \u003Ccode>regex\u003C\u002Fcode> value for an organization-specific pattern\u003C\u002Fli>\n\u003Cli>A \u003Ccode>preset\u003C\u002Fcode> value for a common type of sensitive data\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>Current presets cover formats such as email addresses, phone numbers, dates, U.S. Social Security numbers, credit-card numbers, bank-routing numbers, IBANs, SWIFT\u002FBIC numbers, URLs, and IPv4 or IPv6 addresses. These maintained patterns reduce the amount of matching logic your team must write for common data, while custom regular expressions and literals handle values unique to your organization. One request can combine all three methods.\u003C\u002Fp>\n\n\u003Cp>The C# sample uses Newtonsoft.Json \u003Ccode>JArray\u003C\u002Fcode> and \u003Ccode>JObject\u003C\u002Fcode> instances to build the array safely before serializing it into the multipart request. Replace the demonstration pattern with rules designed and tested for the documents your application processes.\u003C\u002Fp>\n\n\u003Ch2>C# Preview-and-Apply Example\u003C\u002Fh2>\n\n\u003Cp>Set the \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode> environment variable and pass the input PDF path on the command line. The optional \u003Ccode>PDFREST_URL\u003C\u002Fcode> variable can select the EU service instead of the default US Cloud API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">\u002F*\n * What this sample does:\n * - Previews redactions and then applies them using the preview output.\n * - Routed from Program.cs as: `dotnet run -- redact-preview-and-finalize \u003Cpdf>`.\n *\n * Setup (environment):\n * - Copy .env.example to .env\n * - Set PDFREST_API_KEY=your_api_key_here\n * - Optional: set PDFREST_URL to override the API region. For EU\u002FGDPR compliance and proximity, use:\n *     PDFREST_URL=https:\u002F\u002Feu-api.pdfrest.com\n *   For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\n * Usage:\n *   dotnet run -- redact-preview-and-finalize \u002Fpath\u002Fto\u002Finput.pdf\n *\n * Output:\n * - Prints JSON responses for preview and finalize steps.\n *\u002F\n\nusing Newtonsoft.Json;\nusing Newtonsoft.Json.Linq;\nusing System.Text;\n\nnamespace Samples.ComplexFlowExamples\n{\n    public static class RedactPreviewAndFinalize\n    {\n        public static async Task Execute(string[] args)\n        {\n            if (args == null || args.Length \u003C 1)\n            {\n                Console.Error.WriteLine(\"redact-preview-and-finalize requires \u003Cpdf>\");\n                Environment.Exit(1);\n                return;\n            }\n            var inputPath = args[0];\n            if (!File.Exists(inputPath))\n            {\n                Console.Error.WriteLine($\"File not found: {inputPath}\");\n                Environment.Exit(1);\n                return;\n            }\n            var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\n            if (string.IsNullOrWhiteSpace(apiKey))\n            {\n                Console.Error.WriteLine(\"Missing required environment variable: PDFREST_API_KEY\");\n                Environment.Exit(1);\n                return;\n            }\n            var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n\n            using (var httpClient = new HttpClient { BaseAddress = new Uri(baseUrl) })\n            {\n                \u002F\u002F Preview redaction\n                using var previewRequest = new HttpRequestMessage(HttpMethod.Post, \"pdf-with-redacted-text-preview\");\n                previewRequest.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\n                previewRequest.Headers.Accept.Add(new(\"application\u002Fjson\"));\n                var previewMultipartContent = new MultipartFormDataContent();\n                var byteArray = File.ReadAllBytes(inputPath);\n                var byteAryContent = new ByteArrayContent(byteArray);\n                previewMultipartContent.Add(byteAryContent, \"file\", Path.GetFileName(inputPath));\n                byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Foctet-stream\");\n                var redactionArray = new JArray\n                {\n                    new JObject { [\"type\"] = \"regex\", [\"value\"] = \"[Tt]he\" }\n                };\n                var byteArrayRedOption = new ByteArrayContent(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(redactionArray)));\n                previewMultipartContent.Add(byteArrayRedOption, \"redactions\");\n                previewRequest.Content = previewMultipartContent;\n                var pdfResponse = await httpClient.SendAsync(previewRequest);\n                var pdfResult = await pdfResponse.Content.ReadAsStringAsync();\n                Console.WriteLine(\"Redaction preview response received.\");\n                Console.WriteLine(pdfResult);\n                dynamic responseData = JObject.Parse(pdfResult);\n                string pdfID = responseData.outputId;\n\n                \u002F\u002F Apply finalization\n                using var finalizeRequest = new HttpRequestMessage(HttpMethod.Post, \"pdf-with-redacted-text-applied\");\n                finalizeRequest.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\n                finalizeRequest.Headers.Accept.Add(new(\"application\u002Fjson\"));\n                var finalMultipartContent = new MultipartFormDataContent();\n                var byteArrayIdOption = new ByteArrayContent(Encoding.UTF8.GetBytes(pdfID));\n                finalMultipartContent.Add(byteArrayIdOption, \"id\");\n                finalizeRequest.Content = finalMultipartContent;\n                var response = await httpClient.SendAsync(finalizeRequest);\n                var apiResult = await response.Content.ReadAsStringAsync();\n                Console.WriteLine(\"Finalized redaction response received.\");\n                Console.WriteLine(apiResult);\n            }\n        }\n    }\n}\u003C\u002Fpdf>\u003C\u002Fpdf>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FComplex%20Flow%20Examples\u002Fredact-preview-and-finalize.cs\">pdfRest Redact PDF C# complex-flow sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Chain the Preview into the Applied Redaction\u003C\u002Fh2>\n\n\u003Cp>The first \u003Ccode>HttpRequestMessage\u003C\u002Fcode> uploads the PDF and serialized redaction array to \u003Ccode>pdf-with-redacted-text-preview\u003C\u002Fcode>. The response contains an \u003Ccode>outputId\u003C\u002Fcode> for the preview PDF. The sample parses that response with \u003Ccode>JObject\u003C\u002Fcode>, reads the ID, and adds it to a second multipart request for \u003Ccode>pdf-with-redacted-text-applied\u003C\u002Fcode>. Resource-based chaining keeps the intermediate file on the processing service, so the .NET application does not need to download and upload it again between the two stages.\u003C\u002Fp>\n\n\u003Cp>Only the second response represents the permanently redacted PDF. An application that displays or stores the first response as its final document would leave the targeted text in place beneath the preview markings.\u003C\u002Fp>\n\n\u003Cp>For a production .NET integration, verify \u003Ccode>IsSuccessStatusCode\u003C\u002Fcode> before parsing either response, handle invalid or missing JSON fields, set an appropriate timeout, and pass a \u003Ccode>CancellationToken\u003C\u002Fcode>. Do not send the apply request when the preview request fails or does not return a valid output ID. If the application needs a non-black final appearance, add the optional \u003Ccode>rgb_color\u003C\u002Fcode> field to the applied request.\u003C\u002Fp>\n\n\u003Ch2>Apply Approved Redactions at Scale\u003C\u002Fh2>\n\n\u003Cp>The preview endpoint makes each match visible, while the apply endpoint permanently removes the approved content instead of hiding it behind a visual overlay. Once an organization establishes its rules and approval path, the same C# workflow can apply them consistently across recurring document sets.\u003C\u002Fp>\n\n\u003Cp>Protect the original, preview, and final files with appropriate access controls and retention rules. Preview files remain inside the controlled workflow, while permanently redacted outputs can move into the organization's approved distribution process.\u003C\u002Fp>\n\n\u003Cp>Redact PDF combines flexible matching, maintained sensitive-data presets, a visible review stage, and permanent removal in one chainable API workflow. See the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fredact-pdf\">Redact PDF API reference\u003C\u002Fa> for the current request fields, presets, and responses. If the source already exists as a pdfRest resource, both stages can use JSON payloads; see the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-redacted-text-preview.cs\">redaction preview JSON-payload sample\u003C\u002Fa> and the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-redacted-text-applied.cs\">applied redaction JSON-payload sample\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-04-24T18:22:13.000+00:00","2026-09-11T03:34:56.000+00:00","Learn how to redact text on a PDF document with C# using pdfRest Redact PDF API tool.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-in-net-with-c-code\u002F#article\",\n      \"headline\": \"How to Redact PDF Text in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-in-net-with-c-code\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-in-net-with-c-code\u002F\",\n      \"datePublished\": \"2025-04-24T18:22:13.000Z\",\n      \"dateModified\": \"2026-09-10T19:11:01.669Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to redact text on a PDF document with C# using pdfRest Redact PDF API tool.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Redact PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fredact-pdf-api\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-redacted-text-preview API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fredact-pdf\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-redacted-text-applied API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fredact-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Redact PDF, Sanitization, Security, Text\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Redact PDF Text in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-in-net-with-c-code\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9910,9911,9912,9913,9914,9915,9916],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2013,"name":2014,"slug":2015,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1985,"name":1986,"slug":1987,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-redact-pdf-text-in-net-with-c-code\u002F","How to Redact PDF Text in .NET with C#, Tutorial | pdfRest",{"id":9921,"uuid":9922,"title":9923,"slug":9924,"html":9925,"comment_id":9921,"feature_image":48,"featured":284,"visibility":1257,"created_at":9926,"updated_at":9927,"published_at":9926,"custom_excerpt":9928,"codeinjection_head":9929,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9930,"primary_tag":9938,"url":9939,"excerpt":9928,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9940,"meta_description":9928,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"680a81d5533c9f26b9439577","985a00ea-077f-403b-bc6c-adb9dc9f978d","How to Redact PDF Text with cURL","how-to-redact-pdf-text-with-curl-code","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Permanently Redact PDF Text with cURL\u003C\u002Fh2>\n\n\u003Cp>Covering text with a visible box is not sufficient when confidential information must be removed from a PDF. The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fredact-pdf-api\u002F\">Redact PDF API Tool\u003C\u002Fa> uses a two-stage workflow: first preview the text that matches your rules, then apply the approved redactions so the selected content is permanently removed. This gives your application an API-driven way to find repeated sensitive values across large document sets with a controlled preview step before permanent removal.\u003C\u002Fp>\n\n\u003Cp>This separation makes every proposed match visible before the source text is removed. A person or an automated approval rule can advance the preview into the apply step, while the distinct endpoints keep preview files clearly separated from finished redacted documents.\u003C\u002Fp>\n\n\u003Cp>For example, a legal-records workflow can search a set of documents for email addresses and client identifiers before files are released outside the case team. The preview call displays the matches, and the apply call then produces copies in which the approved values are permanently removed.\u003C\u002Fp>\n\n\u003Ch2>Define the Text to Redact\u003C\u002Fh2>\n\n\u003Cp>The \u003Ccode>redactions\u003C\u002Fcode> field is a JSON array. Each object uses one of three matching methods:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Ccode>literal\u003C\u002Fcode> finds an exact name, identifier, phrase, or other known string.\u003C\u002Fli>\n\u003Cli>\u003Ccode>regex\u003C\u002Fcode> finds text that follows a custom pattern.\u003C\u002Fli>\n\u003Cli>\u003Ccode>preset\u003C\u002Fcode> applies a maintained pattern for common data such as email addresses, phone numbers, dates, U.S. Social Security numbers, payment-card numbers, bank-routing numbers, IBANs, SWIFT\u002FBIC numbers, URLs, and IP addresses.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>The methods can be combined in the same request. Literal values provide exact matching, custom regular expressions address organization-specific formats, and pdfRest's maintained presets cover common sensitive-data patterns without requiring teams to build and maintain those expressions themselves. Approved rules can then be reused consistently across recurring document workflows.\u003C\u002Fp>\n\n\u003Ch2>cURL Preview-and-Apply Example\u003C\u002Fh2>\n\n\u003Cp>The current official sample requires cURL and \u003Ccode>jq\u003C\u002Fcode>. Replace the API-key and file-path placeholders before running it. The example sends the source PDF and redaction rules to the preview endpoint, reads the returned \u003Ccode>outputId\u003C\u002Fcode>, and supplies that ID to the applied-redaction endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">#!\u002Fbin\u002Fsh\n\n# This sample demonstrates the workflow from unredacted document to fully\n# redacted document. The output file from the preview tool is immediately\n# forwarded to the finalization stage. We recommend inspecting the output from\n# the preview stage before utilizing this workflow to ensure that content is\n# redacted as intended.\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\nAPI_KEY=\"xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" # place your api key here\nREDACTIONS='[{\"type\":\"regex\",\"value\":\"[Tt]he\"}]'\nPREVIEW_OUTPUT=$(curl -X POST \"$API_URL\u002Fpdf-with-redacted-text-preview\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: $API_KEY\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"redactions=$REDACTIONS\" \\\n  -F \"output=example_out\")\n\nPREVIEW_PDF_ID=$(jq -r '.outputId' \u003C\u003C\u003C $PREVIEW_OUTPUT)\n\necho $PREVIEW_OUTPUT | jq -r '.'\n\nAPPLIED_OUTPUT=$(curl -X POST \"$API_URL\u002Fpdf-with-redacted-text-applied\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: $API_KEY\" \\\n  -F \"id=$PREVIEW_PDF_ID\" \\\n  -F \"output=example_out\")\n\necho $APPLIED_OUTPUT | jq -r '.'\n\n# All files uploaded or generated are automatically deleted based on the\n# File Retention Period as shown on https:\u002F\u002Fpdfrest.com\u002Fpricing.\n# For immediate deletion of files, particularly when sensitive data\n# is involved, an explicit delete call can be made to the API.\n\n# Optional deletion step — OFF by default.\n# Deletes all files in the workflow, including outputs. Save all desired files before enabling this step.\n# Enable by uncommenting the next line to delete sensitive files\n# DELETE_SENSITIVE_FILES=true\nif [ \"$DELETE_SENSITIVE_FILES\" = \"true\" ]; then\n  INPUT_PDF_ID=$(jq -r '.inputId' \u003C\u003C\u003C $PREVIEW_OUTPUT)\n  APPLIED_PDF_ID=$(jq -r '.outputId' \u003C\u003C\u003C $APPLIED_OUTPUT)\n  curl -X POST \"$API_URL\u002Fdelete\" \\\n    -H \"Accept: application\u002Fjson\" \\\n    -H \"Content-Type: multipart\u002Fform-data\" \\\n    -H \"Api-Key: $API_KEY\" \\\n    -F \"ids=$INPUT_PDF_ID, $PREVIEW_PDF_ID, $APPLIED_PDF_ID\" | jq -r '.'\nfi\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FComplex%20Flow%20Examples\u002Fredact-preview-and-finalize.sh\">pdfRest Redact PDF cURL complex-flow sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Cp>If the source PDF already has a pdfRest resource ID, the preview and apply requests can also use JSON payloads. See the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-redacted-text-preview.sh\">redaction preview JSON-payload sample\u003C\u002Fa> and the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-redacted-text-applied.sh\">applied redaction JSON-payload sample\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Preview Before Applying Permanent Redactions\u003C\u002Fh2>\n\n\u003Cp>The first POST request calls \u003Ccode>\u002Fpdf-with-redacted-text-preview\u003C\u002Fcode>. Its output PDF marks the selected areas so the matching results are visible. The script captures the JSON response, uses \u003Ccode>jq\u003C\u002Fcode> to read its \u003Ccode>outputId\u003C\u002Fcode>, and stores that ID in \u003Ccode>PREVIEW_PDF_ID\u003C\u002Fcode>. Because both redaction stages use pdfRest resource IDs, your application can complete the workflow without downloading and re-uploading the preview between calls.\u003C\u002Fp>\n\n\u003Cp>The second request sends \u003Ccode>PREVIEW_PDF_ID\u003C\u002Fcode> to \u003Ccode>\u002Fpdf-with-redacted-text-applied\u003C\u002Fcode>. This is the step that permanently removes the identified text. The applied endpoint can also accept the optional \u003Ccode>rgb_color\u003C\u002Fcode> parameter when the final redaction blocks should use a color other than the default black.\u003C\u002Fp>\n\n\u003Cp>The official sample immediately forwards the preview into the apply call to demonstrate the complete API chain. Workflows can also pause between the calls when an authorized approval step is part of the organization's redaction policy. Once a rule set is approved, the same resource-ID chain supports automatic processing at scale.\u003C\u002Fp>\n\n\u003Ch2>Apply and Protect the Final PDF\u003C\u002Fh2>\n\n\u003Cp>The apply endpoint permanently removes the approved content from the PDF rather than covering it with a visual overlay. The resulting resource ID can move directly into encryption, permission restriction, archival, or delivery steps, allowing the redacted document to remain inside one controlled API workflow.\u003C\u002Fp>\n\n\u003Cp>Keep the API key in an environment variable or secret manager rather than committed source code. Limit access to source and preview files because both can contain unredacted information. The sample also includes an optional call to the Delete Files endpoint; save any required outputs before enabling it, and never delete the preview resource before the applied-redaction call has completed.\u003C\u002Fp>\n\n\u003Cp>With exact matches, custom patterns, maintained presets, a reviewable preview, and permanent application in one API workflow, Redact PDF supports repeatable automation with controlled approvals. Review the current matching options and endpoint schemas in the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fredact-pdf\">Redact PDF API reference\u003C\u002Fa>, or configure rules interactively in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-04-24T18:24:21.000+00:00","2026-09-11T03:34:55.000+00:00","Learn how to use cURL to redact text on a PDF document with the pdfRest Redact PDF API tool.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-curl-code\u002F#article\",\n      \"headline\": \"How to Redact PDF Text with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-curl-code\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-curl-code\u002F\",\n      \"datePublished\": \"2025-04-24T18:24:21.000Z\",\n      \"dateModified\": \"2026-09-10T19:11:01.669Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use cURL to redact text on a PDF document with the pdfRest Redact PDF API tool.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Redact PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fredact-pdf-api\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-redacted-text-preview API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fredact-pdf\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-redacted-text-applied API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fredact-pdf\"\n        }\n      ],\n      \"keywords\": \"Redact PDF, Sanitization, Security, Text, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Redact PDF Text with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-curl-code\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9931,9932,9933,9934,9935,9936,9937],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2013,"name":2014,"slug":2015,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1985,"name":1986,"slug":1987,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-redact-pdf-text-with-curl-code\u002F","How to Redact PDF Text with cURL, Tutorial | pdfRest",{"id":9942,"uuid":9943,"title":9944,"slug":9945,"html":9946,"comment_id":9942,"feature_image":48,"featured":284,"visibility":1257,"created_at":9947,"updated_at":9948,"published_at":9947,"custom_excerpt":9949,"codeinjection_head":9950,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9951,"primary_tag":9958,"url":9959,"excerpt":9949,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9960,"meta_description":9949,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"680a820b533c9f26b9439580","ff5f9a65-a758-4a42-878e-92f6e3671c2c","How to Redact PDF Text with Java","how-to-redact-pdf-text-with-java-code","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Redact PDF Text with Java?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fredact-pdf\u002F'>Redact PDF API Tool\u003C\u002Fa> is a powerful solution for developers who need to programmatically redact sensitive information from PDF documents. This tutorial will guide you through the process of making an API call to the Redact PDF endpoint using Java, allowing you to automate the redaction process and integrate it into your Java applications seamlessly.\u003C\u002Fp>\n\n\u003Cp>In real-world scenarios, businesses often need to share documents while ensuring that sensitive information, such as personal data or confidential details, is not exposed. For instance, a legal firm might need to redact client information from case documents before sharing them with third parties. By using the Redact PDF API, developers can automate this redaction process, saving time and reducing the risk of human error.\u003C\u002Fp>\n\n\u003Ch2>Redact PDF Text with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class PDFWithRedactedTextPreview {\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final String redaction_options =\n        \"[{\\\"type\\\":\\\"preset\\\",\\\"value\\\":\\\"email\\\"},{\\\"type\\\":\\\"regex\\\",\\\"value\\\":\\\"(\\\\\\\\+\\\\\\\\d{1,2}\\\\\\\\s)?\\\\\\\\(?\\\\\\\\d{3}\\\\\\\\)?[\\\\\\\\s.-]\\\\\\\\d{3}[\\\\\\\\s.-]\\\\\\\\d{4}\\\"},{\\\"type\\\":\\\"literal\\\",\\\"value\\\":\\\"word\\\"}]\";\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"redactions\", redaction_options)\n            .addFormDataPart(\"output\", \"pdfrest_redacted_text\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-redacted-text-preview\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPDFWithRedactedTextPreview.java\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary libraries such as `Dotenv` for environment variable management, `OkHttp` for handling HTTP requests, and `JSONObject` for JSON manipulation. The `DEFAULT_FILE_PATH` and `DEFAULT_API_KEY` are placeholders for the file path and API key, respectively.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">File inputFile;\nif (args.length > 0) {\n  inputFile = new File(args[0]);\n} else {\n  inputFile = new File(DEFAULT_FILE_PATH);\n}\n\u003C\u002Fpre>\n\n\u003Cp>This snippet checks if a file path is provided as a command-line argument. If not, it defaults to the `DEFAULT_FILE_PATH`.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\u003C\u002Fpre>\n\n\u003Cp>The `Dotenv` library is used to load environment variables, allowing the API key to be stored securely outside the code.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">final String redaction_options = \"[{\\\"type\\\":\\\"preset\\\",\\\"value\\\":\\\"email\\\"},{\\\"type\\\":\\\"regex\\\",\\\"value\\\":\\\"(\\\\\\\\+\\\\\\\\d{1,2}\\\\\\\\s)?\\\\\\\\(?\\\\\\\\d{3}\\\\\\\\)?[\\\\\\\\s.-]\\\\\\\\d{3}[\\\\\\\\s.-]\\\\\\\\d{4}\\\"},{\\\"type\\\":\\\"literal\\\",\\\"value\\\":\\\"word\\\"}]\";\n\u003C\u002Fpre>\n\n\u003Cp>The `redaction_options` variable defines the redaction rules, using a JSON array to specify different types of redactions: preset (e.g., email), regex (e.g., phone numbers), and literal (e.g., specific words).\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">RequestBody requestBody = new MultipartBody.Builder()\n    .setType(MultipartBody.FORM)\n    .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n    .addFormDataPart(\"redactions\", redaction_options)\n    .addFormDataPart(\"output\", \"pdfrest_redacted_text\")\n    .build();\n\u003C\u002Fpre>\n\n\u003Cp>This section constructs the multipart request body, including the PDF file, redaction options, and output format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Request request = new Request.Builder()\n    .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n    .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-redacted-text-preview\")\n    .post(requestBody)\n    .build();\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>Request\u003C\u002Fcode> object is created with the API key header and the endpoint URL, ready for execution.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use Java to make an API call to the pdfRest Redact PDF endpoint, automating the redaction of sensitive information from PDF files. You can explore other pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for more detailed information.\u003C\u002Fp>\n\n\u003Cp>Note: This example demonstrates a multipart API call. For code samples using JSON payloads, visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPDFWithRedactedTextPreview.java\">this GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-04-24T18:25:15.000+00:00","2026-09-02T18:29:19.000+00:00","Learn how to redact text on a PDF document using pdfRest Redact PDF API tool with Java.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-java-code\u002F#article\",\n      \"headline\": \"How to Redact PDF Text with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-java-code\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-java-code\u002F\",\n      \"datePublished\": \"2025-04-24T18:25:15.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:17.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to redact text on a PDF document using pdfRest Redact PDF API tool with Java.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Redact PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fredact-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-redacted-text-preview API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fredact-pdf\"\n        }\n      ],\n      \"keywords\": \"Java, Redact PDF, Security, Text\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Redact PDF Text with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-java-code\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9952,9953,9954,9955,9956,9957],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2013,"name":2014,"slug":2015,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-redact-pdf-text-with-java-code\u002F","How to Redact PDF Text with Java, Tutorial | pdfRest",{"id":9962,"uuid":9963,"title":9964,"slug":9965,"html":9966,"comment_id":9962,"feature_image":48,"featured":284,"visibility":1257,"created_at":9967,"updated_at":9948,"published_at":9967,"custom_excerpt":9968,"codeinjection_head":9969,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9970,"primary_tag":9977,"url":9978,"excerpt":9968,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9979,"meta_description":9968,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"680a8180533c9f26b9439565","0a8cd0cf-624b-4afb-8b61-3c40c5fb7f82","How to Redact PDF Text with Javascript in NodeJS","how-to-redact-pdf-text-with-javascript-code-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Redact PDF Text with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fredact-pdf\u002F'>Redact PDF API Tool\u003C\u002Fa> is a powerful solution for developers looking to automate the redaction of sensitive information from PDF documents. This tutorial will guide you through the process of sending an API call to Redact PDF using JavaScript, allowing you to efficiently redact text based on specific criteria.\u003C\u002Fp>\n\n\u003Cp>In real-world scenarios, businesses and individuals often need to share documents that contain confidential information, such as email addresses, phone numbers, or specific keywords. Using the Redact PDF API, you can automatically identify and redact this information, ensuring privacy and compliance with data protection regulations.\u003C\u002Fp>\n\n\u003Ch2>Redact PDF Text with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F**\n * This request demonstrates how to apply text redaction previews to a PDF.\n * This is step 1 of 2 toward applying redactions to text.\n *\u002F\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\nvar redaction_option_array = [];\nvar redaction_options1 = {\n    \"type\": \"preset\",\n    \"value\": \"email\",\n};\nvar redaction_options2 = {\n    \"type\": \"regex\",\n    \"value\": \"(\\\\+\\\\d{1,2}\\\\s)?\\\\(?\\\\d{3}\\\\)?[\\\\s.-]\\\\d{3}[\\\\s.-]\\\\d{4}\",\n};\nvar redaction_options3 = {\n    \"type\": \"literal\",\n    \"value\": \"word\",\n};\nredaction_option_array.push(redaction_options1);\nredaction_option_array.push(redaction_options2);\nredaction_option_array.push(redaction_options3);\ndata.append('redactions', JSON.stringify(redaction_option_array));\ndata.append('output', 'pdfrest_pdf_with_redacted_text_preview');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-redacted-text-preview', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-redacted-text-preview.js\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by requiring necessary modules: \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests, \u003Ccode>form-data\u003C\u002Fcode> for handling form data, and \u003Ccode>fs\u003C\u002Fcode> for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\n\u003C\u002Fpre>\n\n\u003Cp>Here, a new \u003Ccode>FormData\u003C\u002Fcode> instance is created, and a PDF file is appended to it. The file path should be replaced with the actual path of the PDF you wish to redact.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var redaction_options1 = {\n    \"type\": \"preset\",\n    \"value\": \"email\",\n};\n\u003C\u002Fpre>\n\n\u003Cp>This snippet defines a redaction option to remove email addresses using a preset type. Other options include \u003Ccode>regex\u003C\u002Fcode> for regular expressions and \u003Ccode>literal\u003C\u002Fcode> for specific words.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-redacted-text-preview', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\n\u003C\u002Fpre>\n\n\u003Cp>The configuration for the \u003Ccode>axios\u003C\u002Fcode> request is set here, including the HTTP method, URL, headers (with an API key), and the form data to be sent.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\u003C\u002Fpre>\n\n\u003Cp>This section sends the request and handles the response or any errors that may occur. The response data is logged to the console.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to make an API call to redact text from a PDF using JavaScript and the pdfRest API. You can explore more API tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further details, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example demonstrates a multipart API call. For JSON payload samples, visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-redacted-text-preview.js\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-04-24T18:22:56.000+00:00","Learn how to use pdfRest Redact PDF API tool with JavaScript to redact text on a PDF document.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-javascript-code-in-nodejs\u002F#article\",\n      \"headline\": \"How to Redact PDF Text with Javascript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-javascript-code-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-javascript-code-in-nodejs\u002F\",\n      \"datePublished\": \"2025-04-24T18:22:56.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:17.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Redact PDF API tool with JavaScript to redact text on a PDF document.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Redact PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fredact-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-redacted-text-preview API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fredact-pdf\"\n        }\n      ],\n      \"keywords\": \"JavaScript, Redact PDF, Security, Text\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Redact PDF Text with Javascript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-javascript-code-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9971,9972,9973,9974,9975,9976],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2013,"name":2014,"slug":2015,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-redact-pdf-text-with-javascript-code-in-nodejs\u002F","How to Redact PDF Text with Javascript in NodeJS, Tutorial | pdfRest",{"id":9981,"uuid":9982,"title":9983,"slug":9984,"html":9985,"comment_id":9981,"feature_image":48,"featured":284,"visibility":1257,"created_at":9986,"updated_at":9948,"published_at":9986,"custom_excerpt":9987,"codeinjection_head":9988,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":9989,"primary_tag":9996,"url":9997,"excerpt":9987,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":9998,"meta_description":9987,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"680a811a533c9f26b9439552","70c43aee-39af-4398-91e7-476942535dd7","How to Redact PDF Text with PHP","how-to-redact-pdf-text-with-php-code","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Redact PDF Text with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fredact-pdf\u002F'>Redact PDF API Tool\u003C\u002Fa> is a powerful solution for developers looking to automate the process of redacting sensitive information from PDF documents. By integrating this tool with PHP, developers can efficiently send API calls to redact text in PDFs, making it an ideal choice for applications that handle confidential documents. This tutorial will guide you through the process of sending an API call to the Redact PDF endpoint using PHP.\u003C\u002Fp>\n\n\u003Cp>In a real-world scenario, a legal firm might need to redact sensitive client information such as email addresses, phone numbers, or specific keywords from legal documents before sharing them with external parties. Using the Redact PDF API, the firm can automate this process, ensuring that all sensitive data is consistently and accurately redacted, saving time and reducing the risk of human error.\u003C\u002Fp>\n\n\u003Ch2>Redact PDF Text with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">\nrequire 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\n$headers = [\n  'Api-Key' =--> 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile', \u002F\u002F Set the filename for the file to be processed, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'redactions', \u002F\u002F Specify the field name for the text options.\n      'contents' => '[{\"type\":\"preset\",\"value\":\"email\"},{\"type\":\"regex\",\"value\":\"(\\\\\\\\+\\\\\\\\d{1,2}\\\\\\\\s)?\\\\\\\\(?\\\\\\\\d{3}\\\\\\\\)?[\\\\\\\\s.-]\\\\\\\\d{3}[\\\\\\\\s.-]\\\\\\\\d{4}\"},{\"type\":\"literal\",\"value\":\"word\"}]' \u002F\u002F Set the value for the redactions option. This is a JSON-formatted string consisting of an array with sets of text options.\n    ],\n    [\n      'name' => 'output', \u002F\u002F Specify the field name for the output option.\n      'contents' => 'pdfrest_pdf_with_redacted_text' \u002F\u002F Set the value for the output option (in this case, 'pdfrest_pdf_with_redacted_text').\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-redacted-text-preview', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the PDF with redaction preview annotations.\n\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-redacted-text-preview.php\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by including the autoload file to use the Guzzle HTTP client:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">require 'vendor\u002Fautoload.php';\n\u003C\u002Fpre>\n\n\u003Cp>This is followed by importing necessary classes from Guzzle:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">use GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\u003C\u002Fpre>\n\n\u003Cp>A new Guzzle client is instantiated:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$client = new Client();\n\u003C\u002Fpre>\n\n\u003Cp>The API key is set in the headers for authentication purposes:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$headers = [\n  'Api-Key' => 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The options array is configured for a multipart request. It includes the file to be redacted, the redaction rules, and the desired output format:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'redactions',\n      'contents' => '[{\"type\":\"preset\",\"value\":\"email\"},{\"type\":\"regex\",\"value\":\"(\\\\\\\\+\\\\\\\\d{1,2}\\\\\\\\s)?\\\\\\\\(?\\\\\\\\d{3}\\\\\\\\)?[\\\\\\\\s.-]\\\\\\\\d{3}[\\\\\\\\s.-]\\\\\\\\d{4}\"},{\"type\":\"literal\",\"value\":\"word\"}]'\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_pdf_with_redacted_text'\n    ]\n  ]\n];\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>The request is created and sent asynchronously, with the response being outputted:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-redacted-text-preview', $headers);\n$res = $client->sendAsync($request, $options)->wait();\necho $res->getBody();\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to send an API call to the pdfRest Redact PDF endpoint using PHP. This allows you to automate the redaction of sensitive information in PDF documents. To explore more, you can try out all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example demonstrates a multipart API call. Code samples using JSON payloads can be found \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-redacted-text-preview.php\">here\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-04-24T18:21:14.000+00:00","Learn how to redact text on a PDF document using pdfRest Redact PDF API tool with PHP.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-php-code\u002F#article\",\n      \"headline\": \"How to Redact PDF Text with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-php-code\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-php-code\u002F\",\n      \"datePublished\": \"2025-04-24T18:21:14.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:18.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to redact text on a PDF document using pdfRest Redact PDF API tool with PHP.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Redact PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fredact-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-redacted-text-preview API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fredact-pdf\"\n        }\n      ],\n      \"keywords\": \"PHP, Redact PDF, Security, Text\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Redact PDF Text with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-php-code\u002F\"\n        }\n      ]\n    }\n  ]\n}",[9990,9991,9992,9993,9994,9995],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2013,"name":2014,"slug":2015,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-redact-pdf-text-with-php-code\u002F","How to Redact PDF Text with PHP, Tutorial | pdfRest",{"id":10000,"uuid":10001,"title":10002,"slug":10003,"html":10004,"comment_id":10000,"feature_image":48,"featured":284,"visibility":1257,"created_at":10005,"updated_at":10006,"published_at":10005,"custom_excerpt":10007,"codeinjection_head":10008,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10009,"primary_tag":10016,"url":10017,"excerpt":10007,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10018,"meta_description":10007,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"680a7f4a533c9f26b9439549","827c57dc-0e3f-44dc-b3e5-d7953d092d75","How to Redact PDF Text with Python","how-to-redact-pdf-text-with-python-code","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Redact PDF Text with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fredact-pdf\u002F'>Redact PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to automate the process of redacting sensitive information from PDF documents. By using this tool, you can programmatically remove or obscure information such as email addresses, phone numbers, and specific words or phrases. This tutorial will guide you through sending an API call to the Redact PDF endpoint using Python, allowing you to integrate this functionality into your applications seamlessly.\u003C\u002Fp>\n\n\u003Cp>In the real world, there are numerous scenarios where redacting information from PDFs is crucial. For example, a legal firm may need to share documents with clients or opposing counsel but must ensure that certain sensitive information, like client contact details or proprietary terms, is not visible. Similarly, businesses handling confidential information may need to distribute reports internally while ensuring that sensitive data is protected. Using the Redact PDF API, these tasks become efficient and reliable.\u003C\u002Fp>\n\n\u003Ch2>Redact PDF Text with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\npdf_with_redacted_text_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-redacted-text-preview'\n\nredaction_options = [{\n        \"type\": \"preset\",\n        \"value\": \"email\",\n    },\n    {\n        \"type\": \"regex\",\n        \"value\": \"(\\\\+\\\\d{1,2}\\\\s)?\\\\(?\\\\d{3}\\\\)?[\\\\s.-]\\\\d{3}[\\\\s.-]\\\\d{4}\",\n    },\n    {\n        \"type\": \"literal\",\n        \"value\": \"word\",\n    }]\n\nmp_encoder_redactedtextPDF = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'redactions': json.dumps(redaction_options),\n        'output' : 'example_out'\n    }\n)\n\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_redactedtextPDF.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to pdf-with-redacted-text endpoint...\")\nresponse = requests.post(pdf_with_redacted_text_endpoint_url, data=mp_encoder_redactedtextPDF, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-redacted-text-preview.py\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary libraries: \u003Ccode>requests_toolbelt\u003C\u002Fcode> for handling multipart form data, \u003Ccode>requests\u003C\u002Fcode> for making HTTP requests, and \u003Ccode>json\u003C\u002Fcode> for handling JSON data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">pdf_with_redacted_text_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-redacted-text-preview'\n\u003C\u002Fpre>\n\n\u003Cp>This line sets the endpoint URL for the Redact PDF API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">redaction_options = [{\n        \"type\": \"preset\",\n        \"value\": \"email\",\n    },\n    {\n        \"type\": \"regex\",\n        \"value\": \"(\\\\+\\\\d{1,2}\\\\s)?\\\\(?\\\\d{3}\\\\)?[\\\\s.-]\\\\d{3}[\\\\s.-]\\\\d{4}\",\n    },\n    {\n        \"type\": \"literal\",\n        \"value\": \"word\",\n    }]\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>redaction_options\u003C\u002Fcode> variable defines the types of redactions to apply. It includes:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Ccode>preset\u003C\u002Fcode>: Redacts email addresses.\u003C\u002Fli>\n\u003Cli>\u003Ccode>regex\u003C\u002Fcode>: Uses a regular expression to redact phone numbers.\u003C\u002Fli>\n\u003Cli>\u003Ccode>literal\u003C\u002Fcode>: Redacts the word \"word\".\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-python\">mp_encoder_redactedtextPDF = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'redactions': json.dumps(redaction_options),\n        'output' : 'example_out'\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>MultipartEncoder\u003C\u002Fcode> is used to create a multipart form-data payload. It includes:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Ccode>file\u003C\u002Fcode>: The PDF file to redact.\u003C\u002Fli>\n\u003Cli>\u003Ccode>redactions\u003C\u002Fcode>: The JSON-encoded redaction options.\u003C\u002Fli>\n\u003Cli>\u003Ccode>output\u003C\u002Fcode>: The name for the output file.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_redactedtextPDF.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>headers\u003C\u002Fcode> dictionary sets the request headers, including the API key for authentication.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(pdf_with_redacted_text_endpoint_url, data=mp_encoder_redactedtextPDF, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This line sends a POST request to the API endpoint with the prepared data and headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>The response is checked for success. If successful, the JSON response is printed; otherwise, the error message is displayed.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use Python to send an API call to the pdfRest Redact PDF endpoint, allowing you to automate the redaction of sensitive information from PDF documents. This is just one of the many tools available through pdfRest. To explore further, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for more detailed information.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-redacted-text-preview.py\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-04-24T18:13:30.000+00:00","2026-09-02T18:29:20.000+00:00","Learn how to use the pdfRest Redact PDF API tool with Python to redact sensitive text on a PDF document.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-python-code\u002F#article\",\n      \"headline\": \"How to Redact PDF Text with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-python-code\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-python-code\u002F\",\n      \"datePublished\": \"2025-04-24T18:13:30.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:18.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use the pdfRest Redact PDF API tool with Python to redact sensitive text on a PDF document.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Redact PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fredact-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-redacted-text-preview API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fredact-pdf\"\n        }\n      ],\n      \"keywords\": \"Python, Redact PDF, Security, Text\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Redact PDF Text with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-redact-pdf-text-with-python-code\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10010,10011,10012,10013,10014,10015],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2013,"name":2014,"slug":2015,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-redact-pdf-text-with-python-code\u002F","How to Redact PDF Text with Python, Tutorial | pdfRest",{"id":10020,"uuid":10021,"title":10022,"slug":10023,"html":10024,"comment_id":10020,"feature_image":48,"featured":284,"visibility":1257,"created_at":10025,"updated_at":10026,"published_at":9755,"custom_excerpt":10027,"codeinjection_head":10028,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10029,"primary_tag":10038,"url":10039,"excerpt":10027,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10040,"meta_description":10027,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a989af2d1b70dd2e2978a6c","a360bcb0-aa64-4591-a608-c5995a403f23","How to Refry a PDF in .NET with C#","how-to-refry-a-pdf-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This .NET walkthrough uses C# and \u003Ccode>HttpClient\u003C\u002Fcode> to submit the request. It completes a PDF -> PostScript -> PDF roundtrip with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-postscript\u002F\">pdfRest PDF to PostScript API Tool\u003C\u002Fa>, then passes its output resource ID into \u003Ccode>\u002Fpdf\u003C\u002Fcode>. The complete sample is included below so .NET with C# developers can see the file handling, request construction, and response path together.\u003C\u002Fp>\n\n\u003Ch2>Why Refry a PDF in .NET with C#?\u003C\u002Fh2>\n\n\u003Cp>PDF refrying converts a PDF to PostScript and then converts the PostScript into a new PDF. It can fit a print or prepress integration that needs a PostScript-based derivative or rebuilt page content for an established downstream requirement.\u003C\u002Fp>\n\n\u003Cp>The C# complex-flow example demonstrates how a .NET application passes resource IDs through that multi-call job. It creates PostScript from the source PDF, uses the returned ID in the conversion back to PDF, and writes the final bytes only after the second response succeeds. A hosted worker can retain each stage’s output ID for supportability while temporary resources follow service cleanup policy.\u003C\u002Fp>\n\n\u003Cp>The result may no longer retain the source PDF’s tags, form behavior, layers, or other PDF-specific structures. Preserve the original before choosing refrying for a downstream requirement.\u003C\u002Fp>\n\n\u003Ch2>C# Code Example for PDF Refrying\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">\u002F*\n * What this sample does:\n * - Converts PDF to PostScript and then converts the PostScript back to PDF.\n * - This PDF -> PostScript -> PDF roundtrip is commonly called PDF refrying.\n * - Some print, prepress, and legacy production workflows use it to rebuild,\n *   flatten, or normalize page content for downstream systems.\n * - Refrying is intentionally lossy and may remove tags, forms, layers,\n *   annotations, transparency, metadata, and editability.\n * - The PostScript-to-PDF step uses a custom .joboptions profile in this\n *   sample. A .joboptions file contains Adobe Distiller-compatible conversion\n *   settings; it is optional, and default settings are used when omitted.\n * - pdfRest applies the profile with Datalogics PDF Converter SDK. Datalogics\n *   maintains the SDK in partnership with Adobe, using the same Adobe\n *   technology that powers Distiller.\n *\n * Setup (environment):\n * - Copy .env.example to .env\n * - Set PDFREST_API_KEY=your_api_key_here\n * - Optional: set PDFREST_URL to override the API region. For EU\u002FGDPR\n *   compliance and proximity, use PDFREST_URL=https:\u002F\u002Feu-api.pdfrest.com\n *\n * Usage:\n *   dotnet run -- refry-pdf \u003Cpdf> \u003Cjoboptions> [outputPdf]\n *\n * Output:\n * - Prints each API result and downloads refried.pdf unless outputPdf is set.\n *\u002F\n\nusing Newtonsoft.Json.Linq;\nusing System.Net.Http.Headers;\n\nnamespace Samples.ComplexFlowExamples;\n\npublic static class RefryPdf\n{\n    public static async Task Execute(string[] args)\n    {\n        if (args.Length \u003C 2)\n        {\n            throw new ArgumentException(\"refry-pdf requires \u003Cpdf> \u003Cjoboptions> [outputPdf]\");\n        }\n\n        var inputPath = args[0];\n        var jobOptionsPath = args[1];\n        var outputPath = args.Length > 2 ? args[2] : Path.Combine(\"Complex Flow Examples\", \"refried.pdf\");\n        var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\n        if (string.IsNullOrWhiteSpace(apiKey))\n        {\n            throw new InvalidOperationException(\"Missing PDFREST_API_KEY\");\n        }\n\n        var baseUrl = (Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\").TrimEnd('\u002F');\n        using var client = new HttpClient(new HttpClientHandler { UseCookies = false })\n        {\n            BaseAddress = new Uri(baseUrl),\n            Timeout = TimeSpan.FromMinutes(2),\n        };\n        client.DefaultRequestHeaders.TryAddWithoutValidation(\"Api-Key\", apiKey);\n        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(\"application\u002Fjson\"));\n\n        var postscript = await ConvertToPostscript(client, inputPath);\n        var finalPdf = await ConvertToPdf(client, postscript[\"outputId\"]!.Value\u003Cstring>()!, jobOptionsPath);\n        var finalId = finalPdf[\"outputId\"]!.Value\u003Cstring>()!;\n\n        var bytes = await client.GetByteArrayAsync($\"resource\u002F{Uri.EscapeDataString(finalId)}?format=file\");\n        await File.WriteAllBytesAsync(outputPath, bytes);\n        Console.WriteLine(finalPdf.ToString());\n        Console.WriteLine($\"Created {Path.GetFullPath(outputPath)}\");\n    }\n\n    private static async Task\u003Cjobject> ConvertToPostscript(HttpClient client, string inputPath)\n    {\n        using var form = new MultipartFormDataContent();\n        var input = new ByteArrayContent(await File.ReadAllBytesAsync(inputPath));\n        input.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Fpdf\");\n        form.Add(input, \"file\", Path.GetFileName(inputPath));\n        form.Add(new StringContent(\"3\"), \"ps_level\");\n        form.Add(new StringContent(\"all\"), \"page_range\");\n        form.Add(new StringContent(\"true\"), \"binary_output\");\n        form.Add(new StringContent(\"1\"), \"scale\");\n        form.Add(new StringContent(\"false\"), \"rotate\");\n        form.Add(new StringContent(\"true\"), \"shrink_to_fit\");\n        form.Add(new StringContent(\"true\"), \"print_annotations\");\n        form.Add(new StringContent(\"refry_intermediate\"), \"output\");\n        return await Post(client, \"postscript\", form);\n    }\n\n    private static async Task\u003Cjobject> ConvertToPdf(\n        HttpClient client,\n        string postscriptId,\n        string jobOptionsPath)\n    {\n        using var form = new MultipartFormDataContent();\n        form.Add(new StringContent(postscriptId), \"id\");\n        var jobOptions = new ByteArrayContent(await File.ReadAllBytesAsync(jobOptionsPath));\n        jobOptions.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Foctet-stream\");\n        form.Add(jobOptions, \"job_options\", Path.GetFileName(jobOptionsPath));\n        form.Add(new StringContent(\"refried\"), \"output\");\n        return await Post(client, \"pdf\", form);\n    }\n\n    private static async Task\u003Cjobject> Post(\n        HttpClient client,\n        string endpoint,\n        HttpContent content)\n    {\n        using var response = await client.PostAsync(endpoint, content);\n        var text = await response.Content.ReadAsStringAsync();\n        Console.WriteLine($\"{endpoint}: {(int)response.StatusCode}\");\n        if (!response.IsSuccessStatusCode)\n        {\n            throw new InvalidOperationException($\"{endpoint} failed: {text}\");\n        }\n\n        return JObject.Parse(text);\n    }\n}\u003C\u002Fjobject>\u003C\u002Fjobject>\u003C\u002Fjobject>\u003C\u002Fstring>\u003C\u002Fstring>\u003C\u002Fjoboptions>\u003C\u002Fpdf>\u003C\u002Fjoboptions>\u003C\u002Fpdf>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FComplex%20Flow%20Examples\u002Frefry-pdf.cs\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Configure the service and input\u003C\u002Fh3>\n\n\u003Cpre class=\"language-csharp\">var outputPath = args.Length > 2 ? args[2] : Path.Combine(\"Complex Flow Examples\", \"refried.pdf\");\n        var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\n        if (string.IsNullOrWhiteSpace(apiKey))\n        {\n            throw new InvalidOperationException(\"Missing PDFREST_API_KEY\");\n        }\u003C\u002Fpre>\n\n\u003Cp>For this PDF Refrying example, .NET with C# coordinates the two dependent API calls. The C# samples use framework \u003Ccode>HttpClient\u003C\u002Fcode> APIs and disposable content objects. API credentials come from \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode>, keeping the secret out of the source file and request body. The sample’s placeholder path and API key make the moving pieces visible; replace them with a real local path and protected runtime credential before using the request.\u003C\u002Fp>\n\n\u003Ch3>Pass the Intermediate Resource to the Next Step\u003C\u002Fh3>\n\n\u003Cpre class=\"language-csharp\">client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(\"application\u002Fjson\"));\n\n        var postscript = await ConvertToPostscript(client, inputPath);\n        var finalPdf = await ConvertToPdf(client, postscript[\"outputId\"]!.Value\u003Cstring>()!, jobOptionsPath);\n        var finalId = finalPdf[\"outputId\"]!.Value\u003Cstring>()!;\n\n        var bytes = await client.GetByteArrayAsync($\"resource\u002F{Uri.EscapeDataString(finalId)}?format=file\");\n        await File.WriteAllBytesAsync(outputPath, bytes);\n        Console.WriteLine(finalPdf.ToString());\n        Console.WriteLine($\"Created {Path.GetFullPath(outputPath)}\");\n    }\u003C\u002Fstring>\u003C\u002Fstring>\u003C\u002Fpre>\n\n\u003Cp>In the .NET with C# workflow, \u003Ccode>outputId\u003C\u002Fcode> from \u003Ccode>\u002Fpostscript\u003C\u002Fcode> becomes the \u003Ccode>id\u003C\u002Fcode> passed to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. The second request also supplies a custom \u003Ccode>.joboptions\u003C\u002Fcode> file so the return conversion has an explicit Adobe Distiller-compatible profile, even though default settings are available when the profile is omitted.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-csharp\">private static async Task\u003Cjobject> ConvertToPostscript(HttpClient client, string inputPath)\n    {\n        using var form = new MultipartFormDataContent();\n        var input = new ByteArrayContent(await File.ReadAllBytesAsync(inputPath));\n        input.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Fpdf\");\n        form.Add(input, \"file\", Path.GetFileName(inputPath));\n        form.Add(new StringContent(\"3\"), \"ps_level\");\n        form.Add(new StringContent(\"all\"), \"page_range\");\n        form.Add(new StringContent(\"true\"), \"binary_output\");\n        form.Add(new StringContent(\"1\"), \"scale\");\n        form.Add(new StringContent(\"false\"), \"rotate\");\u003C\u002Fjobject>\u003C\u002Fpre>\n\n\u003Cp>For the PDF Refrying form, \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> owns the uploaded streams and text values. The .NET runtime calculates the multipart boundary and content type when \u003Ccode>HttpClient\u003C\u002Fcode> sends the container.\u003C\u002Fp>\n\n\u003Ch3>Read the output resource\u003C\u002Fh3>\n\n\u003Cpre class=\"language-csharp\">string endpoint,\n        HttpContent content)\n    {\n        using var response = await client.PostAsync(endpoint, content);\n        var text = await response.Content.ReadAsStringAsync();\n        Console.WriteLine($\"{endpoint}: {(int)response.StatusCode}\");\n        if (!response.IsSuccessStatusCode)\n        {\n            throw new InvalidOperationException($\"{endpoint} failed: {text}\");\n        }\n\n        return JObject.Parse(text);\u003C\u002Fpre>\n\n\u003Cp>After the PDF Refrying call, the client reads the response text and reports non-success status through the process exit code. A successful JSON body identifies the managed output resource, while an unsuccessful body should be surfaced to the calling application.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You completed the two-stage refry process in .NET with C# and saved the final PDF after both calls succeeded. The intermediate response ID is the important handoff between conversion stages, not merely a status value to print and discard.\u003C\u002Fp>\n\n\u003Cp>Try representative pdf refrying inputs in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the authoritative request fields, accepted values, and response contract, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">pdfRest API Reference Guide\u003C\u002Fa>. The same request pattern can then be adapted to your .NET with C# application’s error handling, retention policy, and delivery workflow.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-02T21:53:54.000+00:00","2026-09-04T05:11:47.000+00:00","Refry a PDF with .NET with C# through a PDF to PostScript to PDF workflow using pdfRest resource IDs.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-refry-a-pdf-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Refry a PDF in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-refry-a-pdf-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-refry-a-pdf-in-net-with-c\u002F\",\n      \"datePublished\": \"2026-09-03T17:04:41.000Z\",\n      \"dateModified\": \"2026-09-03T17:04:41.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Refry a PDF with .NET with C# through a PDF to PostScript to PDF workflow using pdfRest resource IDs.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Conversion, Convert to PDF, PDF Refrying, PostScript, PDF to PostScript\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Refry a PDF in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-refry-a-pdf-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10030,10031,10032,10033,10034,10035,10036,10037],{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2133,"name":2134,"slug":2135,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2189,"name":2190,"slug":2191,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2185,"name":2186,"slug":2187,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-refry-a-pdf-in-net-with-c\u002F","How to Refry a PDF in .NET with C# | pdfRest",{"id":10042,"uuid":10043,"title":10044,"slug":10045,"html":10046,"comment_id":10042,"feature_image":48,"featured":284,"visibility":1257,"created_at":6557,"updated_at":10026,"published_at":9755,"custom_excerpt":10047,"codeinjection_head":10048,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10049,"primary_tag":10058,"url":10059,"excerpt":10047,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10060,"meta_description":10047,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a989af1d1b70dd2e2978a54","87213513-5eef-4af5-b98d-9489c5d60175","How to Refry a PDF with cURL","how-to-refry-a-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This cURL walkthrough uses the public pdfRest API directly from a shell script. It completes a PDF -> PostScript -> PDF roundtrip with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-postscript\u002F\">pdfRest PDF to PostScript API Tool\u003C\u002Fa>, then passes its output resource ID into \u003Ccode>\u002Fpdf\u003C\u002Fcode>. The complete sample is included below so cURL developers can see the file handling, request construction, and response path together.\u003C\u002Fp>\n\n\u003Ch2>Why Refry a PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>PDF refrying converts a PDF to PostScript and then converts that PostScript into a new PDF. It can support print and prepress workflows that need a PostScript-based derivative or rebuilt page content for a downstream system.\u003C\u002Fp>\n\n\u003Cp>The cURL example makes that roundtrip explicit in a portable script: the first request creates the PostScript resource, and the second uses its returned ID to create the final PDF. A prepress handoff can apply fixed production settings and a checked-in \u003Ccode>.joboptions\u003C\u002Fcode> profile without an operator manually opening or re-saving files.\u003C\u002Fp>\n\n\u003Cp>The roundtrip is deliberately lossy. Keep the original PDF as the system-of-record file whenever its tags, forms, layers, annotations, or other PDF-specific features may be needed later.\u003C\u002Fp>\n\n\u003Ch2>cURL Code Example for PDF Refrying\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">#!\u002Fbin\u002Fsh\n\n# Refry a PDF by converting it to PostScript and back to PDF.\n#\n# PDF refrying is the common name for a PDF -> PostScript -> PDF roundtrip.\n# Some print, prepress, and legacy production workflows use it to rebuild or\n# normalize page content, flatten certain PDF constructs, or prepare a file\n# for downstream systems. The process is intentionally lossy and may remove\n# tags, forms, layers, annotations, transparency, metadata, and editability.\n# Use this workflow when a downstream system requires rebuilt page content or\n# a PostScript-based interchange file.\n#\n# The PostScript-to-PDF step uses a custom .joboptions profile in this sample.\n# A .joboptions file contains Adobe Distiller-compatible conversion settings;\n# it is optional, and default settings are used when omitted. pdfRest applies\n# the profile with Datalogics PDF Converter SDK. Datalogics maintains the SDK\n# in partnership with Adobe, using the same Adobe technology that powers\n# Distiller.\n#\n# Run: sh refry-pdf.sh \u003Cpdf> \u003Cjoboptions> [outputPdf]\n\nset -eu\n\nSCRIPT_DIR=$(CDPATH= cd -- \"$(dirname -- \"$0\")\" && pwd)\nAPI_URL=\"${PDFREST_URL:-https:\u002F\u002Fapi.pdfrest.com}\"\nAPI_KEY=\"${PDFREST_API_KEY:-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\"\nINPUT_PATH=\"${1:-\u002Fpath\u002Fto\u002Fsample.pdf}\"\nJOB_OPTIONS_PATH=\"${2:-\u002Fpath\u002Fto\u002Fcustom.joboptions}\"\nOUTPUT_PATH=\"${3:-$SCRIPT_DIR\u002Frefried.pdf}\"\n\nPOSTSCRIPT_RESPONSE=$(curl --fail-with-body --silent --show-error --location \"$API_URL\u002Fpostscript\" \\\n  --header 'Accept: application\u002Fjson' \\\n  --header 'Content-Type: multipart\u002Fform-data' \\\n  --header \"Api-Key: $API_KEY\" \\\n  --form \"file=@$INPUT_PATH;type=application\u002Fpdf\" \\\n  --form 'ps_level=3' \\\n  --form 'page_range=all' \\\n  --form 'binary_output=true' \\\n  --form 'scale=1' \\\n  --form 'rotate=false' \\\n  --form 'shrink_to_fit=true' \\\n  --form 'print_annotations=true' \\\n  --form 'output=refry_intermediate')\nPOSTSCRIPT_ID=$(printf '%s' \"$POSTSCRIPT_RESPONSE\" | jq -r '.outputId')\n\nFINAL_RESPONSE=$(curl --fail-with-body --silent --show-error --location \"$API_URL\u002Fpdf\" \\\n  --header 'Accept: application\u002Fjson' \\\n  --header 'Content-Type: multipart\u002Fform-data' \\\n  --header \"Api-Key: $API_KEY\" \\\n  --form \"id=$POSTSCRIPT_ID\" \\\n  --form \"job_options=@$JOB_OPTIONS_PATH;type=application\u002Foctet-stream\" \\\n  --form 'output=refried')\nFINAL_ID=$(printf '%s' \"$FINAL_RESPONSE\" | jq -r '.outputId')\n\ncurl --fail-with-body --silent --show-error --location \\\n  \"$API_URL\u002Fresource\u002F$FINAL_ID?format=file\" \\\n  --header \"Api-Key: $API_KEY\" \\\n  --output \"$OUTPUT_PATH\"\nprintf '%s\\n' \"$FINAL_RESPONSE\" | jq .\necho \"Created $OUTPUT_PATH\"\u003C\u002Fjoboptions>\u003C\u002Fpdf>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FComplex%20Flow%20Examples\u002Frefry-pdf.sh\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Configure the service and input\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">SCRIPT_DIR=$(CDPATH= cd -- \"$(dirname -- \"$0\")\" && pwd)\nAPI_URL=\"${PDFREST_URL:-https:\u002F\u002Fapi.pdfrest.com}\"\nAPI_KEY=\"${PDFREST_API_KEY:-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\"\nINPUT_PATH=\"${1:-\u002Fpath\u002Fto\u002Fsample.pdf}\"\nJOB_OPTIONS_PATH=\"${2:-\u002Fpath\u002Fto\u002Fcustom.joboptions}\"\nOUTPUT_PATH=\"${3:-$SCRIPT_DIR\u002Frefried.pdf}\"\u003C\u002Fpre>\n\n\u003Cp>For this PDF Refrying example, cURL coordinates the two dependent API calls. cURL needs no language package installation. The sample keeps the service URL, API key, input path, and output name together near the top of the shell script so those values can be replaced before the request is sent. The sample’s placeholder path and API key make the moving pieces visible; replace them with a real local path and protected runtime credential before using the request.\u003C\u002Fp>\n\n\u003Ch3>Pass the Intermediate Resource to the Next Step\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">--form 'shrink_to_fit=true' \\\n  --form 'print_annotations=true' \\\n  --form 'output=refry_intermediate')\nPOSTSCRIPT_ID=$(printf '%s' \"$POSTSCRIPT_RESPONSE\" | jq -r '.outputId')\n\nFINAL_RESPONSE=$(curl --fail-with-body --silent --show-error --location \"$API_URL\u002Fpdf\" \\\n  --header 'Accept: application\u002Fjson' \\\n  --header 'Content-Type: multipart\u002Fform-data' \\\n  --header \"Api-Key: $API_KEY\" \\\n  --form \"id=$POSTSCRIPT_ID\" \\\n  --form \"job_options=@$JOB_OPTIONS_PATH;type=application\u002Foctet-stream\" \\\u003C\u002Fpre>\n\n\u003Cp>In the cURL workflow, \u003Ccode>outputId\u003C\u002Fcode> from \u003Ccode>\u002Fpostscript\u003C\u002Fcode> becomes the \u003Ccode>id\u003C\u002Fcode> passed to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. The second request also supplies a custom \u003Ccode>.joboptions\u003C\u002Fcode> file so the return conversion has an explicit Adobe Distiller-compatible profile, even though default settings are available when the profile is omitted.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">--header 'Content-Type: multipart\u002Fform-data' \\\n  --header \"Api-Key: $API_KEY\" \\\n  --form \"file=@$INPUT_PATH;type=application\u002Fpdf\" \\\n  --form 'ps_level=3' \\\n  --form 'page_range=all' \\\n  --form 'binary_output=true' \\\n  --form 'scale=1' \\\n  --form 'rotate=false' \\\n  --form 'shrink_to_fit=true' \\\n  --form 'print_annotations=true' \\\n  --form 'output=refry_intermediate')\u003C\u002Fpre>\n\n\u003Cp>For the PDF Refrying form, each \u003Ccode>--form\u003C\u002Fcode> option creates one multipart field. cURL reads file fields from disk when their value begins with \u003Ccode>@\u003C\u002Fcode>, while ordinary quoted values become text fields.\u003C\u002Fp>\n\n\u003Ch3>Read the output resource\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">#!\u002Fbin\u002Fsh\n\n# Refry a PDF by converting it to PostScript and back to PDF.\n#\n# PDF refrying is the common name for a PDF -> PostScript -> PDF roundtrip.\n# Some print, prepress, and legacy production workflows use it to rebuild or\n# normalize page content, flatten certain PDF constructs, or prepare a file\n# for downstream systems. The process is intentionally lossy and may remove\n# tags, forms, layers, annotations, transparency, metadata, and editability.\u003C\u002Fpre>\n\n\u003Cp>After the PDF Refrying call, the command prints the JSON response. Read \u003Ccode>outputId\u003C\u002Fcode> to retain the generated resource for a later call or download it from the returned URL before the service retention period ends.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You completed the two-stage refry process in cURL and saved the final PDF after both calls succeeded. The intermediate response ID is the important handoff between conversion stages, not merely a status value to print and discard.\u003C\u002Fp>\n\n\u003Cp>Try representative pdf refrying inputs in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the authoritative request fields, accepted values, and response contract, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">pdfRest API Reference Guide\u003C\u002Fa>. The same request pattern can then be adapted to your cURL application’s error handling, retention policy, and delivery workflow.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Refry a PDF with cURL through a PDF to PostScript to PDF workflow using pdfRest resource IDs.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-refry-a-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Refry a PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-refry-a-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-refry-a-pdf-with-curl\u002F\",\n      \"datePublished\": \"2026-09-03T17:04:41.000Z\",\n      \"dateModified\": \"2026-09-03T17:04:41.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Refry a PDF with cURL through a PDF to PostScript to PDF workflow using pdfRest resource IDs.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"GET \u002Fresource\u002F{id} API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fretrieve-files\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, PDF Refrying, PostScript, cURL, PDF to PostScript\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Refry a PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-refry-a-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10050,10051,10052,10053,10054,10055,10056,10057],{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2133,"name":2134,"slug":2135,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2189,"name":2190,"slug":2191,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2185,"name":2186,"slug":2187,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-refry-a-pdf-with-curl\u002F","How to Refry a PDF with cURL | pdfRest",{"id":10062,"uuid":10063,"title":10064,"slug":10065,"html":10066,"comment_id":10062,"feature_image":48,"featured":284,"visibility":1257,"created_at":6557,"updated_at":10026,"published_at":9755,"custom_excerpt":10067,"codeinjection_head":10068,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10069,"primary_tag":10078,"url":10079,"excerpt":10067,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10080,"meta_description":10067,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a989af1d1b70dd2e2978a5c","394bd521-0cea-413a-a578-192ef3124dfb","How to Refry a PDF with Java","how-to-refry-a-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This Java walkthrough uses an OkHttp multipart request from a JVM application. It completes a PDF -> PostScript -> PDF roundtrip with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-postscript\u002F\">pdfRest PDF to PostScript API Tool\u003C\u002Fa>, then passes its output resource ID into \u003Ccode>\u002Fpdf\u003C\u002Fcode>. The complete sample is included below so Java developers can see the file handling, request construction, and response path together.\u003C\u002Fp>\n\n\u003Ch2>Why Refry a PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>PDF refrying converts a PDF to PostScript and then converts the PostScript into a new PDF. Some document-production, print, and prepress workflows use that roundtrip when a legacy downstream system requires rebuilt page content or a PostScript-based intermediate.\u003C\u002Fp>\n\n\u003Cp>Java makes the two service dependencies explicit and easy to integrate into a managed application: the first request returns a PostScript resource, and the second request consumes that resource to produce the final PDF. No intermediate file has to be downloaded between the calls, while a job record can retain the original input ID, intermediate ID, and final PDF ID for controlled diagnostics.\u003C\u002Fp>\n\n\u003Cp>Because refrying trades away PDF-specific constructs, retain the source PDF and use the generated file only where the downstream requirement accepts the roundtrip’s consequences.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example for PDF Refrying\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONObject;\n\n\u002F*\n * Refry a PDF by converting it to PostScript and back to PDF.\n *\n * PDF refrying is the common name for a PDF -> PostScript -> PDF roundtrip.\n * Some print, prepress, and legacy production workflows use it to rebuild,\n * flatten, or normalize page content for downstream systems. The process is\n * intentionally lossy and may remove tags, forms, layers, annotations,\n * transparency, metadata, and editability. Use this workflow when a downstream\n * system requires rebuilt page content or a PostScript-based interchange file.\n *\n * The PostScript-to-PDF step uses a custom .joboptions profile in this sample.\n * A .joboptions file contains Adobe Distiller-compatible conversion settings;\n * it is optional, and default settings are used when omitted. pdfRest applies\n * the profile with Datalogics PDF Converter SDK. Datalogics maintains the SDK\n * in partnership with Adobe, using the same Adobe technology that powers\n * Distiller.\n *\n * Run: java RefryPdf \u003Cpdf> \u003Cjoboptions> [outputPdf]\n *\u002F\npublic class RefryPdf {\n  private static final String DEFAULT_API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n  private static final OkHttpClient CLIENT =\n      new OkHttpClient.Builder().readTimeout(120, TimeUnit.SECONDS).build();\n\n  public static void main(String[] args) throws IOException {\n    File inputFile = new File(args.length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fsample.pdf\");\n    File jobOptionsFile = new File(args.length > 1 ? args[1] : \"\u002Fpath\u002Fto\u002Fcustom.joboptions\");\n    Path outputPath = args.length > 2 ? Path.of(args[2]) : Path.of(\"refried.pdf\");\n\n    Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n    String apiUrl = dotenv.get(\"PDFREST_URL\", DEFAULT_API_URL).replaceAll(\"\u002F$\", \"\");\n    String apiKey = dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY);\n\n    JSONObject postscript =\n        postMultipart(\n            apiUrl,\n            apiKey,\n            \"postscript\",\n            new MultipartBody.Builder()\n                .setType(MultipartBody.FORM)\n                .addFormDataPart(\n                    \"file\",\n                    inputFile.getName(),\n                    RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\")))\n                .addFormDataPart(\"ps_level\", \"3\")\n                .addFormDataPart(\"page_range\", \"all\")\n                .addFormDataPart(\"binary_output\", \"true\")\n                .addFormDataPart(\"scale\", \"1\")\n                .addFormDataPart(\"rotate\", \"false\")\n                .addFormDataPart(\"shrink_to_fit\", \"true\")\n                .addFormDataPart(\"print_annotations\", \"true\")\n                .addFormDataPart(\"output\", \"refry_intermediate\")\n                .build());\n\n    JSONObject finalPdf =\n        postMultipart(\n            apiUrl,\n            apiKey,\n            \"pdf\",\n            new MultipartBody.Builder()\n                .setType(MultipartBody.FORM)\n                .addFormDataPart(\"id\", postscript.getString(\"outputId\"))\n                .addFormDataPart(\n                    \"job_options\",\n                    jobOptionsFile.getName(),\n                    RequestBody.create(jobOptionsFile, MediaType.parse(\"application\u002Foctet-stream\")))\n                .addFormDataPart(\"output\", \"refried\")\n                .build());\n\n    Request downloadRequest =\n        new Request.Builder()\n            .url(apiUrl + \"\u002Fresource\u002F\" + finalPdf.getString(\"outputId\") + \"?format=file\")\n            .header(\"Api-Key\", apiKey)\n            .build();\n    try (Response response = CLIENT.newCall(downloadRequest).execute()) {\n      if (!response.isSuccessful() || response.body() == null) {\n        throw new IOException(\"resource download failed: \" + response.code());\n      }\n      Files.write(outputPath, response.body().bytes());\n    }\n\n    System.out.println(finalPdf.toString(2));\n    System.out.println(\"Created \" + outputPath.toAbsolutePath());\n  }\n\n  private static JSONObject postMultipart(\n      String apiUrl, String apiKey, String endpoint, RequestBody body) throws IOException {\n    Request request =\n        new Request.Builder()\n            .url(apiUrl + \"\u002F\" + endpoint)\n            .header(\"Api-Key\", apiKey)\n            .header(\"Accept\", \"application\u002Fjson\")\n            .post(body)\n            .build();\n    try (Response response = CLIENT.newCall(request).execute()) {\n      String text = response.body() == null ? \"\" : response.body().string();\n      System.out.println(endpoint + \": \" + response.code());\n      if (!response.isSuccessful()) {\n        throw new IOException(endpoint + \" failed: \" + text);\n      }\n      return new JSONObject(text);\n    }\n  }\n}\u003C\u002Fjoboptions>\u003C\u002Fpdf>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FComplex%20Flow%20Examples\u002FRefryPdf.java\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Configure the service and input\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">public class RefryPdf {\n  private static final String DEFAULT_API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n  private static final OkHttpClient CLIENT =\n      new OkHttpClient.Builder().readTimeout(120, TimeUnit.SECONDS).build();\n\n  public static void main(String[] args) throws IOException {\u003C\u002Fpre>\n\n\u003Cp>For this PDF Refrying example, Java coordinates the two dependent API calls. The Java samples use OkHttp for multipart HTTP requests and dotenv support for repository configuration. The sample project supplies those dependencies; applications that copy the class elsewhere need equivalent dependencies and secure runtime configuration. The sample’s placeholder path and API key make the moving pieces visible; replace them with a real local path and protected runtime credential before using the request.\u003C\u002Fp>\n\n\u003Ch3>Pass the Intermediate Resource to the Next Step\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\"pdf\",\n            new MultipartBody.Builder()\n                .setType(MultipartBody.FORM)\n                .addFormDataPart(\"id\", postscript.getString(\"outputId\"))\n                .addFormDataPart(\n                    \"job_options\",\n                    jobOptionsFile.getName(),\n                    RequestBody.create(jobOptionsFile, MediaType.parse(\"application\u002Foctet-stream\")))\n                .addFormDataPart(\"output\", \"refried\")\n                .build());\u003C\u002Fpre>\n\n\u003Cp>In the Java workflow, \u003Ccode>outputId\u003C\u002Fcode> from \u003Ccode>\u002Fpostscript\u003C\u002Fcode> becomes the \u003Ccode>id\u003C\u002Fcode> passed to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. The second request also supplies a custom \u003Ccode>.joboptions\u003C\u002Fcode> file so the return conversion has an explicit Adobe Distiller-compatible profile, even though default settings are available when the profile is omitted.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">apiKey,\n            \"postscript\",\n            new MultipartBody.Builder()\n                .setType(MultipartBody.FORM)\n                .addFormDataPart(\n                    \"file\",\n                    inputFile.getName(),\n                    RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\")))\n                .addFormDataPart(\"ps_level\", \"3\")\n                .addFormDataPart(\"page_range\", \"all\")\n                .addFormDataPart(\"binary_output\", \"true\")\u003C\u002Fpre>\n\n\u003Cp>For the PDF Refrying form, okHttp’s \u003Ccode>MultipartBody.Builder\u003C\u002Fcode> constructs the form and assigns its boundary. Each file part carries a filename and media type, while conversion options are ordinary text parts.\u003C\u002Fp>\n\n\u003Ch3>Read the output resource\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.url(apiUrl + \"\u002Fresource\u002F\" + finalPdf.getString(\"outputId\") + \"?format=file\")\n            .header(\"Api-Key\", apiKey)\n            .build();\n    try (Response response = CLIENT.newCall(downloadRequest).execute()) {\n      if (!response.isSuccessful() || response.body() == null) {\n        throw new IOException(\"resource download failed: \" + response.code());\n      }\n      Files.write(outputPath, response.body().bytes());\n    }\n\n    System.out.println(finalPdf.toString(2));\n    System.out.println(\"Created \" + outputPath.toAbsolutePath());\u003C\u002Fpre>\n\n\u003Cp>After the PDF Refrying call, the response block checks the HTTP status before printing its body. On success, the JSON contains the output resource ID and URL; on failure, the printed body gives the API error detail needed for diagnosis.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You completed the two-stage refry process in Java and saved the final PDF after both calls succeeded. The intermediate response ID is the important handoff between conversion stages, not merely a status value to print and discard.\u003C\u002Fp>\n\n\u003Cp>Try representative pdf refrying inputs in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the authoritative request fields, accepted values, and response contract, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">pdfRest API Reference Guide\u003C\u002Fa>. The same request pattern can then be adapted to your Java application’s error handling, retention policy, and delivery workflow.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Refry a PDF with Java through a PDF to PostScript to PDF workflow using pdfRest resource IDs.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-refry-a-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Refry a PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-refry-a-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-refry-a-pdf-with-java\u002F\",\n      \"datePublished\": \"2026-09-03T17:04:41.000Z\",\n      \"dateModified\": \"2026-09-03T17:04:41.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Refry a PDF with Java through a PDF to PostScript to PDF workflow using pdfRest resource IDs.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"GET \u002Fresource\u002F{id} API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fretrieve-files\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, Java, PDF Refrying, PostScript, PDF to PostScript\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Refry a PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-refry-a-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10070,10071,10072,10073,10074,10075,10076,10077],{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2133,"name":2134,"slug":2135,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2189,"name":2190,"slug":2191,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2185,"name":2186,"slug":2187,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-refry-a-pdf-with-java\u002F","How to Refry a PDF with Java | pdfRest",{"id":10082,"uuid":10083,"title":10084,"slug":10085,"html":10086,"comment_id":10082,"feature_image":48,"featured":284,"visibility":1257,"created_at":10025,"updated_at":10026,"published_at":10087,"custom_excerpt":10088,"codeinjection_head":10089,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10090,"primary_tag":10099,"url":10100,"excerpt":10088,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10101,"meta_description":10088,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a989af2d1b70dd2e2978a64","bef8a83f-acbd-4f19-85e3-6f5f32eb9219","How to Refry a PDF with JavaScript in NodeJS","how-to-refry-a-pdf-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This NodeJS walkthrough uses JavaScript, Axios, and multipart form data. It completes a PDF -> PostScript -> PDF roundtrip with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-postscript\u002F\">pdfRest PDF to PostScript API Tool\u003C\u002Fa>, then passes its output resource ID into \u003Ccode>\u002Fpdf\u003C\u002Fcode>. The complete sample is included below so JavaScript in NodeJS developers can see the file handling, request construction, and response path together.\u003C\u002Fp>\n\n\u003Ch2>Why Refry a PDF with JavaScript in NodeJS?\u003C\u002Fh2>\n\n\u003Cp>PDF refrying converts a PDF to PostScript and then converts that PostScript into a new PDF. It can be useful in a print or prepress delivery flow when a downstream stage expects page content rebuilt through a PostScript-based path.\u003C\u002Fp>\n\n\u003Cp>JavaScript in NodeJS expresses that process as two awaited requests: the first result’s \u003Ccode>outputId\u003C\u002Fcode> becomes a data dependency for the second call instead of a temporary local file that has to be managed separately. A worker can apply a chosen \u003Ccode>.joboptions\u003C\u002Fcode> configuration on the return conversion, then upload or download the final PDF only after both calls complete.\u003C\u002Fp>\n\n\u003Cp>The workflow is intentionally lossy. Retain the original PDF when tags, forms, annotations, transparency, layers, or other PDF-specific content remain important.\u003C\u002Fp>\n\n\u003Ch2>JavaScript in NodeJS Code Example for PDF Refrying\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F**\n * Refry a PDF by converting it to PostScript and back to PDF.\n *\n * PDF refrying is the common name for a PDF -> PostScript -> PDF roundtrip.\n * Some print, prepress, and legacy production workflows use it to rebuild or\n * normalize page content, flatten certain PDF constructs, or prepare a file\n * for downstream systems. The process is intentionally lossy and may remove\n * tags, forms, layers, annotations, transparency, metadata, and editability.\n * Use this workflow when a downstream system requires rebuilt page content or\n * a PostScript-based interchange file.\n *\n * The PostScript-to-PDF step uses a custom .joboptions profile in this sample.\n * A .joboptions file contains Adobe Distiller-compatible conversion settings;\n * it is optional, and default settings are used when omitted. pdfRest applies\n * the profile with Datalogics PDF Converter SDK. Datalogics maintains the SDK\n * in partnership with Adobe, using the same Adobe technology that powers\n * Distiller.\n *\n * Run: node refry-pdf.js \u003Cpdf> \u003Cjoboptions> [outputPdf]\n *\u002F\nconst axios = require(\"axios\");\nconst FormData = require(\"form-data\");\nconst fs = require(\"fs\");\nconst path = require(\"path\");\n\nconst apiUrl = (process.env.PDFREST_URL || \"https:\u002F\u002Fapi.pdfrest.com\").replace(\u002F\\\u002F$\u002F, \"\");\nconst apiKey = process.env.PDFREST_API_KEY || \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\nconst inputPath = process.argv[2] || \"\u002Fpath\u002Fto\u002Fsample.pdf\";\nconst jobOptionsPath = process.argv[3] || \"\u002Fpath\u002Fto\u002Fcustom.joboptions\";\nconst outputPath = process.argv[4] || path.join(__dirname, \"refried.pdf\");\n\nasync function postMultipart(endpoint, fields) {\n  const form = new FormData();\n  for (const field of fields) {\n    if (field.path) {\n      form.append(field.name, fs.createReadStream(field.path), {\n        filename: path.basename(field.path),\n        contentType: field.contentType,\n      });\n    } else {\n      form.append(field.name, field.value);\n    }\n  }\n  const response = await axios.post(`${apiUrl}\u002F${endpoint}`, form, {\n    headers: { Accept: \"application\u002Fjson\", \"Api-Key\": apiKey, ...form.getHeaders() },\n    maxBodyLength: Infinity,\n  });\n  console.log(`${endpoint}: ${response.status}`);\n  return response.data;\n}\n\nasync function main() {\n  const postscript = await postMultipart(\"postscript\", [\n    { name: \"file\", path: inputPath, contentType: \"application\u002Fpdf\" },\n    { name: \"ps_level\", value: \"3\" },\n    { name: \"page_range\", value: \"all\" },\n    { name: \"binary_output\", value: \"true\" },\n    { name: \"scale\", value: \"1\" },\n    { name: \"rotate\", value: \"false\" },\n    { name: \"shrink_to_fit\", value: \"true\" },\n    { name: \"print_annotations\", value: \"true\" },\n    { name: \"output\", value: \"refry_intermediate\" },\n  ]);\n  const finalPdf = await postMultipart(\"pdf\", [\n    { name: \"id\", value: postscript.outputId },\n    { name: \"job_options\", path: jobOptionsPath, contentType: \"application\u002Foctet-stream\" },\n    { name: \"output\", value: \"refried\" },\n  ]);\n  const download = await axios.get(`${apiUrl}\u002Fresource\u002F${finalPdf.outputId}?format=file`, {\n    headers: { \"Api-Key\": apiKey },\n    responseType: \"arraybuffer\",\n  });\n  fs.writeFileSync(outputPath, download.data);\n  console.log(JSON.stringify(finalPdf, null, 2));\n  console.log(`Created ${outputPath}`);\n}\n\nmain().catch((error) => {\n  console.error(error.response ? error.response.data : error.message);\n  process.exitCode = 1;\n});\u003C\u002Fjoboptions>\u003C\u002Fpdf>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FComplex%20Flow%20Examples\u002Frefry-pdf.js\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Configure the service and input\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">const apiUrl = (process.env.PDFREST_URL || \"https:\u002F\u002Fapi.pdfrest.com\").replace(\u002F\\\u002F$\u002F, \"\");\nconst apiKey = process.env.PDFREST_API_KEY || \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\nconst inputPath = process.argv[2] || \"\u002Fpath\u002Fto\u002Fsample.pdf\";\nconst jobOptionsPath = process.argv[3] || \"\u002Fpath\u002Fto\u002Fcustom.joboptions\";\nconst outputPath = process.argv[4] || path.join(__dirname, \"refried.pdf\");\u003C\u002Fpre>\n\n\u003Cp>For this PDF Refrying example, JavaScript in NodeJS coordinates the two dependent API calls. The NodeJS samples use \u003Ccode>axios\u003C\u002Fcode> for HTTP, \u003Ccode>form-data\u003C\u002Fcode> for multipart encoding, and Node’s file-system module for local inputs. Install the packages listed in the repository’s JavaScript package manifest when adapting the example. The sample’s placeholder path and API key make the moving pieces visible; replace them with a real local path and protected runtime credential before using the request.\u003C\u002Fp>\n\n\u003Ch3>Pass the Intermediate Resource to the Next Step\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">{ name: \"output\", value: \"refry_intermediate\" },\n  ]);\n  const finalPdf = await postMultipart(\"pdf\", [\n    { name: \"id\", value: postscript.outputId },\n    { name: \"job_options\", path: jobOptionsPath, contentType: \"application\u002Foctet-stream\" },\n    { name: \"output\", value: \"refried\" },\n  ]);\n  const download = await axios.get(`${apiUrl}\u002Fresource\u002F${finalPdf.outputId}?format=file`, {\n    headers: { \"Api-Key\": apiKey },\n    responseType: \"arraybuffer\",\n  });\u003C\u002Fpre>\n\n\u003Cp>In the JavaScript in NodeJS workflow, \u003Ccode>outputId\u003C\u002Fcode> from \u003Ccode>\u002Fpostscript\u003C\u002Fcode> becomes the \u003Ccode>id\u003C\u002Fcode> passed to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. The second request also supplies a custom \u003Ccode>.joboptions\u003C\u002Fcode> file so the return conversion has an explicit Adobe Distiller-compatible profile, even though default settings are available when the profile is omitted.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">*\u002F\nconst axios = require(\"axios\");\nconst FormData = require(\"form-data\");\nconst fs = require(\"fs\");\nconst path = require(\"path\");\n\nconst apiUrl = (process.env.PDFREST_URL || \"https:\u002F\u002Fapi.pdfrest.com\").replace(\u002F\\\u002F$\u002F, \"\");\nconst apiKey = process.env.PDFREST_API_KEY || \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\nconst inputPath = process.argv[2] || \"\u002Fpath\u002Fto\u002Fsample.pdf\";\nconst jobOptionsPath = process.argv[3] || \"\u002Fpath\u002Fto\u002Fcustom.joboptions\";\nconst outputPath = process.argv[4] || path.join(__dirname, \"refried.pdf\");\u003C\u002Fpre>\n\n\u003Cp>For the PDF Refrying form, \u003Ccode>FormData\u003C\u002Fcode> appends a readable file stream and the text options. Its generated headers include the multipart boundary, so the request combines \u003Ccode>form.getHeaders()\u003C\u002Fcode> with the \u003Ccode>Api-Key\u003C\u002Fcode> header rather than setting a boundary by hand.\u003C\u002Fp>\n\n\u003Ch3>Read the output resource\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">*\n * Run: node refry-pdf.js \u003Cpdf> \u003Cjoboptions> [outputPdf]\n *\u002F\nconst axios = require(\"axios\");\nconst FormData = require(\"form-data\");\nconst fs = require(\"fs\");\nconst path = require(\"path\");\n\nconst apiUrl = (process.env.PDFREST_URL || \"https:\u002F\u002Fapi.pdfrest.com\").replace(\u002F\\\u002F$\u002F, \"\");\nconst apiKey = process.env.PDFREST_API_KEY || \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\nconst inputPath = process.argv[2] || \"\u002Fpath\u002Fto\u002Fsample.pdf\";\nconst jobOptionsPath = process.argv[3] || \"\u002Fpath\u002Fto\u002Fcustom.joboptions\";\u003C\u002Fjoboptions>\u003C\u002Fpdf>\u003C\u002Fpre>\n\n\u003Cp>After the PDF Refrying call, axios resolves successful responses to a JSON object and sends API failures to the catch block. The sample prints either the output-resource details or the returned error payload, which is a useful starting point for production logging.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You completed the two-stage refry process in JavaScript in NodeJS and saved the final PDF after both calls succeeded. The intermediate response ID is the important handoff between conversion stages, not merely a status value to print and discard.\u003C\u002Fp>\n\n\u003Cp>Try representative pdf refrying inputs in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the authoritative request fields, accepted values, and response contract, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">pdfRest API Reference Guide\u003C\u002Fa>. The same request pattern can then be adapted to your JavaScript in NodeJS application’s error handling, retention policy, and delivery workflow.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-03T17:04:42.000+00:00","Refry a PDF with JavaScript in NodeJS through a PDF to PostScript to PDF workflow using pdfRest resource IDs.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-refry-a-pdf-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Refry a PDF with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-refry-a-pdf-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-refry-a-pdf-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2026-09-03T17:04:42.000Z\",\n      \"dateModified\": \"2026-09-03T17:04:42.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Refry a PDF with JavaScript in NodeJS through a PDF to PostScript to PDF workflow using pdfRest resource IDs.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"GET \u002Fresource\u002F{id} API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fretrieve-files\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, JavaScript, PDF Refrying, PostScript, PDF to PostScript\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Refry a PDF with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-refry-a-pdf-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10091,10092,10093,10094,10095,10096,10097,10098],{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2133,"name":2134,"slug":2135,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2189,"name":2190,"slug":2191,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2185,"name":2186,"slug":2187,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-refry-a-pdf-with-javascript-in-nodejs\u002F","How to Refry a PDF with JavaScript in NodeJS | pdfRest",{"id":10103,"uuid":10104,"title":10105,"slug":10106,"html":10107,"comment_id":10103,"feature_image":48,"featured":284,"visibility":1257,"created_at":10025,"updated_at":10026,"published_at":10087,"custom_excerpt":10108,"codeinjection_head":10109,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10110,"primary_tag":10119,"url":10120,"excerpt":10108,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10121,"meta_description":10108,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a989af2d1b70dd2e2978a74","2d94d514-0f03-43f5-8f28-667a92c59b55","How to Refry a PDF with PHP","how-to-refry-a-pdf-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This PHP walkthrough uses Guzzle to send the file and conversion options. It completes a PDF -> PostScript -> PDF roundtrip with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-postscript\u002F\">pdfRest PDF to PostScript API Tool\u003C\u002Fa>, then passes its output resource ID into \u003Ccode>\u002Fpdf\u003C\u002Fcode>. The complete sample is included below so PHP developers can see the file handling, request construction, and response path together.\u003C\u002Fp>\n\n\u003Ch2>Why Refry a PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>PDF refrying converts a PDF to PostScript and then converts the PostScript into a new PDF. It can support an established print or prepress path that needs a rebuilt delivery derivative for a legacy downstream stage.\u003C\u002Fp>\n\n\u003Cp>A PHP job can orchestrate that purpose as a clear two-step sequence rather than an opaque external process. The first response identifies the temporary PostScript result; the next request references that result, applies a known \u003Ccode>.joboptions\u003C\u002Fcode> profile when needed, and returns the final PDF without transferring the intermediate outside the service.\u003C\u002Fp>\n\n\u003Cp>Since the route can discard interactive and structural PDF features, production code should store the original source independently and treat the generated PDF as a delivery derivative.\u003C\u002Fp>\n\n\u003Ch2>PHP Code Example for PDF Refrying\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">\u002F* Refry a PDF by converting it to PostScript and back to PDF.\n *\n * PDF refrying is the common name for a PDF -> PostScript -> PDF roundtrip.\n * Some print, prepress, and legacy production workflows use it to rebuild or\n * normalize page content, flatten certain PDF constructs, or prepare a file\n * for downstream systems. The process is intentionally lossy and may remove\n * tags, forms, layers, annotations, transparency, metadata, and editability.\n * Use this workflow when a downstream system requires rebuilt page content or\n * a PostScript-based interchange file.\n *\n * The PostScript-to-PDF step uses a custom .joboptions profile in this sample.\n * A .joboptions file contains Adobe Distiller-compatible conversion settings;\n * it is optional, and default settings are used when omitted. pdfRest applies\n * the profile with Datalogics PDF Converter SDK. Datalogics maintains the SDK\n * in partnership with Adobe, using the same Adobe technology that powers\n * Distiller.\n *\n * Run: php refry-pdf.php \u003Cpdf> \u003Cjoboptions> [outputPdf]\n *\u002F\n\nrequire 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$apiUrl = rtrim(getenv('PDFREST_URL') ?: 'https:\u002F\u002Fapi.pdfrest.com', '\u002F');\n$apiKey = getenv('PDFREST_API_KEY') ?: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';\n$inputPath = $argv[1] ?? '\u002Fpath\u002Fto\u002Fsample.pdf';\n$jobOptionsPath = $argv[2] ?? '\u002Fpath\u002Fto\u002Fcustom.joboptions';\n$outputPath = $argv[3] ?? __DIR__ . '\u002Frefried.pdf';\n$client = new Client(['http_errors' => true]);\n\nfunction postMultipart(Client $client, string $url, string $apiKey, array $parts): array\n{\n    $response = $client->post($url, [\n        'headers' => ['Accept' => 'application\u002Fjson', 'Api-Key' => $apiKey],\n        'multipart' => $parts,\n    ]);\n    echo basename($url) . ': ' . $response->getStatusCode() . PHP_EOL;\n    return json_decode($response->getBody(), true, 512, JSON_THROW_ON_ERROR);\n}\n\n$postscript = postMultipart($client, $apiUrl . '\u002Fpostscript', $apiKey, [\n    ['name' => 'file', 'contents' => Utils::tryFopen($inputPath, 'r'), 'filename' => basename($inputPath), 'headers' => ['Content-Type' => 'application\u002Fpdf']],\n    ['name' => 'ps_level', 'contents' => '3'],\n    ['name' => 'page_range', 'contents' => 'all'],\n    ['name' => 'binary_output', 'contents' => 'true'],\n    ['name' => 'scale', 'contents' => '1'],\n    ['name' => 'rotate', 'contents' => 'false'],\n    ['name' => 'shrink_to_fit', 'contents' => 'true'],\n    ['name' => 'print_annotations', 'contents' => 'true'],\n    ['name' => 'output', 'contents' => 'refry_intermediate'],\n]);\n\n$finalPdf = postMultipart($client, $apiUrl . '\u002Fpdf', $apiKey, [\n    ['name' => 'id', 'contents' => $postscript['outputId']],\n    ['name' => 'job_options', 'contents' => Utils::tryFopen($jobOptionsPath, 'r'), 'filename' => basename($jobOptionsPath), 'headers' => ['Content-Type' => 'application\u002Foctet-stream']],\n    ['name' => 'output', 'contents' => 'refried'],\n]);\n\n$download = $client->get($apiUrl . '\u002Fresource\u002F' . rawurlencode($finalPdf['outputId']) . '?format=file', ['headers' => ['Api-Key' => $apiKey]]);\nfile_put_contents($outputPath, $download->getBody()->getContents());\necho json_encode($finalPdf, JSON_PRETTY_PRINT) . PHP_EOL;\necho \"Created $outputPath\" . PHP_EOL;\u003C\u002Fjoboptions>\u003C\u002Fpdf>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FComplex%20Flow%20Examples\u002Frefry-pdf.php\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Configure the service and input\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">$apiUrl = rtrim(getenv('PDFREST_URL') ?: 'https:\u002F\u002Fapi.pdfrest.com', '\u002F');\n$apiKey = getenv('PDFREST_API_KEY') ?: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';\n$inputPath = $argv[1] ?? '\u002Fpath\u002Fto\u002Fsample.pdf';\n$jobOptionsPath = $argv[2] ?? '\u002Fpath\u002Fto\u002Fcustom.joboptions';\n$outputPath = $argv[3] ?? __DIR__ . '\u002Frefried.pdf';\n$client = new Client(['http_errors' => true]);\u003C\u002Fpre>\n\n\u003Cp>For this PDF Refrying example, PHP coordinates the two dependent API calls. The PHP samples use Guzzle for HTTP and PSR-7 stream utilities for uploads. Install Guzzle with Composer when moving the code outside the repository, and provide the API key through protected runtime configuration. The sample’s placeholder path and API key make the moving pieces visible; replace them with a real local path and protected runtime credential before using the request.\u003C\u002Fp>\n\n\u003Ch3>Pass the Intermediate Resource to the Next Step\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">]);\n\n$finalPdf = postMultipart($client, $apiUrl . '\u002Fpdf', $apiKey, [\n    ['name' => 'id', 'contents' => $postscript['outputId']],\n    ['name' => 'job_options', 'contents' => Utils::tryFopen($jobOptionsPath, 'r'), 'filename' => basename($jobOptionsPath), 'headers' => ['Content-Type' => 'application\u002Foctet-stream']],\n    ['name' => 'output', 'contents' => 'refried'],\n]);\n\n$download = $client->get($apiUrl . '\u002Fresource\u002F' . rawurlencode($finalPdf['outputId']) . '?format=file', ['headers' => ['Api-Key' => $apiKey]]);\nfile_put_contents($outputPath, $download->getBody()->getContents());\necho json_encode($finalPdf, JSON_PRETTY_PRINT) . PHP_EOL;\u003C\u002Fpre>\n\n\u003Cp>In the PHP workflow, \u003Ccode>outputId\u003C\u002Fcode> from \u003Ccode>\u002Fpostscript\u003C\u002Fcode> becomes the \u003Ccode>id\u003C\u002Fcode> passed to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. The second request also supplies a custom \u003Ccode>.joboptions\u003C\u002Fcode> file so the return conversion has an explicit Adobe Distiller-compatible profile, even though default settings are available when the profile is omitted.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">\u002F* Refry a PDF by converting it to PostScript and back to PDF.\n *\n * PDF refrying is the common name for a PDF -> PostScript -> PDF roundtrip.\n * Some print, prepress, and legacy production workflows use it to rebuild or\n * normalize page content, flatten certain PDF constructs, or prepare a file\n * for downstream systems. The process is intentionally lossy and may remove\n * tags, forms, layers, annotations, transparency, metadata, and editability.\n * Use this workflow when a downstream system requires rebuilt page content or\n * a PostScript-based interchange file.\u003C\u002Fpre>\n\n\u003Cp>For the PDF Refrying form, guzzle accepts multipart fields as an array. Each entry names a field and supplies either stream content for a file or a simple string for an option, then Guzzle produces the correct multipart boundary.\u003C\u002Fp>\n\n\u003Ch3>Read the output resource\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">function postMultipart(Client $client, string $url, string $apiKey, array $parts): array\n{\n    $response = $client->post($url, [\n        'headers' => ['Accept' => 'application\u002Fjson', 'Api-Key' => $apiKey],\n        'multipart' => $parts,\n    ]);\n    echo basename($url) . ': ' . $response->getStatusCode() . PHP_EOL;\n    return json_decode($response->getBody(), true, 512, JSON_THROW_ON_ERROR);\n}\n\n$postscript = postMultipart($client, $apiUrl . '\u002Fpostscript', $apiKey, [\u003C\u002Fpre>\n\n\u003Cp>After the PDF Refrying call, the example prints Guzzle’s response body. A production caller can decode that JSON, retain \u003Ccode>outputId\u003C\u002Fcode>, and branch on an unsuccessful response instead of assuming every submitted conversion completed.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You completed the two-stage refry process in PHP and saved the final PDF after both calls succeeded. The intermediate response ID is the important handoff between conversion stages, not merely a status value to print and discard.\u003C\u002Fp>\n\n\u003Cp>Try representative pdf refrying inputs in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the authoritative request fields, accepted values, and response contract, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">pdfRest API Reference Guide\u003C\u002Fa>. The same request pattern can then be adapted to your PHP application’s error handling, retention policy, and delivery workflow.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Refry a PDF with PHP through a PDF to PostScript to PDF workflow using pdfRest resource IDs.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-refry-a-pdf-with-php\u002F#article\",\n      \"headline\": \"How to Refry a PDF with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-refry-a-pdf-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-refry-a-pdf-with-php\u002F\",\n      \"datePublished\": \"2026-09-03T17:04:42.000Z\",\n      \"dateModified\": \"2026-09-03T17:04:42.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Refry a PDF with PHP through a PDF to PostScript to PDF workflow using pdfRest resource IDs.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"GET \u002Fresource\u002F{id} API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fretrieve-files\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, PDF Refrying, PHP, PostScript, PDF to PostScript\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Refry a PDF with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-refry-a-pdf-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10111,10112,10113,10114,10115,10116,10117,10118],{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2133,"name":2134,"slug":2135,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2189,"name":2190,"slug":2191,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2185,"name":2186,"slug":2187,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-refry-a-pdf-with-php\u002F","How to Refry a PDF with PHP | pdfRest",{"id":10123,"uuid":10124,"title":10125,"slug":10126,"html":10127,"comment_id":10123,"feature_image":48,"featured":284,"visibility":1257,"created_at":10025,"updated_at":10128,"published_at":10087,"custom_excerpt":10129,"codeinjection_head":10130,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10131,"primary_tag":10140,"url":10141,"excerpt":10129,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10142,"meta_description":10129,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a989af2d1b70dd2e2978a7c","45f1ae2b-ab6a-4916-81dd-fd53adf2bf3b","How to Refry a PDF with Python","how-to-refry-a-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This Python walkthrough uses \u003Ccode>requests\u003C\u002Fcode> and a multipart encoder. It completes a PDF -> PostScript -> PDF roundtrip with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fpdf-to-postscript\u002F\">pdfRest PDF to PostScript API Tool\u003C\u002Fa>, then passes its output resource ID into \u003Ccode>\u002Fpdf\u003C\u002Fcode>. The complete sample is included below so Python developers can see the file handling, request construction, and response path together.\u003C\u002Fp>\n\n\u003Ch2>Why Refry a PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>PDF refrying converts a PDF to PostScript and then converts the PostScript into a new PDF. Some prepress-support processes use it when they need a PostScript-based normalization stage between a supplier file and a delivery PDF.\u003C\u002Fp>\n\n\u003Cp>Python is well suited to express that sequence as a small, observable data pipeline: submit the original PDF, capture the PostScript ID, submit that ID with the desired profile, and save the completed PDF bytes. Recording the intermediate and final IDs also gives operators a useful account of what happened in the job.\u003C\u002Fp>\n\n\u003Cp>The roundtrip is not a preservation operation. Keep the source PDF where form fields, tags, layers, annotations, transparency, metadata, or editing capability must survive.\u003C\u002Fp>\n\n\u003Ch2>Python Code Example for PDF Refrying\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">\"\"\"Refry a PDF by converting it to PostScript and back to PDF.\n\nPDF refrying is the common name for a PDF -> PostScript -> PDF roundtrip.\nSome print, prepress, and legacy production workflows use it to rebuild or\nnormalize page content, flatten certain PDF constructs, or prepare a file for\ndownstream systems. The process is intentionally lossy and may remove tags,\nforms, layers, annotations, transparency, metadata, and editability. Use this\nworkflow when a downstream system requires rebuilt page content or a\nPostScript-based interchange file.\n\nThe PostScript-to-PDF step uses a custom .joboptions profile in this sample. A\n.joboptions file contains Adobe Distiller-compatible conversion settings; it is\noptional, and default settings are used when omitted. pdfRest applies the\nprofile with Datalogics PDF Converter SDK. Datalogics maintains the SDK in\npartnership with Adobe, using the same Adobe technology that powers Distiller.\n\nRun: python3 refry-pdf.py \u003Cpdf> \u003Cjoboptions> [outputPdf]\n\"\"\"\n\nimport json\nimport os\nimport sys\nfrom pathlib import Path\n\nimport requests\nfrom requests_toolbelt import MultipartEncoder\n\n\nAPI_URL = os.getenv(\"PDFREST_URL\", \"https:\u002F\u002Fapi.pdfrest.com\").rstrip(\"\u002F\")\nAPI_KEY = os.getenv(\"PDFREST_API_KEY\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\")\nINPUT_PATH = Path(sys.argv[1]) if len(sys.argv) > 1 else Path(\"\u002Fpath\u002Fto\u002Fsample.pdf\")\nJOB_OPTIONS_PATH = (\n    Path(sys.argv[2]) if len(sys.argv) > 2 else Path(\"\u002Fpath\u002Fto\u002Fcustom.joboptions\")\n)\nOUTPUT_PATH = Path(__file__).with_name(\"refried.pdf\")\nif len(sys.argv) > 3:\n    OUTPUT_PATH = Path(sys.argv[3])\n\n\ndef post_multipart(endpoint, fields):\n    \"\"\"Send a multipart request and return its JSON response.\"\"\"\n    form = MultipartEncoder(fields=fields)\n    response = requests.post(\n        f\"{API_URL}\u002F{endpoint}\",\n        data=form,\n        headers={\n            \"Accept\": \"application\u002Fjson\",\n            \"Content-Type\": form.content_type,\n            \"Api-Key\": API_KEY,\n        },\n        timeout=120,\n    )\n    print(f\"{endpoint}: {response.status_code}\")\n    if not response.ok:\n        raise RuntimeError(f\"{endpoint} failed: {response.text}\")\n    return response.json()\n\n\nwith INPUT_PATH.open(\"rb\") as input_file:\n    postscript = post_multipart(\n        \"postscript\",\n        {\n            \"file\": (INPUT_PATH.name, input_file, \"application\u002Fpdf\"),\n            \"ps_level\": \"3\",\n            \"page_range\": \"all\",\n            \"binary_output\": \"true\",\n            \"scale\": \"1\",\n            \"rotate\": \"false\",\n            \"shrink_to_fit\": \"true\",\n            \"print_annotations\": \"true\",\n            \"output\": \"refry_intermediate\",\n        },\n    )\n\nwith JOB_OPTIONS_PATH.open(\"rb\") as job_options_file:\n    final_pdf = post_multipart(\n        \"pdf\",\n        {\n            \"id\": postscript[\"outputId\"],\n            \"job_options\": (\n                JOB_OPTIONS_PATH.name,\n                job_options_file,\n                \"application\u002Foctet-stream\",\n            ),\n            \"output\": \"refried\",\n        },\n    )\n\ndownload = requests.get(\n    f\"{API_URL}\u002Fresource\u002F{final_pdf['outputId']}?format=file\",\n    headers={\"Api-Key\": API_KEY},\n    timeout=120,\n)\ndownload.raise_for_status()\nOUTPUT_PATH.write_bytes(download.content)\nprint(json.dumps(final_pdf, indent=2))\nprint(f\"Created {OUTPUT_PATH}\")\u003C\u002Fjoboptions>\u003C\u002Fpdf>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FComplex%20Flow%20Examples\u002Frefry-pdf.py\">View the sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Configure the service and input\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\">\"\"\"Refry a PDF by converting it to PostScript and back to PDF.\n\nPDF refrying is the common name for a PDF -> PostScript -> PDF roundtrip.\nSome print, prepress, and legacy production workflows use it to rebuild or\nnormalize page content, flatten certain PDF constructs, or prepare a file for\ndownstream systems. The process is intentionally lossy and may remove tags,\u003C\u002Fpre>\n\n\u003Cp>For this PDF Refrying example, Python coordinates the two dependent API calls. The Python samples use \u003Ccode>requests\u003C\u002Fcode> and \u003Ccode>MultipartEncoder\u003C\u002Fcode> from \u003Ccode>requests-toolbelt\u003C\u002Fcode>. Install both packages when using the file outside the samples project and keep the API key in environment configuration. The sample’s placeholder path and API key make the moving pieces visible; replace them with a real local path and protected runtime credential before using the request.\u003C\u002Fp>\n\n\u003Ch3>Pass the Intermediate Resource to the Next Step\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\">final_pdf = post_multipart(\n        \"pdf\",\n        {\n            \"id\": postscript[\"outputId\"],\n            \"job_options\": (\n                JOB_OPTIONS_PATH.name,\n                job_options_file,\n                \"application\u002Foctet-stream\",\n            ),\n            \"output\": \"refried\",\n        },\u003C\u002Fpre>\n\n\u003Cp>In the Python workflow, \u003Ccode>outputId\u003C\u002Fcode> from \u003Ccode>\u002Fpostscript\u003C\u002Fcode> becomes the \u003Ccode>id\u003C\u002Fcode> passed to \u003Ccode>\u002Fpdf\u003C\u002Fcode>. The second request also supplies a custom \u003Ccode>.joboptions\u003C\u002Fcode> file so the return conversion has an explicit Adobe Distiller-compatible profile, even though default settings are available when the profile is omitted.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\">import requests\nfrom requests_toolbelt import MultipartEncoder\n\n\nAPI_URL = os.getenv(\"PDFREST_URL\", \"https:\u002F\u002Fapi.pdfrest.com\").rstrip(\"\u002F\")\nAPI_KEY = os.getenv(\"PDFREST_API_KEY\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\")\nINPUT_PATH = Path(sys.argv[1]) if len(sys.argv) > 1 else Path(\"\u002Fpath\u002Fto\u002Fsample.pdf\")\nJOB_OPTIONS_PATH = (\n    Path(sys.argv[2]) if len(sys.argv) > 2 else Path(\"\u002Fpath\u002Fto\u002Fcustom.joboptions\")\n)\u003C\u002Fpre>\n\n\u003Cp>For the PDF Refrying form, \u003Ccode>MultipartEncoder\u003C\u002Fcode> combines the file tuple and text fields, then exposes a \u003Ccode>content_type\u003C\u002Fcode> value that includes the generated boundary. That value must be used as the request header.\u003C\u002Fp>\n\n\u003Ch3>Read the output resource\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\">def post_multipart(endpoint, fields):\n    \"\"\"Send a multipart request and return its JSON response.\"\"\"\n    form = MultipartEncoder(fields=fields)\n    response = requests.post(\n        f\"{API_URL}\u002F{endpoint}\",\n        data=form,\n        headers={\n            \"Accept\": \"application\u002Fjson\",\n            \"Content-Type\": form.content_type,\n            \"Api-Key\": API_KEY,\n        },\n        timeout=120,\u003C\u002Fpre>\n\n\u003Cp>After the PDF Refrying call, the sample prints formatted response JSON after a successful request and exits with an error after printing a failed response. Preserve the returned \u003Ccode>outputId\u003C\u002Fcode> when the next workflow step needs the generated resource.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You completed the two-stage refry process in Python and saved the final PDF after both calls succeeded. The intermediate response ID is the important handoff between conversion stages, not merely a status value to print and discard.\u003C\u002Fp>\n\n\u003Cp>Try representative pdf refrying inputs in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the authoritative request fields, accepted values, and response contract, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">pdfRest API Reference Guide\u003C\u002Fa>. The same request pattern can then be adapted to your Python application’s error handling, retention policy, and delivery workflow.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-04T05:11:48.000+00:00","Refry a PDF with Python through a PDF to PostScript to PDF workflow using pdfRest resource IDs.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-refry-a-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Refry a PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-refry-a-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-refry-a-pdf-with-python\u002F\",\n      \"datePublished\": \"2026-09-03T17:04:42.000Z\",\n      \"dateModified\": \"2026-09-03T17:04:42.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Refry a PDF with Python through a PDF to PostScript to PDF workflow using pdfRest resource IDs.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Convert to PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fconvert-to-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fconvert-to-pdf\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"GET \u002Fresource\u002F{id} API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fretrieve-files\"\n        }\n      ],\n      \"keywords\": \"Conversion, Convert to PDF, PDF Refrying, PostScript, Python, PDF to PostScript\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Refry a PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-refry-a-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10132,10133,10134,10135,10136,10137,10138,10139],{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":1386,"name":1387,"slug":1388,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2133,"name":2134,"slug":2135,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1394,"name":1395,"slug":1396,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2189,"name":2190,"slug":2191,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2185,"name":2186,"slug":2187,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-refry-a-pdf-with-python\u002F","How to Refry a PDF with Python | pdfRest",{"id":10144,"uuid":10145,"title":10146,"slug":10147,"html":10148,"comment_id":10144,"feature_image":48,"featured":284,"visibility":1257,"created_at":10149,"updated_at":10006,"published_at":10149,"custom_excerpt":10150,"codeinjection_head":10151,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10152,"primary_tag":10159,"url":10160,"excerpt":10150,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10161,"meta_description":10150,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ea1a42533c9f26b9436735","29e9edfe-a23f-4633-b282-06b520f58851","How to Remove PDF Password in .NET with C#","how-to-remove-pdf-password-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Remove PDF Password with C#?\u003C\u002Fh2>\n\n\u003Cp>\nThe pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F'>Encrypt PDF API Tool\u003C\u002Fa> allows you to securely access and process password-protected PDF documents. In this tutorial, we'll show you how to send an API call using C# to Remove a PDF Password. This is valuable for organizations that receive password-protected documents from external sources  or need to access archived PDFs with passwords.\n\u003C\u002Fp>\n\u003Cp>Here's a common scenario where Removing a PDF Password comes into play:\n\u003Cbr\u002F>\u003Cbr\u002F>\nImagine a legal firm receives password-protected witness testimonies from another law office. These documents are crucial for ongoing litigation but require decryption before lawyers can review and analyze the content.\n\u003C\u002Fp>\n\u003Cp>\nUsing the Encrypt PDF Tool, the firm can securely remove the password, allowing authorized personnel to access the information within the document and proceed with their casework efficiently. This eliminates the need to remember and share the password as files are internally reviewed.\n\u003C\u002Fp>\n\n\u003Ch2>Remove PDF Password with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"decrypted-pdf\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"password\"));\n        multipartContent.Add(byteArrayOption, \"current_open_password\");\n\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>\nThis code is sourced from the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fdecrypted-pdf.cs\">pdfRest API samples repository on GitHub\u003C\u002Fa>.\n\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>\nThe provided C# code snippet demonstrates how to make a multipart\u002Fform-data POST request to the pdfRest API to decrypt a PDF file. Let's break down the code into its key components:\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>\nThis creates an instance of \u003Ccode>HttpClient\u003C\u002Fcode> with the base address set to the pdfRest API endpoint.\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var request = new HttpRequestMessage(HttpMethod.Post, \"decrypted-pdf\"))\n\u003C\u002Fpre>\n\n\u003Cp>\nAn \u003Ccode>HttpRequestMessage\u003C\u002Fcode> is constructed with the POST method targeting the \"decrypted-pdf\" endpoint.\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>\nThe API key is added to the request headers to authenticate the request. Replace \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" with your actual API key.\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n\u003C\u002Fpre>\n\n\u003Cp>\nA byte array of the PDF file is read from the specified path, then added to the multipart content with the form key \"file\" and the file name \"file_name.pdf\". Replace \"\u002Fpath\u002Fto\u002Ffile.pdf\" with the actual file path and \"file_name.pdf\" with the desired name for the file.\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"password\"));\nmultipartContent.Add(byteArrayOption, \"current_open_password\");\n\u003C\u002Fpre>\n\n\u003Cp>\nThe password for decrypting the PDF is encoded in UTF-8 and added to the multipart content with the form key \"current_open_password\". Replace \"password\" with the actual password used to encrypt the PDF.\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\nvar apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>\nThe request is sent asynchronously, and the response is read as a string. The result is then printed to the console.\n\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>\nIn this tutorial, we've learned how to use C# to make an API call to the pdfRest Decrypt PDF API to remove a password from a PDF document. This process is essential for anyone needing to distribute encrypted PDF files to a wider audience. By following the steps outlined, you can integrate PDF decryption into your own applications.\n\u003C\u002Fp>\n\n\u003Cp>\nTo explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information on the API endpoints and their parameters, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\n\u003C\u002Fp>\n\n\u003Cp>\nNote: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fdecrypted-pdf.cs\">pdfRest API samples repository on GitHub\u003C\u002Fa>.\n\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-07T19:49:22.000+00:00","Learn how to remove a PDF password using the pdfRest Decrypt PDF API Tool with C#","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Remove PDF Password in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-03-07T19:49:22.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:44.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to remove a PDF password using the pdfRest Decrypt PDF API Tool with C#\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Encrypt PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fdecrypted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fencrypt-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Decrypt PDF, Password, Security\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Remove PDF Password in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10153,10154,10155,10156,10157,10158],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1973,"name":1974,"slug":1975,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1977,"name":1978,"slug":1979,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-remove-pdf-password-in-net-with-c\u002F","How to Remove PDF Password in .NET with C#, Tutorial | pdfRest",{"id":10163,"uuid":10164,"title":10165,"slug":10166,"html":10167,"comment_id":10163,"feature_image":48,"featured":284,"visibility":1257,"created_at":10168,"updated_at":10087,"published_at":10087,"custom_excerpt":10169,"codeinjection_head":10170,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10171,"primary_tag":10178,"url":10179,"excerpt":10169,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10180,"meta_description":10169,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a9750ce533c9f26b943b78b","d3752bfc-e501-40c1-a26c-728b3947cb2b","How to Remove PDF Password with cURL","how-to-remove-pdf-password-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This tutorial shows you how to remove PDF password with cURL through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\">Encrypt PDF API Tool\u003C\u002Fa>. You'll see how the upload, headers, operation fields, and JSON response fit together in a command that can remove PDF password from a terminal or script.\u003C\u002Fp>\n\n\u003Ch2>Why Remove PDF Password with cURL?\u003C\u002Fh2>\n\n\u003Cp>An authorized workflow may receive protected PDFs together with their open passwords but still need unencrypted input for OCR, extraction, conversion, or archival processing. Decryption creates a new resource that later API calls can use.\u003C\u002Fp>\n\n\u003Cp>For example, a secure intake service can decrypt a supplier document, extract approved data, and remove the temporary decrypted copy immediately afterward. This keeps credential use inside an automated process instead of requiring desktop intervention.\u003C\u002Fp>\n\n\u003Cp>The current password must be known. The API does not discover, recover, or bypass an unknown password, and the generated unencrypted file should be handled according to the sensitivity of its contents.\u003C\u002Fp>\n\n\u003Ch2>cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\nDECRYPTED_OUTPUT=$(curl -X POST \"$API_URL\u002Fdecrypted-pdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\" \\\n  -F \"current_open_password=password\")\n\necho $DECRYPTED_OUTPUT | jq -r '.'\n\n# All files uploaded or generated are automatically deleted based on the\n# File Retention Period as shown on https:\u002F\u002Fpdfrest.com\u002Fpricing.\n# For immediate deletion of files, particularly when sensitive data\n# is involved, an explicit delete call can be made to the API.\n\n# Optional deletion step — OFF by default.\n# Deletes all files in the workflow, including outputs. Save all desired files before enabling this step.\n# Enable by uncommenting the next line to delete sensitive files\n# DELETE_SENSITIVE_FILES=true\nif [ \"$DELETE_SENSITIVE_FILES\" = \"true\" ]; then\n  DECRYPTED_ID=$(jq -r '.outputId' \u003C\u003C\u003C $DECRYPTED_OUTPUT)\n  INPUT_PDF_ID=$(jq -r '.inputId' \u003C\u003C\u003C $DECRYPTED_OUTPUT)\n  curl -X POST \"$API_URL\u002Fdelete\" \\\n    -H \"Accept: application\u002Fjson\" \\\n    -H \"Content-Type: multipart\u002Fform-data\" \\\n    -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n    -F \"ids=$INPUT_PDF_ID, $DECRYPTED_ID\" | jq -r '.'\nfi\u003C\u002Fpre>\n\n\u003Cp>Source for Remove PDF Password: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fdecrypted-pdf.sh\">View the cURL sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Choose the pdfRest service region\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>The Remove PDF Password example routes to the US service through the active URL, while the commented hostname provides the EU option. Keep every Remove PDF Password input and generated resource ID in the same region.\u003C\u002Fp>\n\n\u003Ch3>Build the authenticated multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">DECRYPTED_OUTPUT=$(curl -X POST \"$API_URL\u002Fdecrypted-pdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\" \\\n  -F \"current_open_password=password\")\n\necho $DECRYPTED_OUTPUT | jq -r '.'\n\n# All files uploaded or generated are automatically deleted based on the\n# File Retention Period as shown on https:\u002F\u002Fpdfrest.com\u002Fpricing.\n# For immediate deletion of files, particularly when sensitive data\n# is involved, an explicit delete call can be made to the API.\n\n# Optional deletion step — OFF by default.\n# Deletes all files in the workflow, including outputs. Save all desired files before enabling this step.\n# Enable by uncommenting the next line to delete sensitive files\n# DELETE_SENSITIVE_FILES=true\nif [ \"$DELETE_SENSITIVE_FILES\" = \"true\" ]; then\n  DECRYPTED_ID=$(jq -r '.outputId' \u003C\u003C\u003C $DECRYPTED_OUTPUT)\n  INPUT_PDF_ID=$(jq -r '.inputId' \u003C\u003C\u003C $DECRYPTED_OUTPUT)\n  curl -X POST \"$API_URL\u002Fdelete\" \\\n    -H \"Accept: application\u002Fjson\" \\\n    -H \"Content-Type: multipart\u002Fform-data\" \\\n    -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\u003C\u002Fpre>\n\n\u003Cp>This POST targets the endpoint used by Remove PDF Password. For the Remove PDF Password request, \u003Ccode>Accept\u003C\u002Fcode> asks for JSON, \u003Ccode>Content-Type\u003C\u002Fcode> identifies the multipart payload, and \u003Ccode>Api-Key\u003C\u002Fcode> authenticates the call.\u003C\u002Fp>\n\n\u003Ch3>Upload the input file data\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\u003C\u002Fpre>\n\n\u003Cp>The Remove PDF Password request reads the local source from the path after \u003Ccode>@\u003C\u002Fcode> and sends its bytes in the multipart \u003Ccode>file\u003C\u002Fcode> field. For Remove PDF Password, cURL treats the path as an upload rather than ordinary form text.\u003C\u002Fp>\n\n\u003Ch3>Set the operation-specific fields\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\" \\\n  -F \"current_open_password=password\")\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>current_open_password\u003C\u002Fcode> form field authorizes decryption. The sample captures the JSON response so it can display the result and optionally delete both input and output resources.\u003C\u002Fp>\n\n\u003Ch3>Handle the response and optional cleanup\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">echo $DECRYPTED_OUTPUT | jq -r '.'\n\n# All files uploaded or generated are automatically deleted based on the\n# File Retention Period as shown on https:\u002F\u002Fpdfrest.com\u002Fpricing.\n# For immediate deletion of files, particularly when sensitive data\n# is involved, an explicit delete call can be made to the API.\n\n# Optional deletion step — OFF by default.\n# Deletes all files in the workflow, including outputs. Save all desired files before enabling this step.\n# Enable by uncommenting the next line to delete sensitive files\n# DELETE_SENSITIVE_FILES=true\nif [ \"$DELETE_SENSITIVE_FILES\" = \"true\" ]; then\n  DECRYPTED_ID=$(jq -r '.outputId' \u003C\u003C\u003C $DECRYPTED_OUTPUT)\n  INPUT_PDF_ID=$(jq -r '.inputId' \u003C\u003C\u003C $DECRYPTED_OUTPUT)\n  curl -X POST \"$API_URL\u002Fdelete\" \\\n    -H \"Accept: application\u002Fjson\" \\\n    -H \"Content-Type: multipart\u002Fform-data\" \\\n    -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n    -F \"ids=$INPUT_PDF_ID, $DECRYPTED_ID\" | jq -r '.'\nfi\u003C\u002Fpre>\n\n\u003Cp>The sample prints the response with \u003Ccode>jq\u003C\u002Fcode> and leaves immediate deletion disabled. Enabling the guarded block extracts the input and output IDs and sends them to Delete Files after required results have been saved.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You have now seen how to submit an authorized PDF password with cURL and receive a separate decrypted PDF resource for the next processing step.\u003C\u002Fp>\n\n\u003Cp>Do not place real passwords in source control, logs, command history, or URLs. Limit access to the decrypted output, save only what the workflow requires, and enable the deletion block when sensitive temporary files should be removed immediately.\u003C\u002Fp>\n\n\u003Cp>Continue exploring the Remove PDF Password workflow in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the complete Remove PDF Password request contract, accepted values, defaults, and limitations, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fencrypt-pdf\u002F\">Encrypt PDF API Tool documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: The Remove PDF Password example above uploads a file with multipart form data. For source content already stored in pdfRest, the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fdecrypted-pdf.sh\">Remove PDF Password JSON payload example\u003C\u002Fa> shows the resource-ID request shape.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T22:25:18.000+00:00","Learn how to remove a known PDF open password with cURL for authorized downstream processing and document workflows.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-with-curl\u002F#article\",\n      \"headline\": \"How to Remove PDF Password with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-with-curl\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to remove a known PDF open password with cURL for authorized downstream processing and document workflows.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Delete Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fdelete-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fdelete API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fdelete-files\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Encrypt PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fdecrypted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fencrypt-pdf\"\n        }\n      ],\n      \"keywords\": \"Decrypt PDF, Password, Security, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Remove PDF Password with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10172,10173,10174,10175,10176,10177],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1973,"name":1974,"slug":1975,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1977,"name":1978,"slug":1979,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-remove-pdf-password-with-curl\u002F","How to Remove PDF Password with cURL, Tutorial | pdfRest",{"id":10182,"uuid":10183,"title":10184,"slug":10185,"html":10186,"comment_id":10182,"feature_image":48,"featured":284,"visibility":1257,"created_at":9504,"updated_at":10187,"published_at":9505,"custom_excerpt":10188,"codeinjection_head":10189,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10190,"primary_tag":10197,"url":10198,"excerpt":10188,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10199,"meta_description":10188,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c60533c9f26b943b5a3","bce7f649-0c81-4ef4-8170-1df3bdc45df5","How to Remove PDF Password with Java","how-to-remove-pdf-password-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This tutorial shows you how to remove PDF password from a Java application with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\">Encrypt PDF API Tool\u003C\u002Fa>. The request supplies the authorized current open password to \u003Ccode>\u002Fdecrypted-pdf\u003C\u002Fcode> and receives an unencrypted PDF resource for subsequent authorized downstream processing steps. The walkthrough gives you a practical starting point that you can adapt when you need to remove PDF password in your own document workflow.\u003C\u002Fp>\n\n\u003Ch2>Why Remove PDF Password with Java?\u003C\u002Fh2>\n\n\u003Cp>A controlled ingestion service may receive password-protected PDFs together with authorized credentials. Decrypting them allows subsequent OCR, conversion, extraction, or archival processing.\u003C\u002Fp>\n\n\u003Cp>The Java request supplies the encrypted PDF and \u003Ccode>current_open_password\u003C\u002Fcode> to \u003Ccode>\u002Fdecrypted-pdf\u003C\u002Fcode>. The password must be known; this operation does not recover or bypass unknown credentials.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class DecryptedPDF {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    final boolean DELETE_SENSITIVE_FILES = false; \u002F\u002F toggle deletion (default: false)\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"current_open_password\", \"password\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fdecrypted-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        String respStr = response.body().string();\n        System.out.println(prettyJson(respStr));\n\n        \u002F\u002F All files uploaded or generated are automatically deleted based on the\n        \u002F\u002F File Retention Period as shown on https:\u002F\u002Fpdfrest.com\u002Fpricing.\n        \u002F\u002F For immediate deletion of files, particularly when sensitive data\n        \u002F\u002F is involved, an explicit delete call can be made to the API.\n        \u002F\u002F\n        \u002F\u002F Deletes all files in the workflow, including outputs. Save all desired files before\n        \u002F\u002F enabling this step.\n\n        if (DELETE_SENSITIVE_FILES) {\n          org.json.JSONObject parsed = new org.json.JSONObject(respStr);\n          String outputId = parsed.getString(\"outputId\");\n          String inputId = parsed.getString(\"inputId\");\n          String deleteJson = String.format(\"{ \\\"ids\\\":\\\"%s, %s\\\" }\", inputId, outputId);\n          RequestBody deleteBody =\n              RequestBody.create(deleteJson, MediaType.parse(\"application\u002Fjson\"));\n          Request deleteRequest =\n              new Request.Builder()\n                  .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n                  .url(API_URL + \"\u002Fdelete\")\n                  .post(deleteBody)\n                  .build();\n          try (Response deleteResp =\n              new OkHttpClient()\n                  .newBuilder()\n                  .readTimeout(60, TimeUnit.SECONDS)\n                  .build()\n                  .newCall(deleteRequest)\n                  .execute()) {\n            if (deleteResp.body() != null) {\n              System.out.println(prettyJson(deleteResp.body().string()));\n            }\n          }\n        }\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FDecryptedPDF.java\">Java sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>This dependency set brings together the HTTP client, environment-based API key loading, and JSON utilities used later in the example.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    final boolean DELETE_SENSITIVE_FILES = false; \u002F\u002F toggle deletion (default: false)\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\u003C\u002Fpre>\n\n\u003Cp>The startup code shows where the input comes from and keeps the credential outside the request-building logic.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"current_open_password\", \"password\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fdecrypted-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The Java request supplies the encrypted PDF and \u003Ccode>current_open_password\u003C\u002Fcode> to \u003Ccode>\u002Fdecrypted-pdf\u003C\u002Fcode>. The password must be known; this operation does not recover or bypass unknown credentials. The multipart section sets \u003Ccode>MultipartBody.FORM\u003C\u002Fcode>, allowing OkHttp to generate the matching boundary automatically.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fdecrypted-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\u003C\u002Fpre>\n\n\u003Cp>The request builder reads the credential through dotenv and targets the endpoint shown in the source, with the EU hostname documented beside the default US value.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        String respStr = response.body().string();\n        System.out.println(prettyJson(respStr));\n\n        \u002F\u002F All files uploaded or generated are automatically deleted based on the\n        \u002F\u002F File Retention Period as shown on https:\u002F\u002Fpdfrest.com\u002Fpricing.\n        \u002F\u002F For immediate deletion of files, particularly when sensitive data\n        \u002F\u002F is involved, an explicit delete call can be made to the API.\n        \u002F\u002F\n        \u002F\u002F Deletes all files in the workflow, including outputs. Save all desired files before\n        \u002F\u002F enabling this step.\u003C\u002Fpre>\n\n\u003Cp>The response block checks the server result before treating the body as output and exposes diagnostic JSON when the operation cannot be completed.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You have now seen how to remove PDF password from a Java application. With that foundation, you can use the decrypted output only within authorized workflows, and apply deletion or re-encryption policies appropriate for sensitive material.\u003C\u002Fp>\n\n\u003Cp>When you move beyond the sample, treat the current password as a secret: do not place it in logs, URLs, or persistent source code. Limit access to the decrypted resource, remove temporary copies promptly, and apply any required encryption or permissions policy before further distribution.\u003C\u002Fp>\n\n\u003Cp>You can experiment with the Remove PDF Password operation in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. The \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fencrypt-pdf\u002F\">Encrypt PDF API Tool documentation\u003C\u002Fa> describes the full parameter and response contract.\u003C\u002Fp>\n\n\u003Cp>Note: The Remove PDF Password example above uses multipart form data; to avoid transferring the same input again, see the request shape in the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FDecryptedPDF.java\">JSON payload example\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-02T18:29:21.000+00:00","Remove known PDF open-password encryption with Java.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-with-java\u002F#article\",\n      \"headline\": \"How to Remove PDF Password with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:40.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:40.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Remove known PDF open-password encryption with Java.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Delete Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fdelete-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fdelete API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fdelete-files\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Encrypt PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fdecrypted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fencrypt-pdf\"\n        }\n      ],\n      \"keywords\": \"Decrypt PDF, Java, Password, Security\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Remove PDF Password with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10191,10192,10193,10194,10195,10196],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1973,"name":1974,"slug":1975,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1977,"name":1978,"slug":1979,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-remove-pdf-password-with-java\u002F","Remove PDF Password with Java | pdfRest",{"id":10201,"uuid":10202,"title":10203,"slug":10204,"html":10205,"comment_id":10201,"feature_image":48,"featured":284,"visibility":1257,"created_at":10206,"updated_at":10087,"published_at":10087,"custom_excerpt":10207,"codeinjection_head":10208,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10209,"primary_tag":10216,"url":10217,"excerpt":10207,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10218,"meta_description":10207,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a9764e2533c9f26b943b806","c75b9303-4e4a-4e82-9187-3cf9807b72ed","How to Remove PDF Password with JavaScript in NodeJS","how-to-remove-pdf-password-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This step-by-step guide demonstrates how to remove a known open password from a PDF from a NodeJS service through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\">Encrypt PDF API Tool\u003C\u002Fa>. Along the way, we'll distinguish the JavaScript in NodeJS syntax from the Remove PDF Password API contract and show how its returned data supports the next step.\u003C\u002Fp>\n\n\u003Ch2>Why Remove PDF Password with JavaScript in NodeJS?\u003C\u002Fh2>\n\n\u003Cp>Authorized document automation sometimes receives encrypted PDFs that must be normalized before OCR, conversion, or extraction. Supplying the known open password creates a usable decrypted copy without modifying the protected source.\u003C\u002Fp>\n\n\u003Cp>A NodeJS records service could accept password-protected reports from a partner, decrypt each report inside a controlled job, and then pass the output ID to indexing. The password remains an input to that job rather than becoming part of the PDF itself.\u003C\u002Fp>\n\n\u003Cp>The endpoint only works when the current credential is valid. The sample also demonstrates optional resource deletion, which is important because both the encrypted upload and the unencrypted result can contain sensitive information.\u003C\u002Fp>\n\n\u003Ch2>JavaScript in NodeJS Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to decrypt a password-protected PDF by removing the password and requires that the current password be provided.\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n\n\n\u002F\u002F Toggle deletion of sensitive files (default: false)\nconst DELETE_SENSITIVE_FILES = false;\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('current_open_password', 'current_example_pw');\ndata.append('output', 'pdfrest_decrypted_pdf');\n\n\u002F\u002F Define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F Set maximum length of the request body\n  url: apiUrl + '\u002Fdecrypted-pdf',\n  headers: {\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F Set headers with form data headers\n  },\n  data : data \u002F\u002F Add headers to the request\n};\n\n\u002F\u002F Send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n\n  \u002F\u002F All files uploaded or generated are automatically deleted based on the\n  \u002F\u002F File Retention Period as shown on https:\u002F\u002Fpdfrest.com\u002Fpricing.\n  \u002F\u002F For immediate deletion of files, particularly when sensitive data\n  \u002F\u002F is involved, an explicit delete call can be made to the API.\n  \u002F\u002F\n  \u002F\u002F Deletes all files in the workflow, including outputs. Save all desired files before enabling this step.\n\n  var body = response.data;\n  var input_id = body.inputId;\n  var result_id = body.outputId;\n    var delete_config = {\n      method: 'post',\n      maxBodyLength: Infinity,\n      url: apiUrl + '\u002Fdelete',\n      headers: {\n        'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n        'Content-Type': 'application\u002Fjson'\n      },\n      data: { ids: input_id + ', ' + result_id }\n    };\n\n  if (DELETE_SENSITIVE_FILES) {\n    axios(delete_config)\n      .then(function (delete_response) { console.log(JSON.stringify(delete_response.data)); })\n      .catch(function (error) { console.log(error); });\n  }\n\n})\n  .catch(function (error) {\n    console.log(error);\n  });\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample\u003C\u002Fpre>\n\n\u003Cp>Source for Remove PDF Password: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fdecrypted-pdf.js\">View the JavaScript in NodeJS sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the NodeJS request and file modules\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\u003C\u002Fpre>\n\n\u003Cp>Axios sends the HTTP calls for Remove PDF Password, \u003Ccode>FormData\u003C\u002Fcode> constructs multipart bodies when needed, and Node's \u003Ccode>fs\u003C\u002Fcode> module opens local files as streams. Together, these packages provide the transport and file handling required by the JavaScript Remove PDF Password sample.\u003C\u002Fp>\n\n\u003Ch3>Select the pdfRest service region\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>apiUrl\u003C\u002Fcode> centralizes regional routing for Remove PDF Password. The NodeJS Remove PDF Password flow can switch to the documented EU hostname without changing the endpoint paths that follow.\u003C\u002Fp>\n\n\u003Ch3>Add the PDF, current password, and output name\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('current_open_password', 'current_example_pw');\ndata.append('output', 'pdfrest_decrypted_pdf');\n\n\u002F\u002F Define configuration options for axios request\u003C\u002Fpre>\n\n\u003Cp>This block constructs the operation-specific input for Remove PDF Password. Its file parts carry binary content, while the named Remove PDF Password fields describe pdfRest behavior rather than syntax supplied by JavaScript in NodeJS.\u003C\u002Fp>\n\n\u003Ch3>Configure and submit the decrypt request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F Set maximum length of the request body\n  url: apiUrl + '\u002Fdecrypted-pdf',\n  headers: {\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F Set headers with form data headers\n  },\n  data : data \u002F\u002F Add headers to the request\n};\n\n\u002F\u002F Send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n\n  \u002F\u002F All files uploaded or generated are automatically deleted based on the\n  \u002F\u002F File Retention Period as shown on https:\u002F\u002Fpdfrest.com\u002Fpricing.\n  \u002F\u002F For immediate deletion of files, particularly when sensitive data\u003C\u002Fpre>\n\n\u003Cp>The JavaScript in NodeJS request joins the Remove PDF Password endpoint, authentication header, and prepared body. For this Remove PDF Password call, the multipart metadata generated by JavaScript in NodeJS must remain paired with the body so pdfRest can separate files from options.\u003C\u002Fp>\n\n\u003Ch3>Optionally delete sensitive inputs and outputs\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">if (DELETE_SENSITIVE_FILES) {\n    axios(delete_config)\n      .then(function (delete_response) { console.log(JSON.stringify(delete_response.data)); })\n      .catch(function (error) { console.log(error); });\n  }\n\n})\n  .catch(function (error) {\n    console.log(error);\n  });\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample\u003C\u002Fpre>\n\n\u003Cp>The optional JavaScript in NodeJS cleanup path collects the sensitive input and output IDs and sends them to Delete Files. Enable this Remove PDF Password cleanup only after the JavaScript in NodeJS application has preserved every result it needs.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This walkthrough gives you an authorized JavaScript in NodeJS path from a password-protected source to a decrypted PDF resource that downstream tools can use.\u003C\u002Fp>\n\n\u003Cp>Provide the password through a secret-management path and avoid printing the multipart body or request configuration. Save necessary output before enabling deletion, since the cleanup call intentionally removes the generated file as well as the source.\u003C\u002Fp>\n\n\u003Cp>Try the Remove PDF Password workflow with a representative file in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, then adapt the request in JavaScript in NodeJS. The \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fencrypt-pdf\u002F\">Encrypt PDF API Tool documentation\u003C\u002Fa> provides the complete JavaScript in NodeJS context for Remove PDF Password values, defaults, and limitations.\u003C\u002Fp>\n\n\u003Cp>Note: This JavaScript in NodeJS Remove PDF Password tutorial uses a multipart file upload. For Remove PDF Password content already stored in pdfRest, the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fdecrypted-pdf.js\">JavaScript in NodeJS JSON payload example\u003C\u002Fa> supplies a managed resource ID instead of uploading the file again.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T23:50:58.000+00:00","Decrypt a PDF with its known open password from JavaScript in NodeJS and optionally delete sensitive resources afterward.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Remove PDF Password with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Decrypt a PDF with its known open password from JavaScript in NodeJS and optionally delete sensitive resources afterward.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Delete Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fdelete-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fdelete API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fdelete-files\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Encrypt PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fdecrypted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fencrypt-pdf\"\n        }\n      ],\n      \"keywords\": \"Decrypt PDF, JavaScript, Password, Security\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Remove PDF Password with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10210,10211,10212,10213,10214,10215],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1973,"name":1974,"slug":1975,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1977,"name":1978,"slug":1979,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-remove-pdf-password-with-javascript-in-nodejs\u002F","Remove PDF Password with JavaScript in NodeJS | pdfRest",{"id":10220,"uuid":10221,"title":10222,"slug":10223,"html":10224,"comment_id":10220,"feature_image":48,"featured":284,"visibility":1257,"created_at":9686,"updated_at":10087,"published_at":10087,"custom_excerpt":10225,"codeinjection_head":10226,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10227,"primary_tag":10234,"url":10235,"excerpt":10225,"reading_time":369,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10236,"meta_description":10225,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a9764e1533c9f26b943b7fb","aad84165-dd05-4345-ba96-b46ee1d24838","How to Remove PDF Password with PHP","how-to-remove-pdf-password-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Cp>Follow this PHP walkthrough to remove a known open password from a PDF with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\">Encrypt PDF API Tool\u003C\u002Fa>. You'll see the complete Remove PDF Password sample first, then examine the transport code and API fields that matter when this PHP pattern moves into an application.\u003C\u002Fp>\n\n\u003Ch2>Why Remove PDF Password with PHP?\u003C\u002Fh2>\n\n\u003Cp>A password-protected PDF cannot participate in many downstream operations until an authorized caller supplies the current open password. Decrypt PDF creates a separate unencrypted resource that other tools can process.\u003C\u002Fp>\n\n\u003Cp>A PHP customer portal may receive protected statements together with credentials supplied through a secure channel. After decryption, the service can extract text or convert the document without asking an operator to open and resave it manually.\u003C\u002Fp>\n\n\u003Cp>This operation requires the correct password and does not discover, recover, or bypass unknown credentials. The uploaded encrypted source remains separate from the generated decrypted PDF, and both follow the service retention policy.\u003C\u002Fp>\n\n\u003Ch2>PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n\u002F\u002F Toggle deletion of sensitive files (default: false)\n$DELETE_SENSITIVE_FILES = false;\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile', \u002F\u002F Set the filename for the file to be processed, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => '\u003CContent-type header>' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'current_open_password', \u002F\u002F Specify the field name for the current open password.\n      'contents' => 'current_example_pw' \u002F\u002F Set the value for the current open password (in this case, 'current_example_pw').\n    ],\n    [\n      'name' => 'output', \u002F\u002F Specify the field name for the output option.\n      'contents' => 'pdfrest_decrypted_pdf' \u002F\u002F Set the value for the output option (in this case, 'pdfrest_decrypted_pdf').\n    ]\n  ]\n];\n\n$request = new Request('POST', $apiUrl.'\u002Fdecrypted-pdf', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\n$body = (string) $res->getBody();\necho $body; \u002F\u002F Output the response body\n\n\u002F\u002F All files uploaded or generated are automatically deleted based on the\n\u002F\u002F File Retention Period as shown on https:\u002F\u002Fpdfrest.com\u002Fpricing.\n\u002F\u002F For immediate deletion of files, particularly when sensitive data\n\u002F\u002F is involved, an explicit delete call can be made to the API.\n\u002F\u002F\n\u002F\u002F Deletes all files in the workflow, including outputs. Save all desired files before enabling this step.\n\nif ($DELETE_SENSITIVE_FILES) {\n  $delete_client = new Client(['http_errors' => false]);\n  $delete_headers = [\n    'api-key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    'Content-Type' => 'application\u002Fjson'\n  ];\n  $json = json_decode($body, true);\n  $input_id = isset($json['inputId']) ? $json['inputId'] : '';\n  $output_id = isset($json['outputId']) ? $json['outputId'] : '';\n  $delete_body = json_encode([ 'ids' => $input_id . ', ' . $output_id ]);\n  $delete_request = new Request('POST', $apiUrl.'\u002Fdelete', $delete_headers, $delete_body);\n  $delete_res = $delete_client->sendAsync($delete_request)->wait();\n  echo $delete_res->getBody() . PHP_EOL;\n}\u003C\u002Fpre>\n\n\u003Cp>Source for Remove PDF Password: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fdecrypted-pdf.php\">View the PHP sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load Guzzle and its stream helpers\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\u003C\u002Fpre>\n\n\u003Cp>Guzzle supplies the HTTP client and PSR-7 request objects used throughout the Remove PDF Password example. For this PHP Remove PDF Password flow, \u003Ccode>Utils::tryFopen\u003C\u002Fcode> creates readable multipart streams without loading every uploaded byte into one string.\u003C\u002Fp>\n\n\u003Ch3>Select the pdfRest service region\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n\u002F\u002F Toggle deletion of sensitive files (default: false)\n$DELETE_SENSITIVE_FILES = false;\u003C\u002Fpre>\n\n\u003Cp>The active \u003Ccode>$apiUrl\u003C\u002Fcode> selects the US service for Remove PDF Password; the commented assignment shows the EU alternative. Keep the PHP uploads, request IDs, and generated resources for Remove PDF Password on that same regional host.\u003C\u002Fp>\n\n\u003Ch3>Build the password-removal multipart body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile', \u002F\u002F Set the filename for the file to be processed, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => '\u003CContent-type header>' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'current_open_password', \u002F\u002F Specify the field name for the current open password.\n      'contents' => 'current_example_pw' \u002F\u002F Set the value for the current open password (in this case, 'current_example_pw').\n    ],\n    [\n      'name' => 'output', \u002F\u002F Specify the field name for the output option.\n      'contents' => 'pdfrest_decrypted_pdf' \u002F\u002F Set the value for the output option (in this case, 'pdfrest_decrypted_pdf').\n    ]\n  ]\n];\n\n$request = new Request('POST', $apiUrl.'\u002Fdecrypted-pdf', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\n$body = (string) $res->getBody();\necho $body; \u002F\u002F Output the response body\n\n\u002F\u002F All files uploaded or generated are automatically deleted based on the\n\u002F\u002F File Retention Period as shown on https:\u002F\u002Fpdfrest.com\u002Fpricing.\u003C\u002Fpre>\n\n\u003Cp>This block constructs the operation-specific input for Remove PDF Password. Its file parts carry binary content, while the named Remove PDF Password fields describe pdfRest behavior rather than syntax supplied by PHP.\u003C\u002Fp>\n\n\u003Ch3>Send the decrypt request and read its JSON\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">$request = new Request('POST', $apiUrl.'\u002Fdecrypted-pdf', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\n$body = (string) $res->getBody();\necho $body; \u002F\u002F Output the response body\n\n\u002F\u002F All files uploaded or generated are automatically deleted based on the\n\u002F\u002F File Retention Period as shown on https:\u002F\u002Fpdfrest.com\u002Fpricing.\u003C\u002Fpre>\n\n\u003Cp>The PHP request joins the Remove PDF Password endpoint, authentication header, and prepared body. For this Remove PDF Password call, the multipart metadata generated by PHP must remain paired with the body so pdfRest can separate files from options.\u003C\u002Fp>\n\n\u003Ch3>Optionally remove sensitive resources\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">if ($DELETE_SENSITIVE_FILES) {\n  $delete_client = new Client(['http_errors' => false]);\n  $delete_headers = [\n    'api-key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    'Content-Type' => 'application\u002Fjson'\n  ];\n  $json = json_decode($body, true);\n  $input_id = isset($json['inputId']) ? $json['inputId'] : '';\n  $output_id = isset($json['outputId']) ? $json['outputId'] : '';\n  $delete_body = json_encode([ 'ids' => $input_id . ', ' . $output_id ]);\n  $delete_request = new Request('POST', $apiUrl.'\u002Fdelete', $delete_headers, $delete_body);\n  $delete_res = $delete_client->sendAsync($delete_request)->wait();\n  echo $delete_res->getBody() . PHP_EOL;\n}\u003C\u002Fpre>\n\n\u003Cp>The optional PHP cleanup path collects the sensitive input and output IDs and sends them to Delete Files. Enable this Remove PDF Password cleanup only after the PHP application has preserved every result it needs.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This walkthrough gives you an authorized PHP path from a password-protected source to a decrypted PDF resource that downstream tools can use.\u003C\u002Fp>\n\n\u003Cp>Keep passwords out of logs and source control, download any required result before deletion, and enable explicit cleanup when decrypted content is sensitive. The sample includes an optional delete path for removing both input and output resources promptly.\u003C\u002Fp>\n\n\u003Cp>Try the Remove PDF Password workflow with a representative file in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, then adapt the request in PHP. The \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fencrypt-pdf\u002F\">Encrypt PDF API Tool documentation\u003C\u002Fa> provides the complete PHP context for Remove PDF Password values, defaults, and limitations.\u003C\u002Fp>\n\n\u003Cp>Note: This PHP Remove PDF Password tutorial uses a multipart file upload. For Remove PDF Password content already stored in pdfRest, the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fdecrypted-pdf.php\">PHP JSON payload example\u003C\u002Fa> supplies a managed resource ID instead of uploading the file again.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Remove a known PDF open password with PHP so an authorized workflow can process the decrypted output.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-with-php\u002F#article\",\n      \"headline\": \"How to Remove PDF Password with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-with-php\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Remove a known PDF open password with PHP so an authorized workflow can process the decrypted output.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Delete Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fdelete-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fdelete API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fdelete-files\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Encrypt PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fdecrypted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fencrypt-pdf\"\n        }\n      ],\n      \"keywords\": \"Decrypt PDF, PHP, Password, Security\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Remove PDF Password with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10228,10229,10230,10231,10232,10233],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1973,"name":1974,"slug":1975,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1977,"name":1978,"slug":1979,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-remove-pdf-password-with-php\u002F","Remove PDF Password with PHP | pdfRest",{"id":10238,"uuid":10239,"title":10240,"slug":10241,"html":10242,"comment_id":10238,"feature_image":48,"featured":284,"visibility":1257,"created_at":10206,"updated_at":10243,"published_at":10243,"custom_excerpt":10244,"codeinjection_head":10245,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10246,"primary_tag":10253,"url":10254,"excerpt":10244,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10255,"meta_description":10244,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a9764e2533c9f26b943b811","e3eae91b-9a2f-4ef6-9e09-dffc293be851","How to Remove PDF Password with Python","how-to-remove-pdf-password-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Cp>Learn how to remove a known open password from a PDF using Python and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\">Encrypt PDF API Tool\u003C\u002Fa>. This Remove PDF Password tutorial keeps the official sample intact and breaks down authentication, payload construction, endpoint behavior, and result handling for Python.\u003C\u002Fp>\n\n\u003Ch2>Why Remove PDF Password with Python?\u003C\u002Fh2>\n\n\u003Cp>Encrypted documents often need authorized preprocessing before they enter text extraction, archival, or analysis pipelines. Decrypt PDF accepts the existing open password and returns a new PDF resource without that encryption.\u003C\u002Fp>\n\n\u003Cp>A Python ingestion process handling monthly financial reports can decrypt each approved input, continue with classification, and immediately remove temporary resources after saving the required result. That keeps credential handling inside one controlled stage.\u003C\u002Fp>\n\n\u003Cp>Knowing the password is a prerequisite; the API does not crack or infer it. Callers should also distinguish removal of encryption from removal of other document restrictions, which is a separate operation and policy decision.\u003C\u002Fp>\n\n\u003Ch2>Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# Toggle deletion of sensitive files (default: False)\nDELETE_SENSITIVE_FILES = False\n\ndecrypted_pdf_endpoint_url = api_url+'\u002Fdecrypted-pdf'\n\n# The \u002Fdecrypted-pdf endpoint can take a single PDF file or id as input.\n# This sample demonstrates decryption of a PDF with the password 'password'.\nmp_encoder_decryptedPdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_decryptedPdf_out',\n        'current_open_password': 'password',\n    }\n)\n\n# Let's set the headers that the decrypted-pdf endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_decryptedPdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to decrypted-pdf endpoint...\")\nresponse = requests.post(decrypted_pdf_endpoint_url, data=mp_encoder_decryptedPdf, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\n# All files uploaded or generated are automatically deleted based on the\n# File Retention Period as shown on https:\u002F\u002Fpdfrest.com\u002Fpricing.\n# For immediate deletion of files, particularly when sensitive data\n# is involved, an explicit delete call can be made to the API.\n#\n# Deletes all files in the workflow, including outputs. Save all desired files before enabling this step.\n\nif DELETE_SENSITIVE_FILES and response.ok:\n    result_id = response_json['outputId']\n    delete_data = { \"ids\": f\"{response_json['inputId']}, {result_id}\" }\n    delete_response = requests.post(url=api_url+'\u002Fdelete',\n                        data=json.dumps(delete_data),\n                        headers={'Content-Type': 'application\u002Fjson', \"API-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"})\n    print(\"Delete response status code: \" + str(delete_response.status_code))\n    print(json.dumps(delete_response.json(), indent = 2))\u003C\u002Fpre>\n\n\u003Cp>Source for Remove PDF Password: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fdecrypted-pdf.py\">View the Python sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Import the HTTP and multipart helpers\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>requests\u003C\u002Fcode> handles the HTTP exchange for Remove PDF Password, while \u003Ccode>MultipartEncoder\u003C\u002Fcode> constructs form-data bodies with a boundary that the request header can reuse. The remaining Python modules support the response or timing behavior used specifically by Remove PDF Password.\u003C\u002Fp>\n\n\u003Ch3>Select the pdfRest service region\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\"># By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# Toggle deletion of sensitive files (default: False)\nDELETE_SENSITIVE_FILES = False\u003C\u002Fpre>\n\n\u003Cp>The Python configuration keeps the pdfRest hostname separate from each Remove PDF Password route. Using one regional base URL throughout this Python Remove PDF Password job keeps its returned identifiers available to later requests.\u003C\u002Fp>\n\n\u003Ch3>Encode the file and known password\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\">mp_encoder_decryptedPdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_decryptedPdf_out',\n        'current_open_password': 'password',\n    }\n)\n\n# Let's set the headers that the decrypted-pdf endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_decryptedPdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\u003C\u002Fpre>\n\n\u003Cp>This block constructs the operation-specific input for Remove PDF Password. Its file parts carry binary content, while the named Remove PDF Password fields describe pdfRest behavior rather than syntax supplied by Python.\u003C\u002Fp>\n\n\u003Ch3>Send the authenticated multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_decryptedPdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to decrypted-pdf endpoint...\")\nresponse = requests.post(decrypted_pdf_endpoint_url, data=mp_encoder_decryptedPdf, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\u003C\u002Fpre>\n\n\u003Cp>The Python request joins the Remove PDF Password endpoint, authentication header, and prepared body. For this Remove PDF Password call, the multipart metadata generated by Python must remain paired with the body so pdfRest can separate files from options.\u003C\u002Fp>\n\n\u003Ch3>Optionally delete both sensitive resources\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\">if DELETE_SENSITIVE_FILES and response.ok:\n    result_id = response_json['outputId']\n    delete_data = { \"ids\": f\"{response_json['inputId']}, {result_id}\" }\n    delete_response = requests.post(url=api_url+'\u002Fdelete',\n                        data=json.dumps(delete_data),\n                        headers={'Content-Type': 'application\u002Fjson', \"API-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"})\n    print(\"Delete response status code: \" + str(delete_response.status_code))\n    print(json.dumps(delete_response.json(), indent = 2))\u003C\u002Fpre>\n\n\u003Cp>The optional Python cleanup path collects the sensitive input and output IDs and sends them to Delete Files. Enable this Remove PDF Password cleanup only after the Python application has preserved every result it needs.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This walkthrough gives you an authorized Python path from a password-protected source to a decrypted PDF resource that downstream tools can use.\u003C\u002Fp>\n\n\u003Cp>Source the password from protected runtime configuration, not the script or diagnostic output. Review the optional deletion block before enabling it because it removes both IDs and assumes the application has already preserved anything it needs.\u003C\u002Fp>\n\n\u003Cp>Try the Remove PDF Password workflow with a representative file in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, then adapt the request in Python. The \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fencrypt-pdf\u002F\">Encrypt PDF API Tool documentation\u003C\u002Fa> provides the complete Python context for Remove PDF Password values, defaults, and limitations.\u003C\u002Fp>\n\n\u003Cp>Note: This Python Remove PDF Password tutorial uses a multipart file upload. For Remove PDF Password content already stored in pdfRest, the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fdecrypted-pdf.py\">Python JSON payload example\u003C\u002Fa> supplies a managed resource ID instead of uploading the file again.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-03T17:04:43.000+00:00","Use Python to remove a known PDF open password and manage the sensitive input and decrypted output resources.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-with-python\u002F#article\",\n      \"headline\": \"How to Remove PDF Password with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-with-python\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Use Python to remove a known PDF open password and manage the sensitive input and decrypted output resources.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Delete Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fdelete-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fdelete API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fdelete-files\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Encrypt PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fencrypt-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fdecrypted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fencrypt-pdf\"\n        }\n      ],\n      \"keywords\": \"Decrypt PDF, Password, Python, Security\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Remove PDF Password with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-password-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10247,10248,10249,10250,10251,10252],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1973,"name":1974,"slug":1975,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1977,"name":1978,"slug":1979,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-remove-pdf-password-with-python\u002F","Remove PDF Password with Python | pdfRest",{"id":10257,"uuid":10258,"title":10259,"slug":10260,"html":10261,"comment_id":10257,"feature_image":48,"featured":284,"visibility":1257,"created_at":10262,"updated_at":10187,"published_at":10262,"custom_excerpt":10263,"codeinjection_head":10264,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10265,"primary_tag":10270,"url":10271,"excerpt":10263,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10272,"meta_description":10263,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65eb8486533c9f26b94368d0","09638e08-2edb-499e-ab97-7ec5a7258746","How to Remove PDF Restrictions in .NET with C#","how-to-remove-pdf-restrictions-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Remove PDF Restrictions with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frestrict-pdf\u002F'>Restrict PDF API Tool\u003C\u002Fa> is a robust resource for developers aiming to programmatically remove restrictions from PDF documents. This API facilitates a variety of security adjustments, including the removal of password protection and permission limitations, which are essential for maximizing how a PDF is utilized, edited, or shared. This tutorial will guide you through the process of lifting restrictions by sending an API call to the \u002Funrestricted-pdf endpoint of the pdfRest API using C#.\u003C\u002Fp>\n\n\u003Cp>In practical scenarios, the need to unlock a PDF document arises frequently. For example, a company might require to lift access limitations from their financial reports to share with a broader audience, or an author may decide to remove copy or print protection from their work. With the pdfRest API, users can programmatically eliminate these restrictions, thus enhancing flexibility and accessibility of their digital assets.\u003C\u002Fp>\n\n\u003Ch2>Remove PDF Restrictions with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"unrestricted-pdf\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"password\"));\n        multipartContent.Add(byteArrayOption, \"current_permissions_password\");\n\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Code source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Funrestricted-pdf.cs\">pdf-rest-api-samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This code snippet illustrates how to execute a multipart API call to the pdfRest API's \u002Funrestricted-pdf endpoint to remove restrictions from a PDF using C#. Below are the breakdowns of the key components in this code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>This line initializes a new instance of the HttpClient class and sets the base address to the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var request = new HttpRequestMessage(HttpMethod.Post, \"unrestricted-pdf\"))\n\u003C\u002Fpre>\n\n\u003Cp>Here, we create a new HttpRequestMessage with the HTTP method set to POST, targeting the \"unrestricted-pdf\" endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>This line adds your API key to the request headers, which is required for authentication with the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name\");\n\u003C\u002Fpre>\n\n\u003Cp>These lines read the PDF file into a byte array, create a ByteArrayContent from it, and add it to the multipart form data content with the key \"file\".\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"password\"));\nmultipartContent.Add(byteArrayOption, \"current_permissions_password\");\n\u003C\u002Fpre>\n\n\u003Cp>This snippet creates a ByteArrayContent containing the password for the current permissions (if the PDF is already password protected) and adds it to the multipart content.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\n\u003C\u002Fpre>\n\n\u003Cp>This line sends the assembled request to the pdfRest API and awaits the response.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>After receiving the response, this line reads the content of the response asynchronously and stores it in the variable \"apiResult\".\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>Following the tutorial above, you've learned how to make a multipart API call to the pdfRest API to lift restrictions from PDF documents using C#. This capability enables you to enhance the accessibility and usability of your digital content. With this foundation, you're encouraged to explore other features provided by the pdfRest API Tools in the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">pdfRest API Lab\u003C\u002Fa>. For comprehensive details on the API, consider reviewing the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Funrestricted-pdf.cs\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-08T21:35:02.000+00:00","Learn how to remove restrictions from PDFs to enable printing, editing content and form fields, copying text, and more with the Restrict PDF API Tool.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Remove PDF Restrictions in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-03-08T21:35:02.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:41.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to remove restrictions from PDFs to enable printing, editing content and form fields, copying text, and more with the Restrict PDF API Tool.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Restrict PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frestrict-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Funrestricted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Frestrict-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Restrict PDF\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Remove PDF Restrictions in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10266,10267,10268,10269],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1981,"name":1982,"slug":1983,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-remove-pdf-restrictions-in-net-with-c\u002F","How to Remove PDF Restrictions in .NET with C#, Tutorial | pdfRest",{"id":10274,"uuid":10275,"title":10276,"slug":10277,"html":10278,"comment_id":10274,"feature_image":48,"featured":284,"visibility":1257,"created_at":10279,"updated_at":10280,"published_at":10279,"custom_excerpt":10263,"codeinjection_head":10281,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10282,"primary_tag":10287,"url":10288,"excerpt":10263,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10289,"meta_description":10290,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65eb87c8533c9f26b94368e2","1f34da5b-7480-4f6f-819b-00620e36622f","How to Remove PDF Restrictions with cURL","how-to-remove-pdf-restrictions-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Remove PDF Restrictions with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frestrict-pdf\u002F'>Restrict PDF API Tool\u003C\u002Fa> offers a convenient way to remove restrictions on your PDF documents programmatically. By using this API, you can automate the process of securing your PDFs against unauthorized access or modification. This tutorial will show you how to send an API call to the Restrict PDF \u002Funrestricted-pdf endpoint using cURL, the standard command-line tool for making network requests.\u003C\u002Fp>\n\n\u003Cp>Imagine you have a collection of confidential reports in PDF format that you need to share with a select group of people. You want to prevent anyone else from editing, copying, or printing these documents. When you need to edit them, the \u002Funrestricted-pdf endpoint allows you to remove these restrictions quickly and easily. By using cURL, you can integrate this functionality into your existing workflow, such as a script that processes these reports automatically.\u003C\u002Fp>\n\n\u003Ch2>Removing PDF Restrictions with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Funrestricted-pdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\" \\\n  -F \"current_permissions_password=password\"\n\u003C\u002Fpre>\n\n\u003Cp>Reference to the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Funrestricted-pdf.sh\">pdfRest API samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This section explains each part of the cURL command used to call the \u002Funrestricted-pdf API endpoint:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Funrestricted-pdf\"\u003C\u002Fpre>\n\n\u003Cp>This initiates a cURL command to make a POST request to the Restrict PDF endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\u003C\u002Fpre>\n\n\u003Cp>This header tells the server that the client expects a response in JSON format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the request body will be sent as multipart\u002Fform-data, which is necessary for uploading files.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\u003C\u002Fpre>\n\n\u003Cp>This header includes your personal API key for authentication with the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\u003C\u002Fpre>\n\n\u003Cp>This form field uploads the PDF file from the specified path to be restricted.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\u003C\u002Fpre>\n\n\u003Cp>This form field sets the base name for the output file that will be created after the restrictions are removed.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"current_permissions_password=password\"\u003C\u002Fpre>\n\n\u003Cp>This form field sets the password that will be required to lift the restrictions on the restricted PDF file.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you've learned how to use cURL to make an API call to one of the Restrict PDF endpoints of pdfRest. This allows you to programmatically remove restrictions on your PDF documents, ensuring they are protected against unauthorized use. By integrating this into your workflow, you can automate the process of securing your documents.\u003C\u002Fp>\n\n\u003Cp>To explore more possibilities and to demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For a comprehensive understanding of the API's capabilities, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Funrestricted-pdf.sh\">pdfRest API samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-08T21:48:56.000+00:00","2026-09-02T18:29:22.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-curl\u002F#article\",\n      \"headline\": \"How to Remove PDF Restrictions with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-curl\u002F\",\n      \"datePublished\": \"2024-03-08T21:48:56.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:41.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to remove restrictions from PDFs to enable printing, editing content and form fields, copying text, and more with the Restrict PDF API Tool.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Restrict PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frestrict-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Funrestricted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Frestrict-pdf\"\n        }\n      ],\n      \"keywords\": \"Restrict PDF, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Remove PDF Restrictions with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10283,10284,10285,10286],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1981,"name":1982,"slug":1983,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-remove-pdf-restrictions-with-curl\u002F","How to Remove PDF Restrictions with cURL, Tutorial | pdfRest","Remove print, copy, and edit restrictions from PDFs via cURL. Explore pdfRest's Restrict PDF API Tool for seamless access.",{"id":10292,"uuid":10293,"title":10294,"slug":10295,"html":10296,"comment_id":10292,"feature_image":48,"featured":284,"visibility":1257,"created_at":10297,"updated_at":10280,"published_at":10297,"custom_excerpt":10263,"codeinjection_head":10298,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10299,"primary_tag":10304,"url":10305,"excerpt":10263,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10306,"meta_description":10307,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65eb9059533c9f26b9436962","6f24db50-c0c2-40f9-8bb1-9d3c4c3ac91e","How to Remove PDF Restrictions with Java","how-to-remove-pdf-restrictions-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Remove PDF Restrictions with Java?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frestrict-pdf\u002F'>Restrict PDF API Tool\u003C\u002Fa> is a powerful resource for developers who need to programmatically add and remove restrictions on the permissions of PDF files. This tool allows you to enforce restrictions on actions such as printing, copying, and editing, ensuring that your PDFs are used only as intended. This tutorial will guide you through the process of sending an API call to the \u002Funrestricted-pdf endpoint using Java, demonstrating how to integrate this functionality into your Java applications.\u003C\u002Fp>\n\n\u003Cp>In a real-world scenario, a user might need to distribute a PDF document with sensitive information and would want to prevent unauthorized copying or printing. For example, a company might send proprietary reports to its employees and require that these documents remain confidential and unaltered. Using the \u002Funrestricted-pdf endpoint, the company can programmatically remove these restrictions to the PDFs during the editing process, ensuring that these permissions to the PDF are accessible to only those with the proper rights.\u003C\u002Fp>\n\n\u003Ch2>Removing PDF Restrictions with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class UnrestrictedPDF {\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"current_permissions_password\", \"password\")\n            .addFormDataPart(\"output\", \"pdfrest_unrestricted\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Funrestricted-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source code reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FUnrestrictedPDF.java\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This section will break down the key components of the Java code used to call the Restrict PDF API:\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\u003C\u002Fpre>\n\n\u003Cp>This line initializes the Dotenv library, which is used to load the API key from an environment variable or a .env file. It ensures the program can still run even if the environment variable is malformed or missing.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n    RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n\u003C\u002Fpre>\n\n\u003Cp>Here, we create a request body for the input file with the MIME type 'application\u002Fpdf'. This tells the server that the file being uploaded is a PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">RequestBody requestBody =\n    new MultipartBody.Builder()\n        .setType(MultipartBody.FORM)\n        .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n        .addFormDataPart(\"current_permissions_password\", \"password\")\n        .addFormDataPart(\"output\", \"pdfrest_unrestricted\")\n        .build();\n\u003C\u002Fpre>\n\n\u003Cp>This snippet constructs the multipart request body. It includes the PDF file, the password for current permissions (if any), and the desired output filename.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Request request =\n    new Request.Builder()\n        .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n        .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Funrestricted-pdf\")\n        .post(requestBody)\n        .build();\n\u003C\u002Fpre>\n\n\u003Cp>The request is built with the API key in the header, the endpoint URL, and the previously constructed request body. The API key is essential for authentication and authorization.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the above steps, you have learned how to use Java to call the pdfRest Restrict PDF API to remove restrictions from a PDF file. This can be integrated into larger Java applications where PDF security management is required. You are encouraged to explore and demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for further information on other API endpoints and capabilities.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads for the same API are available at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FUnrestrictedPDF.java\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-08T22:25:29.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-java\u002F#article\",\n      \"headline\": \"How to Remove PDF Restrictions with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-java\u002F\",\n      \"datePublished\": \"2024-03-08T22:25:29.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:40.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to remove restrictions from PDFs to enable printing, editing content and form fields, copying text, and more with the Restrict PDF API Tool.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Restrict PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frestrict-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Funrestricted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Frestrict-pdf\"\n        }\n      ],\n      \"keywords\": \"Java, Restrict PDF\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Remove PDF Restrictions with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10300,10301,10302,10303],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1981,"name":1982,"slug":1983,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-remove-pdf-restrictions-with-java\u002F","How to Remove PDF Restrictions with Java, Tutorial | pdfRest","Java users, remove PDF restrictions with pdfRest's Restrict PDF API Tool. Unlock print, copy, and edit functions effortlessly.",{"id":10309,"uuid":10310,"title":10311,"slug":10312,"html":10313,"comment_id":10309,"feature_image":48,"featured":284,"visibility":1257,"created_at":10314,"updated_at":10280,"published_at":10314,"custom_excerpt":10263,"codeinjection_head":10315,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10316,"primary_tag":10321,"url":10322,"excerpt":10263,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10323,"meta_description":10324,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65eb898e533c9f26b94368f4","a72b126f-6493-4283-bbba-4227e9def35a","How to Remove PDF Restrictions with JavaScript in NodeJS","how-to-remove-pdf-restrictions-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Remove PDF Restrictions with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frestrict-pdf\u002F'>Restrict PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to automate the process of modifying security settings on PDF documents. This tutorial will demonstrate how to send an API call to the \u002Funrestricted-pdf endpoint using JavaScript, which can be particularly useful when integrating this functionality into web applications or server-side scripts. The pdfRest API offers a convenient way to manipulate PDFs programmatically, saving time and effort compared to manual processing.\u003C\u002Fp>\n\n\u003Cp>A real-world example of why a user might use the Restrict PDF API could be a business that needs to distribute sensitive documents to its employees or clients. The documents may be password-protected for confidentiality, but there could be a need to remove or alter these restrictions for certain users or under specific circumstances. Automating this process with the endspoints available in the Restrict PDF API ensures that the documents are handled securely and efficiently, without the need for manual intervention.\u003C\u002Fp>\n\n\u003Ch2>Removing PDF Restrictions with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F**\n * Use this request to remove security restrictions from a password protected PDF.\n * NOTE: By default, removing the permissions password will also remove encryption by open password. To keep an open password on a document, include the current_open_password form-data field set to the correct open password.\n *\u002F\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('current_permissions_password', 'current_example_pw');\ndata.append('output', 'pdfrest_unrestricted_pdf');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Funrestricted-pdf', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source code reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Funrestricted-pdf.js\">pdfRest API Samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code example above demonstrates how to use JavaScript to call the pdfRest API and remove security restrictions from a password-protected PDF. The process involves several steps:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\u003C\u002Fpre>\n\n\u003Cp>This snippet imports the necessary modules: \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests, \u003Ccode>FormData\u003C\u002Fcode> for constructing form data payloads, and \u003Ccode>fs\u003C\u002Fcode> for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('current_permissions_password', 'current_example_pw');\ndata.append('output', 'pdfrest_unrestricted_pdf');\n\u003C\u002Fpre>\n\n\u003Cp>Here, a new \u003Ccode>FormData\u003C\u002Fcode> instance is created, and the PDF file along with parameters are appended to it. The \u003Ccode>current_permissions_password\u003C\u002Fcode> is the password currently protecting the PDF, and \u003Ccode>output\u003C\u002Fcode> is the desired name for the output file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Funrestricted-pdf',\n  headers: {\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data: data\n};\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>config\u003C\u002Fcode> object defines the configuration for the axios request, including the API endpoint URL, headers (which must include your API key), and the data payload.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\u003C\u002Fpre>\n\n\u003Cp>This snippet sends the request using axios and handles the response or error. The response will contain information about the processed PDF file.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial has walked you through how to use JavaScript to make an API call to the pdfRest Restrict PDF endpoint. By following these steps, you can programmatically remove restrictions from a password-protected PDF. To explore and demo all of the pdfRest API Tools, you can visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information about the API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Please note that this is an example of a multipart API call. Code samples using JSON payloads for different pdfRest API endpoints can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Funrestricted-pdf.js\">pdfRest API Samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-08T21:56:30.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Remove PDF Restrictions with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-03-08T21:56:30.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:41.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to remove restrictions from PDFs to enable printing, editing content and form fields, copying text, and more with the Restrict PDF API Tool.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Restrict PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frestrict-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Funrestricted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Frestrict-pdf\"\n        }\n      ],\n      \"keywords\": \"JavaScript, Restrict PDF\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Remove PDF Restrictions with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10317,10318,10319,10320],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1981,"name":1982,"slug":1983,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-remove-pdf-restrictions-with-javascript-in-nodejs\u002F","How to Remove PDF Restrictions with JavaScript in NodeJS, Tutorial | pdfRest","Discover how to eliminate PDF print, copy, and edit restrictions in NodeJS. Harness pdfRest's Restrict PDF API Tool for effortless access.",{"id":10326,"uuid":10327,"title":10328,"slug":10329,"html":10330,"comment_id":10326,"feature_image":48,"featured":284,"visibility":1257,"created_at":10331,"updated_at":3714,"published_at":10331,"custom_excerpt":10263,"codeinjection_head":10332,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10333,"primary_tag":10338,"url":10339,"excerpt":10263,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10340,"meta_description":10341,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65eb8d0b533c9f26b9436940","48d756b8-db1e-4560-88cf-b00f7d232639","How to Remove PDF Restrictions with PHP","how-to-remove-pdf-restrictions-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Remove PDF Restrictions with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frestrict-pdf\u002F\">Restrict PDF API Tool\u003C\u002Fa> provides a powerful way to apply or remove restrictions on PDF documents programmatically. This tutorial will demonstrate how to make an API call to the \u002Funrestricted-pdf endpoint using PHP, which is a common server-side scripting language used in web development. By integrating this functionality into your PHP application, you can automate the process of managing PDF permissions without manual intervention.\u003C\u002Fp>\n\n\u003Cp>Consider a scenario where a company needs to distribute sensitive reports to its employees but must ensure that these documents cannot be edited or printed. Using the Restrict PDF API, they can programmatically enforce these restrictions before distribution. Conversely, if the company later decides to lift these restrictions for a certain group of users, they can use the \u002Funrestricted-pdf endpoint of the same API to remove the restrictions, making the documents fully accessible again.\u003C\u002Fp>\n\n\u003Ch2>Removing PDF Restrictions with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile.pdf', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'current_permissions_password',\n      'contents' => 'current_example_pw'\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_unrestricted_pdf'\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Funrestricted-pdf', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>This code is sourced from the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Funrestricted-pdf.php\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided PHP code uses the Guzzle HTTP client to send a multipart\u002Fform-data POST request to the pdfRest API. Here's a breakdown of the key components:\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n$client = new Client();\n\u003C\u002Fpre>\n\n\u003Cp>This section includes the necessary classes and initializes the Guzzle HTTP client.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The headers array contains the API key required for authentication with the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">'options' => [\n  'multipart' => [\n    \u002F\u002F ...multipart array elements...\n  ]\n]\n\u003C\u002Fpre>\n\n\u003Cp>The options array is where the multipart form data is constructed. Each element of the multipart array represents a different part of the form data:\u003C\u002Fp>\n\n\u003Cul>\n  \u003Cli>'name' => 'file': Indicates the form field name for the file.\u003C\u002Fli>\n  \u003Cli>'contents': Uses Utils::tryFopen to open the file for reading.\u003C\u002Fli>\n  \u003Cli>'filename': Specifies the path to the file being uploaded.\u003C\u002Fli>\n  \u003Cli>'headers': Contains the Content-Type header for the file, which should match the file's MIME type.\u003C\u002Fli>\n  \u003Cli>'name' => 'current_permissions_password': The password for the current permissions (if the PDF is already restricted).\u003C\u002Fli>\n  \u003Cli>'name' => 'output': The desired name for the output file.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-php\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Funrestricted-pdf', $headers);\n$res = $client->sendAsync($request, $options)->wait();\necho $res->getBody();\n\u003C\u002Fpre>\n\n\u003Cp>A new Request object is created for the POST method to the Restrict PDF endpoint. The asynchronous request is sent, and the script waits for the response. The response body, which contains the unrestricted PDF, is then outputted.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps in this tutorial, you've learned how to call the pdfRest Restrict PDF API using PHP to remove restrictions from a PDF document. This can be a valuable tool for automating document workflows and managing document security within your applications.\u003C\u002Fp>\n\n\u003Cp>To further explore what you can do with pdfRest API Tools, you can demo all of them in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information on the API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Funrestricted-pdf.php\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-08T22:11:23.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-php\u002F#article\",\n      \"headline\": \"How to Remove PDF Restrictions with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-php\u002F\",\n      \"datePublished\": \"2024-03-08T22:11:23.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:41.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to remove restrictions from PDFs to enable printing, editing content and form fields, copying text, and more with the Restrict PDF API Tool.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Restrict PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frestrict-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Funrestricted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Frestrict-pdf\"\n        }\n      ],\n      \"keywords\": \"PHP, Restrict PDF\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Remove PDF Restrictions with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10334,10335,10336,10337],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1981,"name":1982,"slug":1983,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-remove-pdf-restrictions-with-php\u002F","How to Remove PDF Restrictions with PHP, Tutorial | pdfRest","Discover how to eliminate PDF print, copy, and edit restrictions using pdfRest's Restrict PDF API Tool in PHP. Explore now",{"id":10343,"uuid":10344,"title":10345,"slug":10346,"html":10347,"comment_id":10343,"feature_image":48,"featured":284,"visibility":1257,"created_at":10348,"updated_at":10349,"published_at":10348,"custom_excerpt":10263,"codeinjection_head":10350,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10351,"primary_tag":10356,"url":10357,"excerpt":10263,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10358,"meta_description":10359,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65eb8e58533c9f26b9436954","a8aab326-959b-4a94-8437-81e67513a322","How to Remove PDF Restrictions with Python","how-to-remove-pdf-restrictions-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Remove PDF Restrictions with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frestrict-pdf\u002F'>Restrict PDF API Tool\u003C\u002Fa> is a powerful service that allows users to manipulate PDF file permissions and restrictions programmatically. This tutorial will demonstrate how to make an API call to the Restrict PDF endpoint using Python. The Restrict PDF API Tool provides a range of functionalities for PDF manipulation including restricting and unrestricting PDFs via API calls.\u003C\u002Fp>\n\n\u003Cp>In a real-world scenario, a user might need to remove restrictions from a PDF document to enable editing, copying, or printing. For instance, if a company receives a restricted PDF report from an external consultant, they may need to unlock it to extract data or incorporate content into other documents. Using the \u002Funrestricted-pdf endpoint, this can be achieved programmatically, allowing for seamless integration into workflows or applications that require automated handling of PDF files.\u003C\u002Fp>\n\n\u003Ch2>Removing PDF Restrictions with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nunrestricted_pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Funrestricted-pdf'\n\n# The \u002Funrestricted-pdf endpoint can take a single PDF file or id as input.\n# This sample demonstrates removing security restrictions from a PDF.\nmp_encoder_unrestrictedPdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_unrestrictedPdf_out',\n        'current_permissions_password': 'password'\n    }\n)\n\n# Let's set the headers that the unrestricted-pdf endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_unrestrictedPdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to unrestricted-pdf endpoint...\")\nresponse = requests.post(unrestricted_pdf_endpoint_url, data=mp_encoder_unrestrictedPdf, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>This code is sourced from the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Funrestricted-pdf.py\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided Python code demonstrates how to use the pdfRest API to remove restrictions from a PDF file. Here's a breakdown of the key components of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\u003C\u002Fpre>\n\n\u003Cp>This imports the necessary libraries. \u003Ccode>MultipartEncoder\u003C\u002Fcode> from \u003Ccode>requests_toolbelt\u003C\u002Fcode> is used to encode the file as multipart\u002Fform-data, which is required for file uploads.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">unrestricted_pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Funrestricted-pdf'\n\u003C\u002Fpre>\n\n\u003Cp>This sets the API endpoint URL for the unrestricted-pdf service.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_unrestrictedPdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_unrestrictedPdf_out',\n        'current_permissions_password': 'password'\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>This creates a \u003Ccode>MultipartEncoder\u003C\u002Fcode> object with the necessary fields for the API request:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Ccode>'file'\u003C\u002Fcode>: The PDF file to be unrestricted. It should be opened in binary mode.\u003C\u002Fli>\n\u003Cli>\u003Ccode>'output'\u003C\u002Fcode>: The desired name for the output file.\u003C\u002Fli>\n\u003Cli>\u003Ccode>'current_permissions_password'\u003C\u002Fcode>: The password that unlocks the current restrictions on the PDF file.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_unrestrictedPdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\u003C\u002Fpre>\n\n\u003Cp>Headers are set for the request, including the API key which must be replaced with your own key obtained from pdfRest.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(unrestricted_pdf_endpoint_url, data=mp_encoder_unrestrictedPdf, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>The POST request is sent to the API endpoint with the encoded file data and headers.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial has shown how to remove restrictions from a PDF file using the pdfRest API and Python. By sending a properly formatted multipart\u002Fform-data request to the pdfRest API, the user can programmatically unrestrict a PDF, which could then be used for further processing or integration into other systems.\u003C\u002Fp>\n\n\u003Cp>Interested users are encouraged to experiment with all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for further details on the available endpoints and their usage.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Funrestricted-pdf.py\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-08T22:16:56.000+00:00","2026-09-02T18:29:23.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-python\u002F#article\",\n      \"headline\": \"How to Remove PDF Restrictions with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-python\u002F\",\n      \"datePublished\": \"2024-03-08T22:16:56.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:40.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to remove restrictions from PDFs to enable printing, editing content and form fields, copying text, and more with the Restrict PDF API Tool.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Restrict PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frestrict-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Funrestricted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Frestrict-pdf\"\n        }\n      ],\n      \"keywords\": \"Python, Restrict PDF\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Remove PDF Restrictions with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-remove-pdf-restrictions-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10352,10353,10354,10355],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1981,"name":1982,"slug":1983,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-remove-pdf-restrictions-with-python\u002F","How to Remove PDF Restrictions with Python, Tutorial | pdfRest","Easily lift PDF restrictions in Python by calling pdfRest's Restrict PDF API Tool to enable printing, copying, and editing.",{"id":10361,"uuid":10362,"title":10363,"slug":10364,"html":10365,"comment_id":10361,"feature_image":48,"featured":284,"visibility":1257,"created_at":10366,"updated_at":10367,"published_at":10368,"custom_excerpt":10369,"codeinjection_head":10370,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10371,"primary_tag":10378,"url":10379,"excerpt":10369,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10380,"meta_description":10369,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"683a26a6533c9f26b9439a35","f46bc3ab-a4ff-48ab-80a1-26fc306332ec","How to Resize PDF Pages with C# in .NET","how-to-resize-pdf-pages-with-c-code-in-net","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Resize PDF Pages with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fset-page-boxes\u002F\">Set Page Boxes API Tool\u003C\u002Fa> allows you to modify the page boxes of a PDF document, specifically the MediaBox, to control the physical dimensions of the pages. This tutorial will guide you through the process of sending an API call to the Set Page Boxes API Tool endpoint using C# in a .NET environment to \u003Cstrong>resize all pages\u003C\u002Fstrong> of a PDF document.\u003C\u002Fp>\n\n\u003Cp>Imagine you have a PDF document where all pages need to conform to a specific standard dimension for consistent display or processing. By using the Set Page Boxes API Tool and the \"all\" range, you can efficiently \u003Cstrong>resize all PDF pages\u003C\u002Fstrong> to meet your requirements in a single API call.\u003C\u002Fp>\n\n\u003Ch2>Resize PDF Pages with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">\nusing System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text.Json;\nusing System.Threading.Tasks;\n\npublic class ResizePdfPages\n{\n    public static async Task Main(string[] args)\n    {\n        string apiKey = \"YOUR_API_KEY\"; \u002F\u002F Replace with your actual API key\n        string pdfFilePath = \"\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf\"; \u002F\u002F Replace with the actual path to your PDF file\n        string outputName = \"resized_all_to_a4_out.pdf\";\n        string pdfWithPageBoxesEndpointUrl = \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-page-boxes-set\";\n\n        \u002F\u002F Define the MediaBox adjustments to resize all pages from Letter to A4\n        \u002F\u002F Letter: 612 x 792 points\n        \u002F\u002F A4:    595 x 842 points\n        double deltaWidthInward = (612 - 595) \u002F 2;   \u002F\u002F Positive margin to shrink width inward\n        double deltaHeightOutward = (792 - 842) \u002F 2;  \u002F\u002F Negative margin to expand height outward\n\n        var resizeBoxOptions = new\n        {\n            boxes = new[]\n            {\n                new\n                {\n                    box = \"media\",\n                    pages = new[]\n                    {\n                        new\n                        {\n                            range = \"all\",\n                            left = deltaWidthInward,\n                            top = deltaHeightOutward,\n                            bottom = deltaHeightOutward,\n                            right = deltaWidthInward\n                        }\n                    }\n                }\n            }\n        };\n\n        using (var httpClient = new HttpClient())\n        using (var formData = new MultipartFormDataContent())\n        using (var fileStream = File.OpenRead(pdfFilePath))\n        {\n            httpClient.DefaultRequestHeaders.Add(\"Api-Key\", apiKey);\n\n            formData.Add(new StreamContent(fileStream), \"file\", Path.GetFileName(pdfFilePath));\n            formData.Add(new StringContent(JsonSerializer.Serialize(resizeBoxOptions)), \"boxes\");\n            formData.Add(new StringContent(Path.GetFileNameWithoutExtension(outputName)), \"output\");\n\n            Console.WriteLine(\"Sending POST request to pdf-with-page-boxes-set endpoint to resize all PDF pages to A4...\");\n            var response = await httpClient.PostAsync(pdfWithPageBoxesEndpointUrl, formData);\n\n            Console.WriteLine($\"Response status code: {(int)response.StatusCode}\");\n\n            if (response.IsSuccessStatusCode)\n            {\n                var responseContent = await response.Content.ReadAsStringAsync();\n                Console.WriteLine($\"Response data: {responseContent}\");\n            }\n            else\n            {\n                var errorContent = await response.Content.ReadAsStringAsync();\n                Console.WriteLine($\"Error: {errorContent}\");\n            }\n        }\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-page-boxes-set.cs\">GitHub\u003C\u002Fa> (Note: This example has been modified to focus on resizing all pages)\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code for Resizing All Pages\u003C\u002Fh2>\n\n\u003Cp>The code starts by importing the necessary namespaces for file operations, HTTP requests, and JSON serialization.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">\nusing System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text.Json;\nusing System.Threading.Tasks;\n\u003C\u002Fpre>\n\n\u003Cp>This section defines the API key, input PDF file path, desired output file name, and the API endpoint URL. \u003Cstrong>Remember to replace \u003Ccode>\"YOUR_API_KEY\"\u003C\u002Fcode> with your actual pdfRest API key and \u003Ccode>\"\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf\"\u003C\u002Fcode> with the correct path to your PDF file.\u003C\u002Fstrong>\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">\nstring apiKey = \"YOUR_API_KEY\";\nstring pdfFilePath = \"\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf\";\nstring outputName = \"resized_all_to_a4_out.pdf\";\nstring pdfWithPageBoxesEndpointUrl = \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-page-boxes-set\";\n\u003C\u002Fpre>\n\n\u003Cp>This section sets the API endpoint URL.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">\n\u002F\u002F Define the MediaBox adjustments to resize all pages from Letter to A4\n\u002F\u002F Letter: 612 x 792 points\n\u002F\u002F A4:    595 x 842 points\ndouble deltaWidthInward = (612 - 595) \u002F 2;   \u002F\u002F Positive margin to shrink width inward\ndouble deltaHeightOutward = (792 - 842) \u002F 2;  \u002F\u002F Negative margin to expand height outward\n\nvar resizeBoxOptions = new\n{\n    boxes = new[]\n    {\n        new\n        {\n            box = \"media\",\n            pages = new[]\n            {\n                new\n                {\n                    range = \"all\",\n                    left = deltaWidthInward,\n                    top = deltaHeightOutward,\n                    bottom = deltaHeightOutward,\n                    right = deltaWidthInward\n                }\n            }\n        }\n    }\n};\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>resizeBoxOptions\u003C\u002Fcode> object is configured to \u003Cstrong>resize all PDF pages\u003C\u002Fstrong> by adjusting the MediaBox. The \u003Ccode>box\u003C\u002Fcode> property is set to \u003Ccode>\"media\"\u003C\u002Fcode>. Setting \u003Ccode>range\u003C\u002Fcode> to \u003Ccode>\"all\"\u003C\u002Fcode> ensures these MediaBox adjustments are applied to every page. Positive \u003Ccode>deltaWidthInward\u003C\u002Fcode> values shrink the width, and positive \u003Ccode>deltaHeightOutward\u003C\u002Fcode> values expand the height relative to the top and bottom.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">\nusing (var httpClient = new HttpClient())\nusing (var formData = new MultipartFormDataContent())\nusing (var fileStream = File.OpenRead(pdfFilePath))\n{\n    httpClient.DefaultRequestHeaders.Add(\"Api-Key\", apiKey);\n\n    formData.Add(new StreamContent(fileStream), \"file\", Path.GetFileName(pdfFilePath));\n    formData.Add(new StringContent(JsonSerializer.Serialize(resizeBoxOptions)), \"boxes\");\n    formData.Add(new StringContent(Path.GetFileNameWithoutExtension(outputName)), \"output\");\n\n    Console.WriteLine(\"Sending POST request to pdf-with-page-boxes-set endpoint to resize all PDF pages to A4...\");\n    var response = await httpClient.PostAsync(pdfWithPageBoxesEndpointUrl, formData);\n\n    Console.WriteLine($\"Response status code: {(int)response.StatusCode}\");\n\n    if (response.IsSuccessStatusCode)\n    {\n        var responseContent = await response.Content.ReadAsStringAsync();\n        Console.WriteLine($\"Response data: {responseContent}\");\n    }\n    else\n    {\n        var errorContent = await response.Content.ReadAsStringAsync();\n        Console.WriteLine($\"Error: {errorContent}\");\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>This section creates an \u003Ccode>HttpClient\u003C\u002Fcode> and a \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> object to send the PDF file and the JSON-serialized \u003Ccode>resizeBoxOptions\u003C\u002Fcode>. It sets the \u003Ccode>Api-Key\u003C\u002Fcode> in the request headers and adds the file and other parameters to the form data. Finally, it sends a POST request to the pdfRest API endpoint to \u003Cstrong>resize all PDF pages\u003C\u002Fstrong> and handles the response.\u003C\u002Fp>\n\n\u003Ch2>Next Steps for Resizing All PDF Pages\u003C\u002Fh2>\n\n\u003Cp>This tutorial demonstrated how to use C# (.NET) and the pdfRest Set Page Boxes API Tool to \u003Cstrong>resize all pages of a PDF from US Letter to A4\u003C\u002Fstrong> by setting the MediaBox with the \u003Ccode>range = \"all\"\u003C\u002Fcode> option. You can adapt the \u003Ccode>deltaWidthInward\u003C\u002Fcode> and \u003Ccode>deltaHeightOutward\u003C\u002Fcode> calculations to resize to other dimensions. This approach efficiently applies the same resizing to every page in your document.\u003C\u002Fp>\n\n\u003Cp>To learn more about the Set Page Boxes API Tool and its capabilities, including setting other page boxes and using different page ranges, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\" target=\"_blank\">API Reference Guide\u003C\u002Fa> for detailed documentation.\u003C\u002Fp>\n\n\u003Cp>Note: This example uses a multipart API call. JSON payload examples for setting page boxes, including the MediaBox, can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-page-boxes-set.cs\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-05-30T21:44:06.000+00:00","2026-09-02T18:29:24.000+00:00","2025-05-30T22:05:17.000+00:00","Learn how to use pdfRest Set Page Boxes API to resize PDF pages with C#.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-c-code-in-net\u002F#article\",\n      \"headline\": \"How to Resize PDF Pages with C# in .NET\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-c-code-in-net\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-c-code-in-net\u002F\",\n      \"datePublished\": \"2025-05-30T22:05:17.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:14.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Set Page Boxes API to resize PDF pages with C#.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Set Page Boxes API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fset-page-boxes\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-page-boxes-set API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fset-page-boxes\"\n        }\n      ],\n      \"keywords\": \".NET, Pages, Resize, Set Page Boxes\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Resize PDF Pages with C# in .NET\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-c-code-in-net\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10372,10373,10374,10375,10376,10377],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2181,"name":2182,"slug":2183,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1939,"name":1940,"slug":1941,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1607,"name":1608,"slug":1609,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-resize-pdf-pages-with-c-code-in-net\u002F","How to Resize PDF Pages with C# in .NET, Tutorial | pdfRest",{"id":10382,"uuid":10383,"title":10384,"slug":10385,"html":10386,"comment_id":10382,"feature_image":48,"featured":284,"visibility":1257,"created_at":10387,"updated_at":10367,"published_at":10388,"custom_excerpt":10389,"codeinjection_head":10390,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10391,"primary_tag":10398,"url":10399,"excerpt":10389,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10400,"meta_description":10389,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"683a2c29533c9f26b9439a4d","b88f58c9-6e54-4839-822a-12fccb498f79","How to Resize PDF Pages with cURL","how-to-resize-pdf-pages-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Resize PDF Pages with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fset-page-boxes\u002F\">Set Page Boxes API Tool\u003C\u002Fa> allows you to modify the page boxes of a PDF document, specifically the MediaBox, to control the physical dimensions of the pages. This tutorial will guide you through the process of sending an API call to the Set Page Boxes API Tool endpoint using cURL to \u003Cstrong>resize all pages\u003C\u002Fstrong> of a PDF document.\u003C\u002Fp>\n\n\u003Cp>Imagine you have a PDF document where all pages need to conform to a specific standard dimension for consistent display or processing. By using the Set Page Boxes API Tool and the \"all\" range, you can efficiently \u003Cstrong>resize all PDF pages\u003C\u002Fstrong> directly from your command line or scripts.\u003C\u002Fp>\n\n\u003Ch2>Resize PDF Pages with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\"># Define the MediaBox settings as a JSON string\nRESIZE_BOXES='{\"boxes\":[{\"box\":\"media\",\"pages\":[{\"range\":\"all\",\"left\":$(( (612 - 595) \u002F 2 )),\"top\":$(( (792 - 842) \u002F 2 )),\"bottom\":$(( (792 - 842) \u002F 2 )),\"right\":$(( (612 - 595) \u002F 2 ))}]}]}'\n\n# Use curl to send a POST request to the pdfRest API endpoint\ncurl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-page-boxes-set\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: YOUR_API_KEY\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf\" \\\n  -F \"boxes=$RESIZE_BOXES\" \\\n  -F \"output=resized_all_to_a4_out.pdf\"\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-page-boxes-set.sh\">GitHub\u003C\u002Fa> (Note: This example has been modified to focus on resizing all pages)\u003C\u002Fp>\n\n\u003Cp>Source: Based on the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fset-page-boxes\u002F\">pdfRest API Documentation\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the cURL Command for Resizing All Pages\u003C\u002Fh2>\n\n\u003Cp>This command uses \u003Ccode>curl\u003C\u002Fcode> to send a POST request to the pdfRest API endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-page-boxes-set\"\n\u003C\u002Fpre>\n\n\u003Cp>This specifies the POST method and the API endpoint URL for setting page boxes.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\" \\\n-H \"Content-Type: multipart\u002Fform-data\" \\\n-H \"Api-Key: YOUR_API_KEY\"\n\u003C\u002Fpre>\n\n\u003Cp>These lines set the necessary headers. \u003Cstrong>Remember to replace \u003Ccode>YOUR_API_KEY\u003C\u002Fcode> with your actual pdfRest API key.\u003C\u002Fstrong> The \u003Ccode>Content-Type\u003C\u002Fcode> is set to \u003Ccode>multipart\u002Fform-data\u003C\u002Fcode> as we are sending a file along with JSON data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf\"\n\u003C\u002Fpre>\n\n\u003Cp>This line specifies the PDF file to be processed. \u003Cstrong>Replace \u003Ccode>\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf\u003C\u002Fcode> with the actual path to your PDF file.\u003C\u002Fstrong> The \u003Ccode>@\u003C\u002Fcode> symbol tells cURL to upload the file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\"># Define the MediaBox settings as a JSON string\nRESIZE_BOXES='{\"boxes\":[{\"box\":\"media\",\"pages\":[{\"range\":\"all\",\"left\":$(( (612 - 595) \u002F 2 )),\"top\":$(( (792 - 842) \u002F 2 )),\"bottom\":$(( (792 - 842) \u002F 2 )),\"right\":$(( (612 - 595) \u002F 2 ))}]}]}'\n-F \"boxes=$RESIZE_BOXES\"\n\u003C\u002Fpre>\n\n\u003Cp>This section first defines the JSON payload as a shell variable \u003Ccode>RESIZE_BOXES\u003C\u002Fcode>. Let's break down the JSON:\u003C\u002Fp>\n\n\u003Cul>\n    \u003Cli>\u003Ccode>\"boxes\"\u003C\u002Fcode>: The top-level array containing box definitions.\u003C\u002Fli>\n    \u003Cli>\u003Ccode>\"box\": \"media\"\u003C\u002Fcode>: Specifies that we are adjusting the MediaBox.\u003C\u002Fli>\n    \u003Cli>\u003Ccode>\"pages\"\u003C\u002Fcode>: An array of page specifications.\u003C\u002Fli>\n    \u003Cli>\u003Ccode>\"range\": \"all\"\u003C\u002Fcode>: Instructs the API to apply the changes to all pages.\u003C\u002Fli>\n    \u003Cli>\u003Ccode>\"left\": $(( (612 - 595) \u002F 2 ))\u003C\u002Fcode>: Calculates and sets the positive left margin to shrink the width from Letter (612 points) to A4 (595 points).\u003C\u002Fli>\n    \u003Cli>\u003Ccode>\"top\": $(( (792 - 842) \u002F 2 ))\u003C\u002Fcode>: Calculates and sets the negative top margin to expand the height from Letter (792 points) to A4 (842 points).\u003C\u002Fli>\n    \u003Cli>\u003Ccode>\"bottom\": $(( (792 - 842) \u002F 2 ))\u003C\u002Fcode>: Calculates and sets the negative bottom margin to expand the height.\u003C\u002Fli>\n    \u003Cli>\u003Ccode>\"right\": $(( (612 - 595) \u002F 2 ))\u003C\u002Fcode>: Calculates and sets the positive right margin to shrink the width.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>Note the use of \u003Ccode>$((...))\u003C\u002Fcode> for inline arithmetic calculation in bash.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=resized_all_to_a4_out.pdf\"\n\u003C\u002Fpre>\n\n\u003Cp>This line specifies the desired name for the output PDF file.\u003C\u002Fp>\n\n\u003Ch2>Next Steps for Resizing All PDF Pages\u003C\u002Fh2>\n\n\u003Cp>This tutorial demonstrated how to use cURL and the pdfRest Set Page Boxes API Tool to \u003Cstrong>resize all pages of a PDF from US Letter to A4\u003C\u002Fstrong> by setting the MediaBox with the \u003Ccode>\"range\": \"all\"\u003C\u002Fcode> option directly from your command line. You can adapt the margin calculations within the \u003Ccode>RESIZE_BOXES\u003C\u002Fcode> variable to resize to other dimensions. This method is useful for quick tests and integration into shell scripts.\u003C\u002Fp>\n\n\u003Cp>To learn more about the Set Page Boxes API Tool and its capabilities, including setting other page boxes and using different page ranges, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\" target=\"_blank\">API Reference Guide\u003C\u002Fa> for detailed documentation.\u003C\u002Fp>\n\n\u003Cp>Note: This example uses a multipart API call. JSON payload examples for setting page boxes, including the MediaBox, can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-page-boxes-set.sh\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-05-30T22:07:37.000+00:00","2025-05-30T22:10:11.000+00:00","Learn how to resize PDF pages using cURL with pdfRest Set Page Boxes API.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-curl\u002F#article\",\n      \"headline\": \"How to Resize PDF Pages with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-curl\u002F\",\n      \"datePublished\": \"2025-05-30T22:10:11.000Z\",\n      \"dateModified\": \"2026-09-01T16:00:45.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to resize PDF pages using cURL with pdfRest Set Page Boxes API.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Set Page Boxes API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fset-page-boxes\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-page-boxes-set API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fset-page-boxes\"\n        }\n      ],\n      \"keywords\": \"Pages, Resize, Set Page Boxes, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Resize PDF Pages with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10392,10393,10394,10395,10396,10397],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2181,"name":2182,"slug":2183,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1939,"name":1940,"slug":1941,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1607,"name":1608,"slug":1609,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-resize-pdf-pages-with-curl\u002F","How to Resize PDF Pages with cURL, Tutorial | pdfRest",{"id":10402,"uuid":10403,"title":10404,"slug":10405,"html":10406,"comment_id":10402,"feature_image":48,"featured":284,"visibility":1257,"created_at":10407,"updated_at":10408,"published_at":10409,"custom_excerpt":10410,"codeinjection_head":10411,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10412,"primary_tag":10419,"url":10420,"excerpt":10410,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10421,"meta_description":10410,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"683a2d57533c9f26b9439a6b","3ecbece1-130f-4d27-b90e-0f2a32cb7a73","How to Resize PDF Pages with Java","how-to-resize-pdf-pages-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Resize PDF Pages with Java?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fset-page-boxes\u002F\">Set Page Boxes API Tool\u003C\u002Fa> allows you to modify the page boxes of a PDF document, specifically the MediaBox, to control the physical dimensions of the pages. This tutorial will guide you through the process of sending an API call to the Set Page Boxes API Tool endpoint using Java to \u003Cstrong>resize all pages\u003C\u002Fstrong> of a PDF document.\u003C\u002Fp>\n\n\u003Cp>Imagine you have a PDF document where all pages need to conform to a specific standard dimension for consistent display or processing. By using the Set Page Boxes API Tool and the \"all\" range, you can efficiently \u003Cstrong>resize all PDF pages\u003C\u002Fstrong> within your Java applications.\u003C\u002Fp>\n\n\u003Ch2>Resize PDF Pages with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import java.io.File;\nimport java.io.IOException;\nimport java.net.URI;\nimport java.net.http.HttpClient;\nimport java.net.http.HttpRequest;\nimport java.net.http.HttpResponse;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.util.HashMap;\nimport java.util.Map;\n\npublic class ResizePdfPages {\n    public static void main(String[] args) throws IOException, InterruptedException {\n        String apiKey = \"YOUR_API_KEY\"; \u002F\u002F Replace with your actual API key\n        String pdfFilePath = \"\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf\"; \u002F\u002F Replace with the actual path to your PDF file\n        String outputName = \"resized_all_to_a4_out.pdf\";\n        String pdfWithPageBoxesEndpointUrl = \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-page-boxes-set\";\n\n        \u002F\u002F Define the MediaBox adjustments to resize all pages from Letter to A4\n        \u002F\u002F Letter: 612 x 792 points\n        \u002F\u002F A4:    595 x 842 points\n        double deltaWidthInward = (612 - 595) \u002F 2;   \u002F\u002F Positive margin to shrink width inward\n        double deltaHeightOutward = (792 - 842) \u002F 2;  \u002F\u002F Negative margin to expand height outward\n\n        String boxesJson = String.format(\n                \"{\\\"boxes\\\": [{\\\"box\\\": \\\"media\\\", \\\"pages\\\": [{\\\"range\\\": \\\"all\\\", \\\"left\\\": %.2f, \\\"top\\\": %.2f, \\\"bottom\\\": %.2f, \\\"right\\\": %.2f}]}]}\",\n                deltaWidthInward, deltaHeightOutward, deltaHeightOutward, deltaWidthInward\n        );\n\n        MultipartFormDataBodyBuilder builder = new MultipartFormDataBodyBuilder()\n                .addPart(\"file\", Paths.get(pdfFilePath))\n                .addPart(\"boxes\", boxesJson)\n                .addPart(\"output\", outputName.replace(\".pdf\", \"\"));\n\n        HttpRequest request = HttpRequest.newBuilder()\n                .uri(URI.create(pdfWithPageBoxesEndpointUrl))\n                .header(\"Api-Key\", apiKey)\n                .header(\"Content-Type\", \"multipart\u002Fform-data; boundary=\" + builder.getBoundary())\n                .POST(builder.build())\n                .build();\n\n        HttpClient client = HttpClient.newBuilder().build();\n        System.out.println(\"Sending POST request to pdf-with-page-boxes-set endpoint to resize all PDF pages to A4...\");\n        HttpResponse\u003CString> response = client.send(request, HttpResponse.BodyHandlers.ofString());\n\n        System.out.println(\"Response status code: \" + response.statusCode());\n        System.out.println(\"Response body: \" + response.body());\n    }\n\n    \u002F\u002F Helper class for building multipart\u002Fform-data request body\n    private static class MultipartFormDataBodyBuilder {\n        private final String boundary;\n        private final StringBuilder body;\n        private final Map\u003CString, String> headers;\n\n        public MultipartFormDataBodyBuilder() {\n            this.boundary = Long.toHexString(System.currentTimeMillis());\n            this.body = new StringBuilder();\n            this.headers = new HashMap\u003C>();\n        }\n\n        public MultipartFormDataBodyBuilder addPart(String name, String value) {\n            body.append(\"--\").append(boundary).append(\"\\r\\n\");\n            body.append(\"Content-Disposition: form-data; name=\\\"\").append(name).append(\"\\\"\\r\\n\");\n            body.append(\"\\r\\n\");\n            body.append(value).append(\"\\r\\n\");\n            return this;\n        }\n\n        public MultipartFormDataBodyBuilder addPart(String name, Path file) throws IOException {\n            body.append(\"--\").append(boundary).append(\"\\r\\n\");\n            body.append(\"Content-Disposition: form-data; name=\\\"\").append(name).append(\"\\\"; filename=\\\"\").append(file.getFileName()).append(\"\\\"\\r\\n\");\n            body.append(\"Content-Type: application\u002Fpdf\\r\\n\");\n            body.append(\"\\r\\n\");\n            body.append(Files.readString(file)).append(\"\\r\\n\"); \u002F\u002F Note: Reads entire file into string - for large files, use streams\n            return this;\n        }\n\n        public HttpRequest.BodyPublisher build() {\n            body.append(\"--\").append(boundary).append(\"--\\r\\n\");\n            return HttpRequest.BodyPublishers.ofString(body.toString());\n        }\n\n        public String getBoundary() {\n            return boundary;\n        }\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPDFWithPageBoxesSet.java\">GitHub\u003C\u002Fa> (Note: This example has been modified to focus on resizing all pages)\u003C\u002Fp>\n\n\u003Cp>Source: Based on the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fset-page-boxes\u002F\">pdfRest API Documentation\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code for Resizing All Pages\u003C\u002Fh2>\n\n\u003Cp>The code starts by importing necessary Java libraries for file operations, HTTP requests, and string formatting.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">import java.io.File;\nimport java.io.IOException;\nimport java.net.URI;\nimport java.net.http.HttpClient;\nimport java.net.http.HttpRequest;\nimport java.net.http.HttpResponse;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.util.HashMap;\nimport java.util.Map;\n\u003C\u002Fpre>\n\n\u003Cp>This section defines the API key, input PDF file path, desired output file name, and the API endpoint URL. \u003Cstrong>Remember to replace \u003Ccode>\"YOUR_API_KEY\"\u003C\u002Fcode> with your actual pdfRest API key and \u003Ccode>\"\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf\"\u003C\u002Fcode> with the correct path to your PDF file.\u003C\u002Fstrong>\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">String apiKey = \"YOUR_API_KEY\";\nString pdfFilePath = \"\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf\";\nString outputName = \"resized_all_to_a4_out.pdf\";\nString pdfWithPageBoxesEndpointUrl = \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-page-boxes-set\";\n\u003C\u002Fpre>\n\n\u003Cp>This section sets the API endpoint URL.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">\u002F\u002F Define the MediaBox adjustments to resize all pages from Letter to A4\n\u002F\u002F Letter: 612 x 792 points\n\u002F\u002F A4:    595 x 842 points\ndouble deltaWidthInward = (612 - 595) \u002F 2;   \u002F\u002F Positive margin to shrink width inward\ndouble deltaHeightOutward = (792 - 842) \u002F 2;  \u002F\u002F Negative margin to expand height outward\n\nString boxesJson = String.format(\n        \"{\\\"boxes\\\": [{\\\"box\\\": \\\"media\\\", \\\"pages\\\": [{\\\"range\\\": \\\"all\\\", \\\"left\\\": %.2f, \\\"top\\\": %.2f, \\\"bottom\\\": %.2f, \\\"right\\\": %.2f}]}]}\",\n        deltaWidthInward, deltaHeightOutward, deltaHeightOutward, deltaWidthInward\n);\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>boxesJson\u003C\u002Fcode> string is formatted to create the JSON payload for resizing all pages. The \u003Ccode>\"box\"\u003C\u002Fcode> is set to \u003Ccode>\"media\"\u003C\u002Fcode>, and \u003Ccode>\"range\"\u003C\u002Fcode> is set to \u003Ccode>\"all\"\u003C\u002Fcode> to apply the adjustments to every page. Positive \u003Ccode>deltaWidthInward\u003C\u002Fcode> values shrink the width, and positive \u003Ccode>deltaHeightOutward\u003C\u002Fcode> values expand the height.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">MultipartFormDataBodyBuilder builder = new MultipartFormDataBodyBuilder()\n        .addPart(\"file\", Paths.get(pdfFilePath))\n        .addPart(\"boxes\", boxesJson)\n        .addPart(\"output\", outputName.replace(\".pdf\", \"\"));\n\nHttpRequest request = HttpRequest.newBuilder()\n        .uri(URI.create(pdfWithPageBoxesEndpointUrl))\n        .header(\"Api-Key\", apiKey)\n        .header(\"Content-Type\", \"multipart\u002Fform-data; boundary=\" + builder.getBoundary())\n        .POST(builder.build())\n        .build();\n\nHttpClient client = HttpClient.newBuilder().build();\nSystem.out.println(\"Sending POST request to pdf-with-page-boxes-set endpoint to resize all PDF pages to A4...\");\nHttpResponse\u003CString> response = client.send(request, HttpResponse.BodyHandlers.ofString());\n\nSystem.out.println(\"Response status code: \" + response.statusCode());\nSystem.out.println(\"Response body: \" + response.body());\n\u003C\u002Fpre>\n\n\u003Cp>This section uses Java's \u003Ccode>HttpClient\u003C\u002Fcode> to build and send a POST request to the pdfRest API. It creates a multipart\u002Fform-data body containing the PDF file, the \u003Ccode>boxesJson\u003C\u002Fcode>, and the output filename. The \u003Ccode>Api-Key\u003C\u002Fcode> is set in the header. The response status code and body are then printed.\u003C\u002Fp>\n\n\u003Ch2>Next Steps for Resizing All PDF Pages\u003C\u002Fh2>\n\n\u003Cp>This tutorial demonstrated how to use Java and the pdfRest Set Page Boxes API Tool to \u003Cstrong>resize all pages of a PDF from US Letter to A4\u003C\u002Fstrong> by setting the MediaBox with the \u003Ccode>\"range\": \"all\"\u003C\u002Fcode> option. You can adapt the \u003Ccode>deltaWidthInward\u003C\u002Fcode> and \u003Ccode>deltaHeightOutward\u003C\u002Fcode> calculations to resize to other dimensions within your Java applications.\u003C\u002Fp>\n\n\u003Cp>To learn more about the Set Page Boxes API Tool and its capabilities, including setting other page boxes and using different page ranges, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\" target=\"_blank\">API Reference Guide\u003C\u002Fa> for detailed documentation.\u003C\u002Fp>\n\n\u003Cp>Note: This example uses a multipart API call. JSON payload examples for setting page boxes, including the MediaBox, can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPDFWithPageBoxesSet.java\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-05-30T22:12:39.000+00:00","2026-09-02T18:29:26.000+00:00","2025-05-30T22:14:01.000+00:00","Learn how to resize PDF pages with pdfRest Set Page Boxes API using Java.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-java\u002F#article\",\n      \"headline\": \"How to Resize PDF Pages with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-java\u002F\",\n      \"datePublished\": \"2025-05-30T22:14:01.000Z\",\n      \"dateModified\": \"2026-09-01T16:00:44.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to resize PDF pages with pdfRest Set Page Boxes API using Java.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Set Page Boxes API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fset-page-boxes\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-page-boxes-set API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fset-page-boxes\"\n        }\n      ],\n      \"keywords\": \"Java, Pages, Resize, Set Page Boxes\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Resize PDF Pages with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10413,10414,10415,10416,10417,10418],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2181,"name":2182,"slug":2183,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1939,"name":1940,"slug":1941,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1607,"name":1608,"slug":1609,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-resize-pdf-pages-with-java\u002F","How to Resize PDF Pages with Java, Tutorial | pdfRest",{"id":10423,"uuid":10424,"title":10425,"slug":10426,"html":10427,"comment_id":10423,"feature_image":48,"featured":284,"visibility":1257,"created_at":10428,"updated_at":10408,"published_at":10429,"custom_excerpt":10430,"codeinjection_head":10431,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10432,"primary_tag":10439,"url":10440,"excerpt":10430,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10441,"meta_description":10430,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"683a24db533c9f26b9439a1f","8ff66746-4d56-489b-bd44-fc920d35c31a","How to Resize PDF Pages with JavaScript in NodeJS","how-to-resize-pdf-pages-with-javascript-code-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Resize PDF Pages with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fset-page-boxes\u002F\">Set Page Boxes API Tool\u003C\u002Fa> allows you to modify the page boxes of a PDF document, specifically the MediaBox, to control the physical dimensions of the pages. This tutorial will guide you through the process of sending an API call to the Set Page Boxes API Tool endpoint using JavaScript in a NodeJS environment to \u003Cstrong>resize all pages\u003C\u002Fstrong> of a PDF document.\u003C\u002Fp>\n\n\u003Cp>Imagine you have a PDF document where all pages need to conform to a specific standard dimension for consistent display or processing. By using the Set Page Boxes API Tool and the \"all\" range, you can efficiently \u003Cstrong>resize all PDF pages\u003C\u002Fstrong> to meet your requirements in a single API call.\u003C\u002Fp>\n\n\u003Ch2>Resize PDF Pages with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\nconst fs = require('node:fs');\nconst FormData = require('form-data');\nconst axios = require('axios');\n\nconst apiKey = 'YOUR_API_KEY'; \u002F\u002F Replace with your actual API key\nconst pdfFilePath = '\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf'; \u002F\u002F Replace with the actual path to your PDF file\nconst outputName = 'resized_all_to_a4_out.pdf';\nconst pdfWithPageBoxesEndpointUrl = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-page-boxes-set';\n\n\u002F\u002F Define the MediaBox adjustments to resize all pages from Letter to A4\n\u002F\u002F Letter: 612 x 792 points\n\u002F\u002F A4:    595 x 842 points\nconst deltaWidthInward = (612 - 595) \u002F 2;   \u002F\u002F Positive margin to shrink width inward\nconst deltaHeightOutward = (792 - 842) \u002F 2;  \u002F\u002F Negative margin to expand height outward\n\nconst resizeBoxOptions = {\n    boxes: [\n        {\n            box: 'media',\n            pages: [\n                {\n                    range: 'all',\n                    left: deltaWidthInward,\n                    top: deltaHeightOutward,\n                    bottom: deltaHeightOutward,\n                    right: deltaWidthInward,\n                },\n            ],\n        },\n    ],\n};\n\nasync function resizePdfPages() {\n    try {\n        const formData = new FormData();\n        formData.append('file', fs.createReadStream(pdfFilePath));\n        formData.append('boxes', JSON.stringify(resizeBoxOptions));\n        formData.append('output', outputName.replace('.pdf', ''));\n\n        const headers = {\n            'Content-Type': `multipart\u002Fform-data; boundary=${formData._boundary}`,\n            'Api-Key': apiKey,\n        };\n\n        console.log('Sending POST request to pdf-with-page-boxes-set endpoint to resize all PDF pages to A4...');\n        const response = await axios.post(pdfWithPageBoxesEndpointUrl, formData, { headers });\n\n        console.log('Response status code:', response.status);\n\n        if (response.data) {\n            console.log('Response data:', JSON.stringify(response.data, null, 2));\n        } else {\n            console.log('Empty response data');\n        }\n    } catch (error) {\n        console.error('Error:', error.message);\n    }\n}\n\nresizePdfPages();\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-page-boxes-set.js\">GitHub\u003C\u002Fa> (Note: This example has been modified to focus on resizing all pages)\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code for Resizing All Pages\u003C\u002Fh2>\n\n\u003Cp>The code starts by importing the necessary modules: \u003Ccode>fs\u003C\u002Fcode> for file system operations, \u003Ccode>form-data\u003C\u002Fcode> for creating multipart form data, and \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">\nconst fs = require('node:fs');\nconst FormData = require('form-data');\nconst axios = require('axios');\n\nconst apiKey = 'YOUR_API_KEY'; \u002F\u002F Replace with your actual API key\nconst pdfFilePath = '\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf'; \u002F\u002F Replace with the actual path to your PDF file\nconst outputName = 'resized_all_to_a4_out.pdf';\nconst pdfWithPageBoxesEndpointUrl = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-page-boxes-set';\n\u003C\u002Fpre>\n\n\u003Cp>This section defines the API key, input PDF file path, desired output file name, and the API endpoint URL. \u003Cstrong>Remember to replace \u003Ccode>'YOUR_API_KEY'\u003C\u002Fcode> with your actual pdfRest API key and \u003Ccode>'\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf'\u003C\u002Fcode> with the correct path to your PDF file.\u003C\u002Fstrong>\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">\n\u002F\u002F Define the MediaBox adjustments to resize all pages from Letter to A4\n\u002F\u002F Letter: 612 x 792 points\n\u002F\u002F A4:    595 x 842 points\nconst deltaWidthInward = (612 - 595) \u002F 2;   \u002F\u002F Positive margin to shrink width inward\nconst deltaHeightOutward = (792 - 842) \u002F 2;  \u002F\u002F Negative margin to expand height outward\n\nconst resizeBoxOptions = {\n    boxes: [\n        {\n            box: 'media',\n            pages: [\n                {\n                    range: 'all',\n                    left: deltaWidthInward,\n                    top: deltaHeightOutward,\n                    bottom: deltaHeightOutward,\n                    right: deltaWidthInward,\n                },\n            ],\n        },\n    ],\n};\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>resizeBoxOptions\u003C\u002Fcode> object is configured to \u003Cstrong>resize all PDF pages\u003C\u002Fstrong> by adjusting the MediaBox. The \u003Ccode>box\u003C\u002Fcode> key is set to \u003Ccode>'media'\u003C\u002Fcode>. Setting \u003Ccode>range\u003C\u002Fcode> to \u003Ccode>'all'\u003C\u002Fcode> ensures these MediaBox adjustments are applied to every page. Positive \u003Ccode>deltaWidthInward\u003C\u002Fcode> values shrink the width, and positive \u003Ccode>deltaHeightOutward\u003C\u002Fcode> values expand the height relative to the top and bottom.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">\nasync function resizePdfPages() {\n    try {\n        const formData = new FormData();\n        formData.append('file', fs.createReadStream(pdfFilePath));\n        formData.append('boxes', JSON.stringify(resizeBoxOptions));\n        formData.append('output', outputName.replace('.pdf', ''));\n\n        const headers = {\n            'Content-Type': `multipart\u002Fform-data; boundary=${formData._boundary}`,\n            'Api-Key': apiKey,\n        };\n\n        console.log('Sending POST request to pdf-with-page-boxes-set endpoint to resize all PDF pages to A4...');\n        const response = await axios.post(pdfWithPageBoxesEndpointUrl, formData, { headers });\n\n        console.log('Response status code:', response.status);\n\n        if (response.data) {\n            console.log('Response data:', JSON.stringify(response.data, null, 2));\n        } else {\n            console.log('Empty response data');\n        }\n    } catch (error) {\n        console.error('Error:', error.message);\n    }\n}\n\nresizePdfPages();\n\u003C\u002Fpre>\n\n\u003Cp>This asynchronous function \u003Ccode>resizePdfPages\u003C\u002Fcode> creates a \u003Ccode>FormData\u003C\u002Fcode> object to send the PDF file and the JSON-encoded \u003Ccode>resizeBoxOptions\u003C\u002Fcode>. It then sets the necessary headers, including the \u003Ccode>Content-Type\u003C\u002Fcode> for multipart form data and your API key. Finally, it uses \u003Ccode>axios\u003C\u002Fcode> to send a POST request to the pdfRest API endpoint to \u003Cstrong>resize all PDF pages\u003C\u002Fstrong> and logs the response.\u003C\u002Fp>\n\n\u003Ch2>Next Steps for Resizing All PDF Pages\u003C\u002Fh2>\n\n\u003Cp>This tutorial demonstrated how to use JavaScript (NodeJS) and the pdfRest Set Page Boxes API Tool to \u003Cstrong>resize all pages of a PDF from US Letter to A4\u003C\u002Fstrong> by setting the MediaBox with the \u003Ccode>range: 'all'\u003C\u002Fcode> option. You can adapt the \u003Ccode>deltaWidthInward\u003C\u002Fcode> and \u003Ccode>deltaHeightOutward\u003C\u002Fcode> calculations to resize to other dimensions. This approach efficiently applies the same resizing to every page in your document.\u003C\u002Fp>\n\n\u003Cp>To learn more about the Set Page Boxes API Tool and its capabilities, including setting other page boxes and using different page ranges, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\" target=\"_blank\">API Reference Guide\u003C\u002Fa> for detailed documentation.\u003C\u002Fp>\n\n\u003Cp>Note: This example uses a multipart API call. JSON payload examples for setting page boxes, including the MediaBox, can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-page-boxes-set.js\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-05-30T21:36:27.000+00:00","2025-05-30T21:42:43.000+00:00","Learn how to use JavaScript to resize PDF pages using Set Page Boxes API by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-javascript-code-in-nodejs\u002F#article\",\n      \"headline\": \"How to Resize PDF Pages with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-javascript-code-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-javascript-code-in-nodejs\u002F\",\n      \"datePublished\": \"2025-05-30T21:42:43.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:14.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use JavaScript to resize PDF pages using Set Page Boxes API by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Set Page Boxes API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fset-page-boxes\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-page-boxes-set API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fset-page-boxes\"\n        }\n      ],\n      \"keywords\": \"JavaScript, Pages, Resize, Set Page Boxes\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Resize PDF Pages with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-javascript-code-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10433,10434,10435,10436,10437,10438],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2181,"name":2182,"slug":2183,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1939,"name":1940,"slug":1941,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1607,"name":1608,"slug":1609,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-resize-pdf-pages-with-javascript-code-in-nodejs\u002F","How to Resize PDF Pages with JavaScript in NodeJS, Tutorial | pdfRest",{"id":10443,"uuid":10444,"title":10445,"slug":10446,"html":10447,"comment_id":10443,"feature_image":48,"featured":284,"visibility":1257,"created_at":10448,"updated_at":10449,"published_at":10450,"custom_excerpt":10451,"codeinjection_head":10452,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10453,"primary_tag":10460,"url":10461,"excerpt":10451,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10462,"meta_description":10451,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"683a2243533c9f26b9439a07","76602e0b-0b72-4751-949b-4d59f6e4da42","How to Resize PDF Pages with PHP","how-to-resize-pdf-pages-with-php-code","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Change PDF Page Dimensions with PHP\u003C\u002Fh2>\n\n\u003Cp>PDF page dimensions are defined by page boxes. The MediaBox establishes the physical page boundary, while other boxes can define the visible, printed, or finished regions. The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fset-page-boxes\u002F\">Set Page Boxes API Tool\u003C\u002Fa> lets a PHP application adjust these boundaries programmatically through the \u003Ccode>\u002Fpdf-with-page-boxes-set\u003C\u002Fcode> endpoint.\u003C\u002Fp>\n\n\u003Cp>This distinction matters: changing a MediaBox changes the page canvas, but it does not scale the text, images, or vector artwork already on the page. Expanding the boundary can add surrounding page area, while reducing it can place existing content outside the new boundary. If a workflow needs to proportionally enlarge or shrink the page content itself, page-box adjustments alone are not the same operation.\u003C\u002Fp>\n\n\u003Cp>For example, an archival intake system may receive a batch containing both US Letter and A4 scans. If the archive requires an A4 page boundary before documents are assembled into a single package, the application can apply the approved Letter-to-A4 MediaBox calculation to every file. The content stays at its original scale while the page boundary is standardized consistently across the batch.\u003C\u002Fp>\n\n\u003Cp>The PHP example calculates the difference between Letter and A4 dimensions in PDF points and sends the resulting MediaBox adjustments as multipart form data.\u003C\u002Fp>\n\n\u003Ch2>PHP Set Page Boxes Code Example\u003C\u002Fh2>\n\n\u003Cp>Install Guzzle with Composer, replace the API-key and local-file placeholders, and select the US or EU base URL shown in the official sample. The Letter-to-A4 values remain together in the \u003Ccode>boxes\u003C\u002Fcode> JSON so the calculation is easy to review.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\n$headers = [\n  'Api-Key' => 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile.pdf', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => 'file.pdf', \u002F\u002F Set the filename for the file to be processed, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => 'application\u002Fpdf' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'boxes', \u002F\u002F Specify the field name for the text options.\n      'contents' => '{\"boxes\":[{\"box\":\"media\",\"pages\":[{\"range\":\"all\",\"left\":8.5,\"top\":-25,\"bottom\":-25,\"right\":8.5}]}]}' \u002F\u002F Set the value for the boxes option. This is a JSON-formatted string consisting of an array with sets of text options.\n    ],\n    [\n      'name' => 'output', \u002F\u002F Specify the field name for the output option.\n      'contents' => 'resized_all_to_a4_out' \u002F\u002F Set the value for the output option (in this case, 'pdfrest_pdf_with_boxes_set').\n    ]\n  ]\n];\n\n$request = new Request('POST', $apiUrl.'\u002Fpdf-with-page-boxes-set', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the PDF with the boxes set.\n\u003C\u002Fpre>\n\n\u003Cp>Structural reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-page-boxes-set.php\">pdfRest Set Page Boxes multipart PHP sample\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Calculate MediaBox Adjustments Carefully\u003C\u002Fh2>\n\n\u003Cp>PDF dimensions use points, with 72 points per inch. US Letter is 612 by 792 points, and A4 is approximately 595 by 842 points. The difference is applied across the page edges according to the desired alignment. A centered adjustment divides the horizontal and vertical differences between opposite sides; an anchored adjustment can leave one edge fixed and apply the full difference to the other.\u003C\u002Fp>\n\n\u003Cp>The signs are significant because these values act as margins from the current boundary. Positive left and right values move those edges inward, while negative top and bottom values extend those edges outward. For Letter-to-A4 conversion, the target becomes narrower and taller, so the centered calculation applies \u003Ccode>8.5\u003C\u002Fcode> to both horizontal sides and \u003Ccode>-25\u003C\u002Fcode> to both vertical sides. This explicit Letter-to-A4 calculation can be reused wherever the same source and target page dimensions apply.\u003C\u002Fp>\n\n\u003Cp>Use the \u003Ccode>pages\u003C\u002Fcode> parameter when only part of the document needs a new boundary. A long document may contain covers, foldouts, or attachments that should retain their original dimensions even when the main pages are standardized.\u003C\u002Fp>\n\n\u003Ch2>Continue with the New Page Boundary\u003C\u002Fh2>\n\n\u003Cp>After a successful response, download the output or pass its resource ID into the next pdfRest step. Approved page-box settings can account for annotations, bleed, trim marks, or nonstandard CropBox values, allowing each document template to move through a consistent resizing and delivery path.\u003C\u002Fp>\n\n\u003Cp>Check the HTTP status and returned JSON before using the output. Production code should add timeouts, handle Guzzle request and connection exceptions separately from API errors, and close file streams. Keep credentials out of logs and source control.\u003C\u002Fp>\n\n\u003Cp>If the PDF is already on the pdfRest processing server, send a JSON request with its resource ID instead of uploading it again. The official \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-page-boxes-set.php\">Set Page Boxes JSON-payload PHP sample\u003C\u002Fa> shows that pattern. Use \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> to configure page-box values and review the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fset-page-boxes\">Set Page Boxes API reference\u003C\u002Fa> for current request details.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-05-30T21:25:23.000+00:00","2026-09-11T03:35:02.000+00:00","2025-05-30T21:32:53.000+00:00","Learn how to resize PDF pages using PHP with Set Page Boxes API by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-php-code\u002F#article\",\n      \"headline\": \"How to Resize PDF Pages with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-php-code\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-php-code\u002F\",\n      \"datePublished\": \"2025-05-30T21:32:53.000Z\",\n      \"dateModified\": \"2026-09-10T19:31:23.947Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to resize PDF pages using PHP with Set Page Boxes API by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Set Page Boxes API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fset-page-boxes\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-page-boxes-set API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fset-page-boxes\"\n        }\n      ],\n      \"keywords\": \"PHP, Pages, Resize, Set Page Boxes\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Resize PDF Pages with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-php-code\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10454,10455,10456,10457,10458,10459],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2181,"name":2182,"slug":2183,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1939,"name":1940,"slug":1941,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1607,"name":1608,"slug":1609,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-resize-pdf-pages-with-php-code\u002F","How to Resize PDF Pages with PHP, Tutorial | pdfRest",{"id":10464,"uuid":10465,"title":10466,"slug":10467,"html":10468,"comment_id":10464,"feature_image":48,"featured":284,"visibility":1257,"created_at":10469,"updated_at":10470,"published_at":10471,"custom_excerpt":10472,"codeinjection_head":10473,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10474,"primary_tag":10481,"url":10482,"excerpt":10472,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10483,"meta_description":10472,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"683a1dbe533c9f26b94399ec","0455bb87-ee6e-445e-a4f9-26a603e01a4f","How to Resize PDF Pages with Python","how-to-resize-pdf-pages-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Resize PDF Pages with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fset-page-boxes\u002F\">Set Page Boxes API Tool\u003C\u002Fa> allows you to modify the page boxes of a PDF document, specifically the MediaBox, to control the physical dimensions of the pages. This tutorial will guide you through the process of sending an API call to the Set Page Boxes API Tool endpoint using Python to \u003Cstrong>resize all pages\u003C\u002Fstrong> of a PDF document.\u003C\u002Fp>\n\n\u003Cp>Imagine you have a PDF document where all pages need to conform to a specific standard dimension for consistent display or processing. By using the Set Page Boxes API Tool and the \"all\" range, you can efficiently \u003Cstrong>resize all PDF pages\u003C\u002Fstrong> to meet your requirements in a single API call.\u003C\u002Fp>\n\n\u003Ch2>Resize PDF Pages with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\npdf_with_page_boxes_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-page-boxes-set'\n\n# Define the MediaBox adjustments to resize all pages from Letter to A4\n# Letter: 612 x 792 points\n# A4:    595 x 842 points\ndelta_width_inward = (612 - 595) \u002F 2   # Positive margin to shrink width inward\ndelta_height_outward = (792 - 842) \u002F 2  # Negative margin to expand height outward\n\nresize_box_options = {\n    \"boxes\": [\n        {\n            \"box\": \"media\",\n            \"pages\": [\n                {\n                    \"range\": \"all\",\n                    \"left\": delta_width_inward,\n                    \"top\": delta_height_outward,\n                    \"bottom\": delta_height_outward,\n                    \"right\": delta_width_inward\n                }\n            ]\n        }\n    ]\n}\n\nmp_encoder_setBoxesPDF = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf', 'rb'), 'application\u002Fpdf'), # Replace with your file path\n        'boxes': json.dumps(resize_box_options),\n        'output' : 'resized_all_to_a4_out'\n    }\n)\n\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_setBoxesPDF.content_type,\n    'Api-Key': 'YOUR_API_KEY' # Replace with your actual API key\n}\n\nprint(\"Sending POST request to pdf-with-page-boxes-set endpoint to resize all PDF pages to A4...\")\nresponse = requests.post(pdf_with_page_boxes_endpoint_url, data=mp_encoder_setBoxesPDF, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-page-boxes-set.py\">GitHub\u003C\u002Fa> (Note: This example has been modified to focus on resizing all pages)\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code for Resizing All Pages\u003C\u002Fh2>\n\n\u003Cp>The code starts by importing the necessary libraries for making API calls and handling data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">pdf_with_page_boxes_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-page-boxes-set'\n\u003C\u002Fpre>\n\n\u003Cp>This line defines the API endpoint URL for setting page boxes.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\"># Define the MediaBox adjustments to resize all pages from Letter to A4\n# Letter: 612 x 792 points\n# A4:    595 x 842 points\ndelta_width_inward = (612 - 595) \u002F 2   # Positive margin to shrink width inward\ndelta_height_outward = (792 - 842) \u002F 2  # Negative margin to expand height outward\n\nresize_box_options = {\n    \"boxes\": [\n        {\n            \"box\": \"media\",\n            \"pages\": [\n                {\n                    \"range\": \"all\",\n                    \"left\": delta_width_inward,\n                    \"top\": delta_height_outward,\n                    \"bottom\": delta_height_outward,\n                    \"right\": delta_width_inward\n                }\n            ]\n        }\n    ]\n}\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>resize_box_options\u003C\u002Fcode> dictionary is configured to \u003Cstrong>resize all PDF pages\u003C\u002Fstrong> by adjusting the MediaBox. The \u003Ccode>\"box\"\u003C\u002Fcode> key is set to \u003Ccode>\"media\"\u003C\u002Fcode>. The key difference here is within the \u003Ccode>\"pages\"\u003C\u002Fcode> array: setting \u003Ccode>\"range\"\u003C\u002Fcode> to \u003Ccode>\"all\"\u003C\u002Fcode> instructs the API to apply these MediaBox adjustments to every page in the input PDF. The `left` and `right` margins are positive to shrink the width, and the `top` and `bottom` margins are negative (due to the coordinate system) to expand the height.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_setBoxesPDF = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf', 'rb'), 'application\u002Fpdf'), # Replace with your file path\n        'boxes': json.dumps(resize_box_options),\n        'output' : 'resized_all_to_a4_out'\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>Here, we create a \u003Ccode>MultipartEncoder\u003C\u002Fcode> to send the PDF file and the \u003Ccode>resize_box_options\u003C\u002Fcode> as multipart form data. \u003Cstrong>Make sure to replace \u003Ccode>'\u002Fpath\u002Fto\u002Fyour\u002Ffile.pdf'\u003C\u002Fcode> with the actual path to your PDF file.\u003C\u002Fstrong>\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_setBoxesPDF.content_type,\n    'Api-Key': 'YOUR_API_KEY' # Replace with your actual API key\n}\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>headers\u003C\u002Fcode> dictionary includes the necessary information for the API request, including your unique API key. \u003Cstrong>Remember to replace \u003Ccode>'YOUR_API_KEY'\u003C\u002Fcode> with your actual pdfRest API key.\u003C\u002Fstrong>\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(pdf_with_page_boxes_endpoint_url, data=mp_encoder_setBoxesPDF, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This line sends the POST request to the pdfRest API endpoint to \u003Cstrong>resize all PDF pages\u003C\u002Fstrong> using the specified MediaBox adjustments.\u003C\u002Fp>\n\n\u003Ch2>Next Steps for Resizing All PDF Pages\u003C\u002Fh2>\n\n\u003Cp>This tutorial demonstrated how to use Python and the pdfRest Set Page Boxes API Tool to \u003Cstrong>resize all pages of a PDF from US Letter to A4\u003C\u002Fstrong> by setting the MediaBox with the \u003Ccode>\"range\": \"all\"\u003C\u002Fcode> option. You can adapt the \u003Ccode>delta_width_inward\u003C\u002Fcode> and \u003Ccode>delta_height_outward\u003C\u002Fcode> calculations to resize to other dimensions. This approach efficiently applies the same resizing to every page in your document.\u003C\u002Fp>\n\n\u003Cp>To learn more about the Set Page Boxes API Tool and its capabilities, including setting other page boxes and using different page ranges, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\" target=\"_blank\">API Reference Guide\u003C\u002Fa> for detailed documentation.\u003C\u002Fp>\n\n\u003Cp>Note: This example uses a multipart API call. JSON payload examples for setting page boxes, including the MediaBox, can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-page-boxes-set.py\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-05-30T21:06:06.000+00:00","2026-09-02T18:29:28.000+00:00","2025-05-30T21:22:34.000+00:00","Learn how to use Set Page Boxes API by pdfRest to resize PDF pages with Python.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-python\u002F#article\",\n      \"headline\": \"How to Resize PDF Pages with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-python\u002F\",\n      \"datePublished\": \"2025-05-30T21:22:34.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:14.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use Set Page Boxes API by pdfRest to resize PDF pages with Python.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Set Page Boxes API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fset-page-boxes\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-page-boxes-set API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fset-page-boxes\"\n        }\n      ],\n      \"keywords\": \"Pages, Python, Resize, Set Page Boxes\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Resize PDF Pages with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-resize-pdf-pages-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10475,10476,10477,10478,10479,10480],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":2181,"name":2182,"slug":2183,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1939,"name":1940,"slug":1941,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1607,"name":1608,"slug":1609,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-resize-pdf-pages-with-python\u002F","How to Resize PDF Pages with Python, Tutorial | pdfRest",{"id":10485,"uuid":10486,"title":10487,"slug":10488,"html":10489,"comment_id":10485,"feature_image":48,"featured":284,"visibility":1257,"created_at":10490,"updated_at":10470,"published_at":10491,"custom_excerpt":10492,"codeinjection_head":10493,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10494,"primary_tag":10499,"url":10500,"excerpt":10492,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10501,"meta_description":10492,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65c26bf9533c9f26b9435ee5","69a056ac-4f33-41e8-a536-ff4ce2930ec8","How to Restrict PDF in .NET with C#","how-to-restrict-pdf-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Restrict PDF with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frestrict-pdf\u002F'>Restrict PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to programmatically apply restrictions to PDF documents. By using this tool, you can control how the PDF can be used, such as preventing editing, printing, or copying of content. For instance, if you're distributing proprietary documents and want to ensure they are not altered or copied without permission, the Restrict PDF API can help you enforce these constraints.\u003C\u002Fp>\n\n\u003Cp>This tutorial will guide you through the process of sending an API call to Restrict PDF using C#. Let's imagine you're developing a document management system and need to restrict access to sensitive financial reports before sharing them with certain stakeholders. The Restrict PDF API can be used to set a password and apply the necessary restrictions programmatically.\u003C\u002Fp>\n\n\u003Ch2>Restrict PDF with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"restricted-pdf\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"password\"));\n        multipartContent.Add(byteArrayOption, \"new_permissions_password\");\n\n        var byteArrayOption2 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"copy_content\"));\n        multipartContent.Add(byteArrayOption2, \"restrictions[]\");\n        var byteArrayOption3 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"edit_content\"));\n        multipartContent.Add(byteArrayOption3, \"restrictions[]\");\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source code reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Frestricted-pdf.cs\">pdfRest API C# Sample Code\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code snippet provided demonstrates how to make a multipart\u002Fform-data POST request to the pdfRest API's Restrict PDF endpoint using C#.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    \u002F\u002F...\n}\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>HttpClient\u003C\u002Fcode> is initialized with the base address of the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var request = new HttpRequestMessage(HttpMethod.Post, \"restricted-pdf\"))\n{\n    \u002F\u002F...\n}\n\u003C\u002Fpre>\n\n\u003Cp>A new \u003Ccode>HttpRequestMessage\u003C\u002Fcode> is created for the POST method to the \"restricted-pdf\" endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>The API key is added to the request headers. Replace \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n\u003C\u002Fpre>\n\n\u003Cp>The PDF file is read as a byte array and added to the multipart form data with the key \"file\". Replace \"\u002Fpath\u002Fto\u002Ffile.pdf\" with the path to your PDF file and \"file_name.pdf\" with the actual file name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"password\"));\nmultipartContent.Add(byteArrayOption, \"new_permissions_password\");\n\u003C\u002Fpre>\n\n\u003Cp>A new permissions password is set for the PDF. Replace \"password\" with the desired password.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption2 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"copy_content\"));\nmultipartContent.Add(byteArrayOption2, \"restrictions[]\");\n\u003C\u002Fpre>\n\n\u003Cp>Restrictions are added to the PDF. In this example, \"copy_content\" is specified to prevent copying of content. Other restrictions can be added similarly.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use C# to make an API call to the pdfRest Restrict PDF endpoint. By sending a properly formatted multipart\u002Fform-data request, you can add restrictions to a PDF document and set a permissions password. This is particularly useful when dealing with sensitive information that requires controlled distribution.\u003C\u002Fp>\n\n\u003Cp>Feel free to demo all of the pdfRest API Tools in the API Lab at \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the API Reference documentation at \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">Cloud API Reference Guide\u003C\u002Fa> for more details on how to use the API.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Frestricted-pdf.cs\">JSON Payload Example\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-06T17:27:21.000+00:00","2024-02-06T17:27:22.000+00:00","Learn how to apply PDF file restrictions protected with a permissions password using #C and the pdfRest Restrict PDF API Tool","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Restrict PDF in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-02-06T17:27:22.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:53.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to apply PDF file restrictions protected with a permissions password using #C and the pdfRest Restrict PDF API Tool\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Restrict PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frestrict-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Frestricted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Frestrict-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Restrict PDF\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Restrict PDF in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10495,10496,10497,10498],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1981,"name":1982,"slug":1983,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-restrict-pdf-in-net-with-c\u002F","How to Restrict PDF in .NET with C#, Tutorial | pdfRest",{"id":10503,"uuid":10504,"title":10505,"slug":10506,"html":10507,"comment_id":10503,"feature_image":48,"featured":284,"visibility":1257,"created_at":10508,"updated_at":10470,"published_at":10508,"custom_excerpt":10509,"codeinjection_head":10510,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10511,"primary_tag":10516,"url":10517,"excerpt":10509,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10518,"meta_description":10509,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65eb7d57533c9f26b943687f","15386329-4975-456b-a089-1aba1d16950b","How to Restrict PDF with cURL","how-to-restrict-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Restrict PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frestrict-pdf\u002F'>Restrict PDF API Tool\u003C\u002Fa> is a powerful resource for developers who need to secure their PDF documents by restricting access and permissions. This tutorial will guide you through the process of making an API call to the Restrict PDF endpoint using cURL, a versatile command-line tool used for transferring data with URLs. By leveraging this API, you can programmatically apply restrictions to your PDF files, enhancing their security and ensuring that only authorized users can perform certain actions.\u003C\u002Fp>\n\n\u003Cp>Imagine you are distributing a PDF document containing sensitive information. You might want to restrict the ability to print, copy, or edit the content to prevent unauthorized sharing or alterations. The Restrict PDF API allows you to set a permissions password on your PDF file, ensuring that only users with the correct password can change the document's restrictions. This is particularly useful for businesses that handle confidential reports, legal documents, or proprietary research papers.\u003C\u002Fp>\n\n\u003Ch2>Restrict PDF with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Frestricted-pdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\" \\\n  -F \"new_permissions_password=password\"\n\u003C\u002Fpre>\n\n\u003Cp>Refer to the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Frestricted-pdf.sh\">source code\u003C\u002Fa> for this example.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This cURL command is used to make a POST request to the Restrict PDF endpoint:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Frestricted-pdf\"\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>-X POST\u003C\u002Fcode> flag specifies that we are making a POST request, which is required for creating or updating resources.\u003C\u002Fp>\n\n\u003Cp>Headers are set to accept JSON responses and to indicate the content type:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\n-H \"Content-Type: multipart\u002Fform-data\"\n\u003C\u002Fpre>\n\n\u003Cp>The API key is provided for authentication:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>The file to be restricted is attached:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>-F\u003C\u002Fcode> flag is used for multipart\u002Fform-data content, which allows you to upload files. Replace \u003Ccode>\u002Fpath\u002Fto\u002Ffile\u003C\u002Fcode> with the actual file path.\u003C\u002Fp>\n\n\u003Cp>The desired output filename is specified:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>And finally, the new permissions password is set:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"new_permissions_password=password\"\n\u003C\u002Fpre>\n\n\u003Cp>Replace \u003Ccode>password\u003C\u002Fcode> with the password you want to use to restrict the PDF.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you have learned how to use cURL to call the Restrict PDF API, which allows you to apply restrictions to a PDF document. This is just one of the many features offered by the pdfRest API. To explore more possibilities and to demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on all available endpoints and parameters, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found in our \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Frestricted-pdf.sh\">GitHub repo\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-08T21:04:23.000+00:00","Learn how to apply PDF file restrictions with Restrict PDF API Tool from pdfRest with cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Restrict PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-curl\u002F\",\n      \"datePublished\": \"2024-03-08T21:04:23.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:42.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to apply PDF file restrictions with Restrict PDF API Tool from pdfRest with cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Restrict PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frestrict-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Frestricted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Frestrict-pdf\"\n        }\n      ],\n      \"keywords\": \"Restrict PDF, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Restrict PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10512,10513,10514,10515],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1981,"name":1982,"slug":1983,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-restrict-pdf-with-curl\u002F","How to Restrict PDF with cURL, Tutorial | pdfRest",{"id":10520,"uuid":10521,"title":10522,"slug":10523,"html":10524,"comment_id":10520,"feature_image":48,"featured":284,"visibility":1257,"created_at":10525,"updated_at":10526,"published_at":10525,"custom_excerpt":10527,"codeinjection_head":10528,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10529,"primary_tag":10534,"url":10535,"excerpt":10527,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10536,"meta_description":10527,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65eb8380533c9f26b94368b6","c26f053a-91cb-42cc-9bd7-df6ce7427570","How to Restrict PDF with Java","how-to-restrict-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Restrict PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frestrict-pdf\u002F'>Restrict PDF API Tool\u003C\u002Fa> is a powerful resource that allows developers to programmatically apply restrictions to PDF documents. This tool can be integrated into Java applications to automate the process of securing PDF files by setting permissions and passwords. This tutorial will demonstrate how to send an API call to the Restrict PDF endpoint using Java, ensuring that your PDF files are protected according to your specific needs.\u003C\u002Fp>\n\n\u003Cp>You might want to restrict a PDF document to prevent unauthorized printing, copying, or editing. For instance, a company distributing confidential financial reports might use the Restrict PDF API to ensure that the documents can only be viewed by the intended recipients and cannot be altered or printed without permission. By using this API, the company can maintain the integrity and confidentiality of its sensitive information.\u003C\u002Fp>\n\n\u003Ch2>Restrict PDF with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class RestrictedPDF {\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"new_permissions_password\", \"password\")\n            .addFormDataPart(\"restrictions[]\", \"print_high\")\n            .addFormDataPart(\"restrictions[]\", \"print_low\")\n            .addFormDataPart(\"restrictions[]\", \"edit_content\")\n            .addFormDataPart(\"output\", \"pdfrest_restricted\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Frestricted-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\n\u003C\u002Fpre>\n\n\u003Cp>The provided code is sourced from the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FRestrictedPDF.java\">pdfRest API samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The Java code example above demonstrates how to call the Restrict PDF API endpoint. Let's break down the key components of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\u003C\u002Fpre>\n\n\u003Cp>This line initializes the Dotenv library, which is used to load environment variables from a .env file. This is useful for not hardcoding the API key in the source code.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n    RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\nRequestBody requestBody =\n    new MultipartBody.Builder()\n        .setType(MultipartBody.FORM)\n        \u002F\u002F ... (other form data parts)\n        .build();\n\u003C\u002Fpre>\n\n\u003Cp>The code constructs a multipart request body, which includes the PDF file and the desired restrictions. The `MediaType.parse(\"application\u002Fpdf\")` specifies the content type of the file being uploaded.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Request request =\n    new Request.Builder()\n        .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n        .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Frestricted-pdf\")\n        .post(requestBody)\n        .build();\n\u003C\u002Fpre>\n\n\u003Cp>This snippet creates an HTTP request with the necessary headers, including the API key (either from the .env file or the default value), and the POST method with the constructed request body. The URL points to the Restrict PDF API endpoint.\u003C\u002Fp>\n\n\u003Cp>The request body includes form data parts such as `new_permissions_password`, which sets a password for the new restrictions, and `restrictions[]`, which specifies the restrictions to apply. The `output` form data part names the output file.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the code example and explanations provided, you've learned how to make a multipart API call to the pdfRest Restrict PDF endpoint using Java. This allows you to programmatically apply restrictions to PDF files to control how they can be used or modified.\u003C\u002Fp>\n\n\u003Cp>To explore further, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information on the pdfRest API and its capabilities, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads for the Restrict PDF API and other endpoints can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FRestrictedPDF.java\">pdfRest API samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-08T21:30:40.000+00:00","2026-09-02T18:29:29.000+00:00","Learn how to use pdfRest Restrict PDF API Tool with Java to apply file restrictions","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Restrict PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-java\u002F\",\n      \"datePublished\": \"2024-03-08T21:30:40.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:42.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Restrict PDF API Tool with Java to apply file restrictions\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Restrict PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frestrict-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Frestricted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Frestrict-pdf\"\n        }\n      ],\n      \"keywords\": \"Java, Restrict PDF\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Restrict PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10530,10531,10532,10533],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1981,"name":1982,"slug":1983,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-restrict-pdf-with-java\u002F","How to Restrict PDF with Java, Tutorial | pdfRest",{"id":10538,"uuid":10539,"title":10540,"slug":10541,"html":10542,"comment_id":10538,"feature_image":48,"featured":284,"visibility":1257,"created_at":10543,"updated_at":10526,"published_at":10543,"custom_excerpt":10544,"codeinjection_head":10545,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10546,"primary_tag":10551,"url":10552,"excerpt":10544,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10553,"meta_description":10544,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65c26eee533c9f26b9435ef5","d6b87218-40e6-48a1-9ba7-2a142d222783","How to Restrict PDF with JavaScript in NodeJS","how-to-restrict-pdf-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Restrict PDF with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frestrict-pdf\u002F'>Restrict PDF API Tool\u003C\u002Fa> allows developers to apply security restrictions to PDF documents programmatically. This tutorial will guide you through the process of sending an API call to Restrict PDF using JavaScript.\u003C\u002Fp>\n\u003Cp>Imagine you have an important document that you want to share with your team, but you need to ensure that it can't be edited or printed. Using the Restrict PDF tool, you can set permissions to prevent unauthorized actions on your PDF, keeping your document secure while distributing it.\u003C\u002Fp>\n\n\u003Ch2>Restrict PDF with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to apply security restrictions to a PDF using a permissions password.\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('new_permissions_password', 'new_example_pw');\ndata.append('restrictions[]', 'print_low'); \ndata.append('restrictions[]', 'accessibility_off');\ndata.append('restrictions[]', 'edit_content');\ndata.append('output', 'pdfrest_restricted_pdf');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Frestricted-pdf',\n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F Set headers with form data headers\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample\n\u003C\u002Fpre>\n\n\u003Cp>Reference to the code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Frestricted-pdf.js\">pdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code above demonstrates how to use the Restrict PDF API with JavaScript. Let's break down the key parts:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\u003C\u002Fpre>\n\n\u003Cp>We include the necessary modules: \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests, \u003Ccode>FormData\u003C\u002Fcode> for constructing form data payloads, and \u003Ccode>fs\u003C\u002Fcode> for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('new_permissions_password', 'new_example_pw');\ndata.append('restrictions[]', 'print_low');\ndata.append('restrictions[]', 'accessibility_off');\ndata.append('restrictions[]', 'edit_content');\ndata.append('output', 'pdfrest_restricted_pdf');\n\u003C\u002Fpre>\n\n\u003Cp>This section creates a new \u003Ccode>FormData\u003C\u002Fcode> object and appends the PDF file and parameters to it. The parameters include the new permissions password and the restrictions you want to apply to the PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Frestricted-pdf',\n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>config\u003C\u002Fcode> object defines the request method, URL, headers (including the API key), and the data payload.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\u003C\u002Fpre>\n\n\u003Cp>Finally, we send the request using \u003Ccode>axios\u003C\u002Fcode> and handle the response or error accordingly.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you've learned how to use JavaScript to call the pdfRest Restrict PDF API to apply security restrictions to a PDF document. This can be particularly useful for protecting sensitive information or enforcing document policies. To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. For code samples using JSON payloads, visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Frestricted-pdf.js\">pdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-06T17:39:58.000+00:00","Learn how to apply file restrictions to PDF documents with the pdfRest Restrict PDF API Tool and JavaScript","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Restrict PDF with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-02-06T17:39:58.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:53.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to apply file restrictions to PDF documents with the pdfRest Restrict PDF API Tool and JavaScript\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Restrict PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frestrict-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Frestricted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Frestrict-pdf\"\n        }\n      ],\n      \"keywords\": \"JavaScript, Restrict PDF\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Restrict PDF with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10547,10548,10549,10550],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1981,"name":1982,"slug":1983,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-restrict-pdf-with-javascript-in-nodejs\u002F","How to Restrict PDF with JavaScript in NodeJS, Tutorial | pdfRest",{"id":10555,"uuid":10556,"title":10557,"slug":10558,"html":10559,"comment_id":10555,"feature_image":48,"featured":284,"visibility":1257,"created_at":10560,"updated_at":5858,"published_at":10560,"custom_excerpt":10561,"codeinjection_head":10562,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10563,"primary_tag":10568,"url":10569,"excerpt":10561,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10570,"meta_description":10561,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65c2738f533c9f26b9435ffd","4169f4d0-5792-4578-abb8-17a2774a020d","How to Restrict PDF with PHP","how-to-restrict-pdf-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Restrict PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frestrict-pdf\u002F\">Restrict PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to programmatically apply restrictions to PDF documents. This tutorial will guide you through the process of making an API call to the Restrict PDF tool using PHP.\u003C\u002Fp>\n\n\u003Cp>By integrating this functionality into your applications, you can, for example, prevent unauthorized printing or copying of sensitive documents, ensuring that only intended recipients can interact with the content in predefined ways.\u003C\u002Fp>\n\n\u003Ch2>Restrict PDF with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_restricted_pdf'\n    ],\n    [\n      'name' => 'new_permissions_password',\n      'contents' => 'new_example_pw'\n    ],\n    [\n      'name' => 'restrictions[]',\n      'contents' => 'print_low'\n    ],\n    [\n      'name' => 'restrictions[]',\n      'contents' => 'accessibility_off'\n    ],\n    [\n      'name' => 'restrictions[]',\n      'contents' => 'edit_content'\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Frestricted-pdf', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Frestricted-pdf.php\">pdfRest API samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code above demonstrates how to use the Guzzle HTTP client in PHP to make a multipart\u002Fform-data POST request to the pdfRest API to restrict a PDF file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\u003C\u002Fpre>\n\n\u003Cp>This snippet includes the necessary classes for making HTTP requests and handling file streams.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>$headers\u003C\u002Fcode> array contains the API key required for authentication with the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$options = [\n  'multipart' => [\n    \u002F\u002F ...multipart form fields...\n  ]\n];\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>$options\u003C\u002Fcode> array defines the multipart form data, including the file to restrict, the desired output, and the restrictions to apply.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Frestricted-pdf', $headers);\n\u003C\u002Fpre>\n\n\u003Cp>A new HTTP POST request is created with the API endpoint and the headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$res = $client->sendAsync($request, $options)->wait();\necho $res->getBody();\n\u003C\u002Fpre>\n\n\u003Cp>The request is sent asynchronously, and the response body is outputted, which contains the restricted PDF.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you've learned how to use PHP to call the pdfRest Restrict PDF API to apply restrictions to a PDF document. We encourage you to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">Cloud API Reference Guide\u003C\u002Fa> for further exploration.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found in our \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Frestricted-pdf.php\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-06T17:59:43.000+00:00","Learn how to use pdfRest Restrict PDF API Tool to apply PDF file restrictions with PHP","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-php\u002F#article\",\n      \"headline\": \"How to Restrict PDF with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-php\u002F\",\n      \"datePublished\": \"2024-02-06T17:59:43.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:53.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Restrict PDF API Tool to apply PDF file restrictions with PHP\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Restrict PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frestrict-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Frestricted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Frestrict-pdf\"\n        }\n      ],\n      \"keywords\": \"PHP, Restrict PDF\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Restrict PDF with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10564,10565,10566,10567],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1981,"name":1982,"slug":1983,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-restrict-pdf-with-php\u002F","How to Restrict PDF with PHP, Tutorial | pdfRest",{"id":10572,"uuid":10573,"title":10574,"slug":10575,"html":10576,"comment_id":10572,"feature_image":48,"featured":284,"visibility":1257,"created_at":10577,"updated_at":10578,"published_at":10577,"custom_excerpt":10579,"codeinjection_head":10580,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10581,"primary_tag":10586,"url":10587,"excerpt":10579,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10588,"meta_description":10579,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65c28470533c9f26b943602f","d908b5f2-3d20-4648-8c22-0581111114b8","How to Restrict PDF with Python","how-to-restrict-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Restrict PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frestrict-pdf\u002F'>Restrict PDF API Tool\u003C\u002Fa> offers a convenient way to apply restrictions to PDF documents programmatically. This tutorial will guide you through the process of sending an API call to the Restrict PDF endpoint using Python.\u003C\u002Fp>\n\u003Cp>Imagine you have a PDF document that you want to share with others, but you need to limit their ability to print or edit the document. Using the Restrict PDF API, you can enforce these limitations, ensuring your document is used as intended.\u003C\u002Fp>\n\n\u003Ch2>Restrict PDF with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nrestricted_pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Frestricted-pdf'\n\n# The \u002Frestricted-pdf endpoint can take a single PDF file or id as input.\n# This sample demonstrates setting the permissions password to 'password' and adding restrictions.\nmp_encoder_restrictedPdf = MultipartEncoder(\n    fields=[\n        ('file', ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf')),\n        ('output', 'example_restrictedPdf_out'),\n        ('new_permissions_password', 'password'),\n        ('restrictions', 'print_high'),\n        ('restrictions', 'print_low'),\n        ('restrictions', 'edit_content')\n    ]\n)\n\n# Let's set the headers that the restricted-pdf endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_restrictedPdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to restricted-pdf endpoint...\")\nresponse = requests.post(restricted_pdf_endpoint_url, data=mp_encoder_restrictedPdf, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Frestricted-pdf.py\">pdf-rest-api-samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary modules and setting up the endpoint URL:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nrestricted_pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Frestricted-pdf'\n\u003C\u002Fpre>\n\n\u003Cp>Next, we create a \u003Ccode>MultipartEncoder\u003C\u002Fcode> object to prepare the multipart form-data payload:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_restrictedPdf = MultipartEncoder(\n    fields=[\n        ('file', ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf')),\n        ...\n    ]\n)\n\u003C\u002Fpre>\n\n\u003Cp>Each tuple in the \u003Ccode>fields\u003C\u002Fcode> list represents a form field. The 'file' field includes the file name, file object, and MIME type. The 'output' field specifies the output file name. The 'new_permissions_password' sets the password required to change permissions, and the 'restrictions' fields add various restrictions to the PDF.\u003C\u002Fp>\n\n\u003Cp>Headers are set to include the 'Accept' type, the 'Content-Type' (determined by the \u003Ccode>MultipartEncoder\u003C\u002Fcode>), and your API key:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    ...\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\u003C\u002Fpre>\n\n\u003Cp>Finally, a POST request is sent to the endpoint, and the response is handled:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(restricted_pdf_endpoint_url, data=mp_encoder_restrictedPdf, headers=headers)\n...\n\u003C\u002Fpre>\n\n\u003Cp>The response is checked for success, and the JSON response is printed if the request was successful.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following this tutorial, you've learned how to make a multipart API call to the Restrict PDF endpoint with Python. This allows you to programmatically apply restrictions to PDF documents. You can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>  and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for further exploration.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Frestricted-pdf.py\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-06T19:11:44.000+00:00","2026-09-02T18:29:30.000+00:00","Learn how to use pdfRest Restrict PDF API Tool to restrict PDF file access using Python","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Restrict PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-python\u002F\",\n      \"datePublished\": \"2024-02-06T19:11:44.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:53.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Restrict PDF API Tool to restrict PDF file access using Python\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Restrict PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Frestrict-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Frestricted-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Frestrict-pdf\"\n        }\n      ],\n      \"keywords\": \"Python, Restrict PDF\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Restrict PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-restrict-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10582,10583,10584,10585],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1981,"name":1982,"slug":1983,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-restrict-pdf-with-python\u002F","How to Restrict PDF with Python, Tutorial | pdfRest",{"id":10590,"uuid":10591,"title":10592,"slug":10593,"html":10594,"comment_id":10595,"feature_image":48,"featured":284,"visibility":1257,"created_at":10596,"updated_at":10597,"published_at":10596,"custom_excerpt":48,"codeinjection_head":10598,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10599,"primary_tag":10604,"url":10605,"excerpt":10606,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10607,"meta_description":10608,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b133c","0c4b3d2a-be77-4560-844c-9fb28acc4bd4","How to Split PDF in .NET with C#","how-to-split-pdf-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Split a PDF Apart?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F'>Split PDF API Tool\u003C\u002Fa> is a powerful resource for developers who need to programmatically split PDF documents into separate files based on page ranges. This tutorial will guide you through the process of making an API call to the Split PDF endpoint using C# to split a PDF document.\u003C\u002Fp>\n\u003Cp>One example for using this tool would be to extract specific chapters or sections from a large PDF document for separate distribution or analysis.\u003C\u002Fp>\n\n\u003Ch2>C# Code Example For Splitting a PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"split-pdf\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"1\"));\n        multipartContent.Add(byteArrayOption, \"pages[]\");\n\n        var byteArrayOption2 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"2-last\"));\n        multipartContent.Add(byteArrayOption2, \"pages[]\");\n\n        var byteArrayOption3 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"split\"));\n        multipartContent.Add(byteArrayOption3, \"output\");\n\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source of the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fsplit-pdf.cs\">pdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code snippet above demonstrates how to make a multipart\u002Fform-data POST request to the pdfRest Split PDF API endpoint using C#. Let's break down the key parts:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>This creates an instance of \u003Ccode>HttpClient\u003C\u002Fcode> with the base address set to the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>The API key is added to the request headers for authentication. Replace the placeholder with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n\u003C\u002Fpre>\n\n\u003Cp>This reads the PDF file as a byte array and adds it to the multipart form data content with the key \"file\" and a filename.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"1\"));\nmultipartContent.Add(byteArrayOption, \"pages[]\");\n\u003C\u002Fpre>\n\n\u003Cp>Here, we're specifying the pages to be split. In this case, \"1\" indicates the first page of the PDF. The \"pages[]\" key is used to pass an array of page ranges to the API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption3 = new ByteArrayContent(Encoding.UTF8.GetBytes(\"split\"));\nmultipartContent.Add(byteArrayOption3, \"output\");\n\u003C\u002Fpre>\n\n\u003Cp>This sets the output format to \"split\", which instructs the API to split the PDF into separate files.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\n\u003C\u002Fpre>\n\n\u003Cp>This sends the POST request to the API and waits for the response.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the response from the API is read as a string and printed to the console.\u003C\u002Fp>\n\n\u003Ch2>Next Steps with pdfRest\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've covered how to use C# to make an API call to the pdfRest Split PDF endpoint. We've gone through the process of constructing a multipart\u002Fform-data request, adding the necessary headers, and handling the API response. With this knowledge, developers can integrate PDF splitting functionality into their applications.\u003C\u002Fp>\n\n\u003Cp>Feel free to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa> for more information.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fsplit-pdf.cs\">pdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","657bb4f32d4014c9499b37f0","2023-12-15T02:07:47.000+00:00","2026-09-02T18:29:31.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Split PDF in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-in-net-with-c\u002F\",\n      \"datePublished\": \"2023-12-15T02:07:47.000Z\",\n      \"dateModified\": \"2026-09-01T14:24:03.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use the Split PDF API to separate pages of a PDF in your document workflows for .NET and C#. Available in the pdfRest Cloud API.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Split PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsplit-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsplit-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Split PDF\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Split PDF in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10600,10601,10602,10603],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1603,"name":1604,"slug":1605,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-split-pdf-in-net-with-c\u002F","\n\n\n\n\nWhy Split a PDF Apart?\n\n\n\nThe pdfRest Split PDF API Tool is a powerful resource for developers who need to programmatically split PDF documents into separate files based on page ranges. This tutorial will guide you through the process of making an API call to the Split PDF endpoint using C# to split a PDF document.\n\n\nOne example for using this tool would be to extract specific chapters or sections from a large PDF document for separate distribution or analysis.\n\n\n\n\nC# Code Example For Split","How to Split PDF in .NET with C#, Tutorial | pdfRest","Learn how to use the Split PDF API to separate pages of a PDF in your document workflows for .NET and C#. Available in the pdfRest Cloud API.",{"id":10610,"uuid":10611,"title":10612,"slug":10613,"html":10614,"comment_id":10610,"feature_image":48,"featured":284,"visibility":1257,"created_at":10615,"updated_at":10597,"published_at":10615,"custom_excerpt":10616,"codeinjection_head":10617,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10618,"primary_tag":10623,"url":10624,"excerpt":10616,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10625,"meta_description":10616,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65eb8302533c9f26b94368aa","258fea01-b403-4ef5-bc3b-57b5720176ec","How to Split PDF with cURL","how-to-split-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Split PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F'>Split PDF API Tool\u003C\u002Fa> is a powerful resource that enables users to programmatically split a PDF document into separate files. This tutorial will guide you through the process of sending an API call to Split PDF using cURL, a versatile command-line tool used for transferring data with URLs. By using cURL, you can easily integrate this functionality into your own applications or workflows, automating the process of splitting PDFs without the need for manual intervention.\u003C\u002Fp>\n\n\u003Cp>Imagine you have a large PDF report that you need to distribute to different departments, but each department only needs to see certain pages relevant to their work. Instead of manually extracting pages and creating multiple documents, you can use the Split PDF API to automate the task, saving time and reducing the potential for errors. This capability is particularly useful for businesses that handle large volumes of documents and need to streamline their document management processes.\u003C\u002Fp>\n\n\u003Ch2>Split PDF with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fsplit-pdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>Refer to the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fsplit-pdf.sh\">source code\u003C\u002Fa> for this example.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided cURL command is composed of several parts, each serving a specific purpose in the API call:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fsplit-pdf\"\n\u003C\u002Fpre>\n\n\u003Cp>This line specifies the HTTP method (POST) and the endpoint URL for the Split PDF API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\n\u003C\u002Fpre>\n\n\u003Cp>Here, we're setting a header to tell the server we expect to receive JSON-formatted responses.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\n\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the request body will be sent as multipart\u002Fform-data, which is necessary for uploading files.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>This is where you'll include your personal API key for authentication with the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\n\u003C\u002Fpre>\n\n\u003Cp>The '-F' flag denotes form data being sent with the request. The \"file\" parameter is used to specify the path to the PDF file you wish to split.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>The \"output\" parameter is used to define the base name for the output files. The API will append numbers to this base name to create unique filenames for the split documents.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, you have learned how to make a multipart API call to split a PDF document using cURL. This is just one of the many features available through the pdfRest API. To further explore the capabilities of pdfRest, you can demo all of the API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For a comprehensive understanding of the API and its features, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found in our \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fsplit-pdf.sh\">GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-08T21:28:34.000+00:00","Learn how to use pdfRest Split PDF API Tool with cURL to split a single PDF into multiple documents","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Split PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-curl\u002F\",\n      \"datePublished\": \"2024-03-08T21:28:34.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:42.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Split PDF API Tool with cURL to split a single PDF into multiple documents\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Split PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsplit-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsplit-pdf\"\n        }\n      ],\n      \"keywords\": \"Split PDF, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Split PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10619,10620,10621,10622],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1603,"name":1604,"slug":1605,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-split-pdf-with-curl\u002F","How to Split PDF with cURL, Tutorial | pdfRest",{"id":10627,"uuid":10628,"title":10629,"slug":10630,"html":10631,"comment_id":10627,"feature_image":48,"featured":284,"visibility":1257,"created_at":10632,"updated_at":10597,"published_at":10632,"custom_excerpt":10633,"codeinjection_head":10634,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10635,"primary_tag":10640,"url":10641,"excerpt":10633,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10642,"meta_description":10633,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65eb8455533c9f26b94368c6","d2133c5a-2194-4d67-a00c-a5557cc842cd","How to Split PDF with Java","how-to-split-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Split PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F'>Split PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to automate the process of splitting PDF files into separate documents based on page ranges. This tutorial will demonstrate how to send an API call to the Split PDF endpoint using Java, a language widely used for backend development and automation tasks. The ability to programmatically split PDFs is essential for applications that need to manage and organize large documents efficiently.\u003C\u002Fp>\n\n\u003Cp>Consider a scenario where a legal firm needs to extract specific pages from large case files to share with different departments or clients. Instead of manually selecting and extracting these pages, a Java application can use the Split PDF API to automate the process, saving time and reducing the risk of human error. This functionality is also beneficial for educational institutions, publishing houses, and any organization that handles document management and distribution.\u003C\u002Fp>\n\n\u003Ch2>Split PDF with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class SplitPDF {\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"pages[]\", \"1-3,5\")\n            .addFormDataPart(\"pages[]\", \"1-2\")\n            .addFormDataPart(\"output\", \"pdfrest_split\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fsplit-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    return new JSONObject(json).toString(4);\n  }\n}\n\u003C\u002Fpre>\n\n\u003Cp>The provided code is sourced from the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FSplitPDF.java\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The Java code example above demonstrates how to make a multipart\u002Fform-data POST request to the Split PDF API endpoint. Let's break down the key components of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">File inputFile = new File(DEFAULT_FILE_PATH);\nRequestBody inputFileRequestBody = RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n\u003C\u002Fpre>\n\n\u003Cp>This snippet creates a \u003Ccode>File\u003C\u002Fcode> object for the PDF to be split and wraps it in a \u003Ccode>RequestBody\u003C\u002Fcode>, indicating the media type as 'application\u002Fpdf'.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">RequestBody requestBody = new MultipartBody.Builder()\n    .setType(MultipartBody.FORM)\n    .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n    .addFormDataPart(\"pages[]\", \"1-3,5\")\n    .addFormDataPart(\"pages[]\", \"1-2\")\n    .addFormDataPart(\"output\", \"pdfrest_split\")\n    .build();\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>RequestBody\u003C\u002Fcode> is built using a \u003Ccode>MultipartBody.Builder\u003C\u002Fcode>. It includes the PDF file, the page ranges to split (\"1-3,5\" and \"1-2\"), and an output prefix (\"pdfrest_split\").\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Request request = new Request.Builder()\n    .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n    .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fsplit-pdf\")\n    .post(requestBody)\n    .build();\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>Request\u003C\u002Fcode> object includes the API key (retrieved from environment variables or the default value), the API endpoint URL, and the previously built request body. The API key should be kept confidential.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Response response = client.newCall(request).execute();\n\u003C\u002Fpre>\n\n\u003Cp>An \u003Ccode>OkHttpClient\u003C\u002Fcode> is used to execute the request. The response from the server is captured in a \u003Ccode>Response\u003C\u002Fcode> object.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">System.out.println(prettyJson(response.body().string()));\n\u003C\u002Fpre>\n\n\u003Cp>The response body is printed to the console in a human-readable JSON format using the \u003Ccode>prettyJson\u003C\u002Fcode> method.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the tutorial above, you've learned how to call the Split PDF API using Java to programmatically split a PDF document into separate files based on specified page ranges. This capability can be integrated into larger Java applications to automate document processing workflows.\u003C\u002Fp>\n\n\u003Cp>To explore more possibilities and experiment with the pdfRest API Tools, you can visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For a comprehensive understanding of the available endpoints and their parameters, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads for the Split PDF API and other endpoints can be found at the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FSplitPDF.java\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-08T21:34:13.000+00:00","Learn how to split a PDF into multiple documents using pdfRest Split PDF API Tool and Java","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Split PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-java\u002F\",\n      \"datePublished\": \"2024-03-08T21:34:13.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:42.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to split a PDF into multiple documents using pdfRest Split PDF API Tool and Java\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Split PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsplit-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsplit-pdf\"\n        }\n      ],\n      \"keywords\": \"Java, Split PDF\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Split PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10636,10637,10638,10639],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1603,"name":1604,"slug":1605,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-split-pdf-with-java\u002F","How to Split PDF with Java, Tutorial | pdfRest",{"id":10644,"uuid":10645,"title":10646,"slug":10647,"html":10648,"comment_id":10649,"feature_image":48,"featured":284,"visibility":1257,"created_at":10650,"updated_at":10651,"published_at":10650,"custom_excerpt":48,"codeinjection_head":10652,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10653,"primary_tag":10658,"url":10659,"excerpt":10660,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10661,"meta_description":10662,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b133d","3b52fe42-fe98-4f12-bf04-2121c1015221","How to Split PDF with JavaScript in NodeJS","how-to-split-pdf-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Split a PDF Apart and How?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F'>Split PDF API Tool\u003C\u002Fa> is a powerful resource for programmatically splitting a single PDF document into multiple separate files. This feature can be particularly useful in scenarios where you need to extract specific pages or sections from a large PDF, such as when you want to distribute individual chapters of a book or separate documents from a batch of scanned pages.\u003C\u002Fp>\n\u003Cp>In this tutorial, we will demonstrate how to send an API call to the Split PDF endpoint using JavaScript.\u003C\u002Fp>\n\n\u003Ch2>JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F**\n * This request demonstrates how to split a PDF document into three files by specifying the pages that will be included in each.\n * pages[] is an optional parameter that accepts page numbers and\u002For ranges separated by commas. In addition, pages[] supports several keywords: even, odd, and last.\n *\u002F\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('pages[]', 'even');\ndata.append('pages[]', 'odd');\ndata.append('pages[]', '1,3,4-6');\ndata.append('output', 'pdfrest_split_pdf');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fsplit-pdf', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source code reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fsplit-pdf.js\">pdf-rest-api-samples repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the JavaScript\u003C\u002Fh2>\n\n\u003Cp>The code snippet provided is a complete example of how to use the pdfRest Split PDF API with JavaScript. Let's break down each part of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\u003C\u002Fpre>\n\n\u003Cp>This section imports the required modules. \u003Ccode>axios\u003C\u002Fcode> is used for making HTTP requests, \u003Ccode>FormData\u003C\u002Fcode> is used for building form data payloads, and \u003Ccode>fs\u003C\u002Fcode> is for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('pages[]', 'even');\ndata.append('pages[]', 'odd');\ndata.append('pages[]', '1,3,4-6');\ndata.append('output', 'pdfrest_split_pdf');\n\u003C\u002Fpre>\n\n\u003Cp>Here, we create a new \u003Ccode>FormData\u003C\u002Fcode> instance and append the PDF file and parameters. The \u003Ccode>'file'\u003C\u002Fcode> field should contain the file stream of the PDF you want to split. The \u003Ccode>'pages[]'\u003C\u002Fcode> parameter is optional and allows you to specify which pages to include in each split document, supporting page numbers, ranges, and keywords like 'even', 'odd', and 'last'. The \u003Ccode>'output'\u003C\u002Fcode> field is used to specify the base name for the output files.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  \u002F\u002F ...\n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>config\u003C\u002Fcode> object contains the configuration for the axios request. The \u003Ccode>'Api-Key'\u003C\u002Fcode> header must be replaced with your actual API key from pdfRest. The \u003Ccode>data.getHeaders()\u003C\u002Fcode> method is used to correctly set multipart\u002Fform-data headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\u003C\u002Fpre>\n\n\u003Cp>The axios library is used to send the request with the specified \u003Ccode>config\u003C\u002Fcode>. Upon success, the response data is logged to the console. In case of an error, the error is logged.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial with pdfRest\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we walked through the process of making an API call to the pdfRest Split PDF endpoint using JavaScript. By following the steps outlined, you can split a PDF document into separate files based on specific pages or criteria. To explore more capabilities and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further information and documentation, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">Cloud API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fsplit-pdf.js\">pdf-rest-api-samples repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","657bb5562d4014c9499b37fa","2023-12-15T02:09:26.000+00:00","2026-09-02T18:29:32.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Split PDF with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2023-12-15T02:09:26.000Z\",\n      \"dateModified\": \"2026-09-01T14:24:03.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to separate pages of a PDF document via JavaScript by leveraging the pdfRest Split PDF API.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Split PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsplit-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsplit-pdf\"\n        }\n      ],\n      \"keywords\": \"JavaScript, Split PDF\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Split PDF with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10654,10655,10656,10657],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1603,"name":1604,"slug":1605,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-split-pdf-with-javascript-in-nodejs\u002F","\n\n\n\n\nWhy Split a PDF Apart and How?\n\n\n\nThe pdfRest Split PDF API Tool is a powerful resource for programmatically splitting a single PDF document into multiple separate files. This feature can be particularly useful in scenarios where you need to extract specific pages or sections from a large PDF, such as when you want to distribute individual chapters of a book or separate documents from a batch of scanned pages.\n\n\nIn this tutorial, we will demonstrate how to send an API call to the Split PDF ","How to Split PDF with JavaScript in NodeJS, Tutorial | pdfRest","Learn how to separate pages of a PDF document via JavaScript by leveraging the pdfRest Split PDF API.",{"id":10664,"uuid":10665,"title":10666,"slug":10667,"html":10668,"comment_id":10669,"feature_image":48,"featured":284,"visibility":1257,"created_at":10670,"updated_at":8776,"published_at":10671,"custom_excerpt":48,"codeinjection_head":10672,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10673,"primary_tag":10678,"url":10679,"excerpt":10680,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10681,"meta_description":10682,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b133b","9a191781-eb89-4461-9802-8ce895f800ca","How to Split PDF with PHP","how-to-split-pdf-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Would You Split a PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F\">Split PDF API Tool\u003C\u002Fa> is a powerful resource that allows users to split a PDF document into multiple parts programmatically. This tutorial will demonstrate how to make an API call to the Split PDF endpoint using PHP.\u003C\u002Fp>\n\n\u003Cp>The Split PDF API is useful in situations where a user needs to separate a large PDF report into individual sections for easier distribution and review.\u003C\u002Fp>\n\n\u003Ch2>PHP Code Sample to Split a PDF\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' =--> 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'pages[]',\n      'contents' => 'even'\n    ],\n    [\n      'name' => 'pages[]',\n      'contents' => 'odd'\n    ],\n    [\n      'name' => 'pages[]',\n      'contents' => '1,3,4-6'\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_split_pdf'\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fsplit-pdf', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source code reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fsplit-pdf.php\">pdf-rest-api-samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the PHP Code\u003C\u002Fh2>\n\n\u003Cp>The sample uses Guzzle and its PSR-7 utilities to construct and send the multipart request. Install Guzzle with \u003Ccode>composer require guzzlehttp\u002Fguzzle\u003C\u002Fcode> and keep Composer’s autoloader available to the script.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttpClient;\nuse GuzzleHttpPsr7Request;\nuse GuzzleHttpPsr7Utils;\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>Client\u003C\u002Fcode> sends the request, \u003Ccode>Request\u003C\u002Fcode> represents the POST operation, and \u003Ccode>Utils::tryFopen\u003C\u002Fcode> opens the PDF as a stream rather than copying it into a text value.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\u003C\u002Fpre>\n\n\u003Cp>The API key authenticates the call. Guzzle generates the multipart \u003Ccode>Content-Type\u003C\u002Fcode> and boundary from the \u003Ccode>multipart\u003C\u002Fcode> option, so they should not be hard-coded separately.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">[\n  'name' => 'file',\n  'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n  'filename' => 'file_name.pdf',\n  'headers' => ['Content-Type' => 'application\u002Fpdf']\n]\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>file\u003C\u002Fcode> part carries the source PDF. Its filename and media type allow the service to validate the uploaded input.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">[\n  'name' => 'pages[]',\n  'contents' => 'even'\n],\n[\n  'name' => 'pages[]',\n  'contents' => 'odd'\n],\n[\n  'name' => 'pages[]',\n  'contents' => '1,3,4-6'\n]\u003C\u002Fpre>\n\n\u003Cp>Each repeated \u003Ccode>pages[]\u003C\u002Fcode> field creates one output PDF, in the order supplied. Page expressions support comma-separated pages and ranges, \u003Ccode>last\u003C\u002Fcode>, reversed ranges, \u003Ccode>even\u003C\u002Fcode>, and \u003Ccode>odd\u003C\u002Fcode>. If no \u003Ccode>pages[]\u003C\u002Fcode> field is sent, each source page becomes its own single-page PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">[\n  'name' => 'output',\n  'contents' => 'pdfrest_split_pdf'\n]\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>output\u003C\u002Fcode> is the filename prefix. The service appends a sequence number and \u003Ccode>.pdf\u003C\u002Fcode> to distinguish the generated files.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fsplit-pdf', $headers);\n$res = $client->sendAsync($request, $options)->wait();\necho $res->getBody();\u003C\u002Fpre>\n\n\u003Cp>The call waits for completion and prints JSON describing the output resources. Production code should inspect the HTTP status before deserializing the success response.\u003C\u002Fp>\n\n\u003Ch2>Summarizing What We Did\u003C\u002Fh2>\n\n\u003Cp>This tutorial has walked through the process of making an API call to the Split PDF endpoint of the pdfRest API using PHP. By following these steps, a user can programmatically split PDF documents based on their requirements.\u003C\u002Fp>\n\n\u003Cp>To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fsplit-pdf.php\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","657bb4922d4014c9499b37e6","2023-12-15T02:06:10.000+00:00","2023-12-15T02:06:11.000+00:00","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-php\u002F#article\",\n      \"headline\": \"How to Split PDF with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-php\u002F\",\n      \"datePublished\": \"2023-12-15T02:06:11.000Z\",\n      \"dateModified\": \"2026-09-01T14:25:30.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use the Split PDF API tool to separate pages from a PDF. Extract particular sections of a document easily with pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Split PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsplit-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsplit-pdf\"\n        }\n      ],\n      \"keywords\": \"PHP, Split PDF\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Split PDF with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10674,10675,10676,10677],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1603,"name":1604,"slug":1605,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-split-pdf-with-php\u002F","\n\n\n\n\nWhy Would You Split a PDF with PHP?\n\n\n\nThe pdfRest Split PDF API Tool is a powerful resource that allows users to split a PDF document into multiple parts programmatically. This tutorial will demonstrate how to make an API call to the Split PDF endpoint using PHP.\n\n\n\nThe Split PDF API is useful in situations where a user needs to separate a large PDF report into individual sections for easier distribution and review.\n\n\n\n\nPHP Code Sample to Split a PDF\n\n\n\nrequire 'vendor\u002Fautoload.php';\n\nuse ","How to Split PDF with PHP, Tutorial | pdfRest","Learn how to use the Split PDF API tool to separate pages from a PDF. Extract particular sections of a document easily with pdfRest.",{"id":10684,"uuid":10685,"title":10686,"slug":10687,"html":10688,"comment_id":10689,"feature_image":48,"featured":284,"visibility":1257,"created_at":10690,"updated_at":10691,"published_at":10690,"custom_excerpt":10692,"codeinjection_head":10693,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10694,"primary_tag":10699,"url":10700,"excerpt":10692,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10701,"meta_description":10692,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b133a","358a8ee2-b9f1-41e7-94c4-2b22cc4fd09a","How to Split PDF with Python","how-to-split-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Would You Split a PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F'>Split PDF API Tool\u003C\u002Fa> is designed to help users programmatically split a PDF document into multiple parts. This tool can be particularly useful in scenarios where you need to extract specific pages from a large document, such as when you wa nt to share only a particular section of a report with a colleague or when you need to process different parts of a document separately.\u003C\u002Fp>\n\n\u003Cp>In this tutorial, we will demonstrate how to send an API call to the Split PDF endpoint using Python. We will walk through the code that makes the API call, explaining each part of the process.\u003C\u002Fp>\n\n\u003Ch2>Code Example for Splitting PDF with Python\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nsplit_pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fsplit-pdf'\n\nsplit_request_data = []\nsplit_request_data.append(('file',('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf')))\nsplit_request_data.append(('pages', '1,2,5'))\nsplit_request_data.append(('pages', '3,4'))\nsplit_request_data.append(('output', 'example_splitPdf_out'))\n\nmp_encoder_splitPdf = MultipartEncoder(\n    fields=split_request_data\n)\n\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_splitPdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\n\nprint(\"Sending POST request to split-pdf endpoint...\")\nresponse = requests.post(split_pdf_endpoint_url, data=mp_encoder_splitPdf, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>The code above is sourced from the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fsplit-pdf.py\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Python Code\u003C\u002Fh2>\n\n\u003Cp>The code starts by importing the necessary libraries:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>MultipartEncoder\u003C\u002Fcode> is used for creating a multipart\u002Fform-data payload for the POST request. The \u003Ccode>requests\u003C\u002Fcode> library is used to make the HTTP request, and the \u003Ccode>json\u003C\u002Fcode> library is used to handle JSON data.\u003C\u002Fp>\n\n\u003Cp>The endpoint URL is defined as a constant:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">split_pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fsplit-pdf'\n\u003C\u002Fpre>\n\n\u003Cp>Next, we prepare the data for the request:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">split_request_data = []\nsplit_request_data.append(('file',('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf')))\nsplit_request_data.append(('pages', '1,2,5'))\nsplit_request_data.append(('pages', '3,4'))\nsplit_request_data.append(('output', 'example_splitPdf_out'))\n\u003C\u002Fpre>\n\n\u003Cp>This data includes the PDF file to be split, the page ranges for splitting, and the output file prefix. The file is opened in binary read mode.\u003C\u002Fp>\n\n\u003Cp>Then, the \u003Ccode>MultipartEncoder\u003C\u002Fcode> is used to encode the request data:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_splitPdf = MultipartEncoder(\n    fields=split_request_data\n)\n\u003C\u002Fpre>\n\n\u003Cp>The headers for the request are set, including the 'Content-Type' from the encoder and the 'Api-Key' for authentication:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_splitPdf.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\n\u003C\u002Fpre>\n\n\u003Cp>The POST request is sent, and the response is printed:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(split_pdf_endpoint_url, data=mp_encoder_splitPdf, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>If the request is successful, the JSON response is printed; otherwise, the error text is printed:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Ch2>Summarizing How we Split the PDF with Python\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we have learned how to make an API call to the Split PDF endpoint of the pdfRest API using Python. By sending a POST request with the appropriate headers and multipart\u002Fform-data payload, we can split a PDF document into separate files based on the specified page ranges.\u003C\u002Fp>\n\n\u003Cp>To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads for the Split PDF API can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fsplit-pdf.py\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","657bb3c52d4014c9499b37dc","2023-12-15T02:02:45.000+00:00","2026-09-02T18:29:33.000+00:00","Learn how to separate a PDF into separate documents in Python with the Split PDF API tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Split PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-python\u002F\",\n      \"datePublished\": \"2023-12-15T02:02:45.000Z\",\n      \"dateModified\": \"2026-09-01T14:24:03.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to separate a PDF into separate documents in Python with the Split PDF API tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Split PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsplit-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsplit-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsplit-pdf\"\n        }\n      ],\n      \"keywords\": \"Python, Split PDF\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Split PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-split-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10695,10696,10697,10698],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1603,"name":1604,"slug":1605,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-split-pdf-with-python\u002F","How to Split PDF with Python, Tutorial | pdfRest",{"id":10703,"uuid":10704,"title":10705,"slug":10706,"html":10707,"comment_id":10703,"feature_image":48,"featured":284,"visibility":1257,"created_at":10708,"updated_at":10709,"published_at":10708,"custom_excerpt":10710,"codeinjection_head":10711,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10712,"primary_tag":10720,"url":10721,"excerpt":10710,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10722,"meta_description":10710,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"68daf1ed533c9f26b943a642","73d8959e-dc41-4aeb-91df-71c4349ad876","How to Summarize PDF Text in .NET with C#","how-to-summarize-pdf-text-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Summarize PDF Content with C# and .NET\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsummarize-pdf\u002F\">Summarize PDF API Tool\u003C\u002Fa> lets a .NET application condense a long PDF, Markdown file, or plain-text file into a shorter, structured result. It handles PDF text extraction, structure-aware conversion, and AI summarization behind one endpoint, reducing the amount of document-processing and model-integration code your team must build and maintain. Common uses include report previews, document-management dashboards, research intake, support knowledge bases, and workflows that need a quick overview before a person opens the source document.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>\u002Fsummarized-pdf-text\u003C\u002Fcode> endpoint accepts an uploaded file or a pdfRest resource ID. This example uses a multipart upload, which works well when the PDF begins on the local file system. If another pdfRest API Tool produced the input, pass its output ID instead to avoid transferring the intermediate file again.\u003C\u002Fp>\n\n\u003Cp>For example, a .NET document-review portal can generate a short overview when a lengthy vendor proposal is uploaded, allowing a reviewer to identify its main topics before opening the full file. The portal can display the summary beside the source PDF while preserving the original document as the authority for exact requirements and terms.\u003C\u002Fp>\n\n\u003Ch2>C# Summarize PDF Code Example\u003C\u002Fh2>\n\n\u003Cp>The sample reads the PDF path from the command line and the API key from the \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode> environment variable. It also supports \u003Ccode>PDFREST_URL\u003C\u002Fcode>, allowing the application to use the US Cloud API by default or the EU service when required.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">\u002F*\n * What this sample does:\n * - Summarizes PDF content via multipart\u002Fform-data.\n * - Routed from Program.cs as: `dotnet run -- summarized-pdf-text-multipart \u003Cinputfile>`.\n *\n * Setup (environment):\n * - Copy .env.example to .env\n * - Set PDFREST_API_KEY=your_api_key_here\n * - Optional: set PDFREST_URL to override the API region. For EU\u002FGDPR compliance and proximity, use:\n *     PDFREST_URL=https:\u002F\u002Feu-api.pdfrest.com\n *   For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\n * Usage:\n *   dotnet run -- summarized-pdf-text-multipart \u002Fpath\u002Fto\u002Finput.pdf\n *\n * Output:\n * - Prints the JSON response. Validation errors (args\u002Fenv) exit non-zero.\n *\u002F\n\nusing System.Text;\n\nnamespace Samples.EndpointExamples.MultipartPayload\n{\n    public static class SummarizedPdfText\n    {\n        public static async Task Execute(string[] args)\n        {\n            if (args == null || args.Length \u003C 1)\n            {\n                Console.Error.WriteLine(\"summarized-pdf-text-multipart requires \u003Cinputfile>\");\n                Environment.Exit(1);\n                return;\n            }\n            var inputPath = args[0];\n            if (!File.Exists(inputPath))\n            {\n                Console.Error.WriteLine($\"File not found: {inputPath}\");\n                Environment.Exit(1);\n                return;\n            }\n            var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\n            if (string.IsNullOrWhiteSpace(apiKey))\n            {\n                Console.Error.WriteLine(\"Missing required environment variable: PDFREST_API_KEY\");\n                Environment.Exit(1);\n                return;\n            }\n            var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n\n            using (var httpClient = new HttpClient { BaseAddress = new Uri(baseUrl) })\n            using (var request = new HttpRequestMessage(HttpMethod.Post, \"summarized-pdf-text\"))\n            {\n                request.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\n                request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n                var multipartContent = new MultipartFormDataContent();\n\n                var byteArray = File.ReadAllBytes(inputPath);\n                var byteAryContent = new ByteArrayContent(byteArray);\n                multipartContent.Add(byteAryContent, \"file\", Path.GetFileName(inputPath));\n                byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Foctet-stream\");\n\n                var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"100\"));\n                multipartContent.Add(byteArrayOption, \"target_word_count\");\n\n                request.Content = multipartContent;\n                var response = await httpClient.SendAsync(request);\n                var apiResult = await response.Content.ReadAsStringAsync();\n\n                Console.WriteLine(\"API response received.\");\n                Console.WriteLine(apiResult);\n            }\n        }\n    }\n}\u003C\u002Finputfile>\u003C\u002Finputfile>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fsummarized-pdf-text.cs\">pdfRest Summarize PDF multipart C# sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Build and Send the Multipart Request\u003C\u002Fh2>\n\n\u003Cp>The code first validates that an input path was supplied, confirms that the file exists, and checks for an API key. It then creates an \u003Ccode>HttpClient\u003C\u002Fcode> with the selected base URL and an \u003Ccode>HttpRequestMessage\u003C\u002Fcode> for the \u003Ccode>summarized-pdf-text\u003C\u002Fcode> route.\u003C\u002Fp>\n\n\u003Cp>\u003Ccode>MultipartFormDataContent\u003C\u002Fcode> carries both the file and the summarization options. The sample adds the PDF as a \u003Ccode>ByteArrayContent\u003C\u002Fcode> part named \u003Ccode>file\u003C\u002Fcode> and sets \u003Ccode>target_word_count\u003C\u002Fcode> to \u003Ccode>100\u003C\u002Fcode>. That count is approximate rather than guaranteed; the default is currently 400 words when the parameter is omitted.\u003C\u002Fp>\n\n\u003Cp>For services that process large files or many concurrent requests, consider streaming the file rather than loading every byte into memory, reuse \u003Ccode>HttpClient\u003C\u002Fcode> through \u003Ccode>IHttpClientFactory\u003C\u002Fcode>, and pass a \u003Ccode>CancellationToken\u003C\u002Fcode> with an application-appropriate timeout. These changes are not necessary to understand the sample, but they are important when adapting it to a production .NET service.\u003C\u002Fp>\n\n\u003Ch2>Customize the Summary for the Application\u003C\u002Fh2>\n\n\u003Cp>The endpoint offers several controls beyond length, allowing one integration to serve different parts of an application:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Ccode>summary_format\u003C\u002Fcode> can return an overview, highlights, an abstract, bullet points, a numbered list, a table of contents, an outline, questions and answers, or action items.\u003C\u002Fli>\n\u003Cli>\u003Ccode>pages\u003C\u002Fcode> limits summarization to selected page ranges.\u003C\u002Fli>\n\u003Cli>\u003Ccode>output_format\u003C\u002Fcode> controls whether the returned text uses Markdown or plain text.\u003C\u002Fli>\n\u003Cli>\u003Ccode>output_type\u003C\u002Fcode> controls whether the result is included in JSON or provided as an output file.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>Add these values as additional multipart fields using the same pattern as \u003Ccode>target_word_count\u003C\u002Fcode>. Choose them according to how the consuming application will use the output rather than applying one format to every document. Because the API returns application-ready text or a file in the requested structure, you can minimize custom prompt construction and post-processing code.\u003C\u002Fp>\n\n\u003Ch2>Handle Successful and Failed Responses\u003C\u002Fh2>\n\n\u003Cp>The sample prints the response body for visibility. A production integration should check \u003Ccode>response.IsSuccessStatusCode\u003C\u002Fcode> before treating the body as a successful result, preserve useful API error details without exposing credentials, and validate that the response contains the field expected for the selected \u003Ccode>output_type\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cp>AI-generated summaries give reviewers a focused entry point into long documents. For legal, medical, financial, or other high-stakes work, the application can keep the source PDF directly accessible beside the summary whenever exact language or supporting context is needed. Your submitted files and data are never used to train AI models.\u003C\u002Fp>\n\n\u003Cp>See the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsummarize-pdf\">Summarize PDF API reference\u003C\u002Fa> for the current request and response schemas. A \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fsummarized-pdf-text.cs\">JSON-payload C# example\u003C\u002Fa> is also available when the input already exists as a server-side resource.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-09-29T20:54:05.000+00:00","2026-09-11T03:34:54.000+00:00","Learn how to summarize PDF text with pdfRest Summarize PDF API using C#.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Summarize PDF Text in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-in-net-with-c\u002F\",\n      \"datePublished\": \"2025-09-29T20:54:05.000Z\",\n      \"dateModified\": \"2026-09-10T19:11:01.669Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to summarize PDF text with pdfRest Summarize PDF API using C#.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Summarize PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsummarize-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsummarized-pdf-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsummarize-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, AI, Analysis, Summarize PDF, Summary\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Summarize PDF Text in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10713,10714,10715,10716,10717,10718,10719],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1314,"name":1315,"slug":1316,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1306,"name":1307,"slug":1308,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1294,"name":1295,"slug":1296,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1279,"name":1280,"slug":1281,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-summarize-pdf-text-in-net-with-c\u002F","How to Summarize PDF Text in .NET with C#, Tutorial | pdfRest",{"id":10724,"uuid":10725,"title":10726,"slug":10727,"html":10728,"comment_id":10724,"feature_image":48,"featured":284,"visibility":1257,"created_at":10729,"updated_at":10691,"published_at":10729,"custom_excerpt":10730,"codeinjection_head":10731,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10732,"primary_tag":10740,"url":10741,"excerpt":10730,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10742,"meta_description":10730,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"68daf261533c9f26b943a656","624f490d-862c-461e-abe4-a3e75d409174","How to Summarize PDF Text with cURL","how-to-summarize-pdf-text-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Summarize PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsummarize-pdf\u002F'>pdfRest Summarize PDF API Tool\u003C\u002Fa> is designed to help users extract concise summaries from PDF documents. This tool is especially useful for those who need to quickly understand the main points of lengthy documents without reading them in their entirety. This tutorial will guide you through the process of sending an API call to the Summarize PDF endpoint using cURL, a command-line tool for transferring data with URLs.\u003C\u002Fp>\n\n\u003Cp>Imagine you're a researcher who frequently deals with large volumes of academic papers. Using the Summarize PDF API, you can automate the process of summarizing these documents, saving time and allowing you to focus on more critical tasks. By integrating this API into your workflow, you can quickly generate summaries that highlight key information, making it easier to decide which papers warrant a deeper read.\u003C\u002Fp>\n\n\u003Ch2>Summarize PDF with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">#!\u002Fbin\u002Fsh\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\ncurl -X POST \"$API_URL\u002Fsummarized-pdf-text\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"target_word_count=100\"\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fsummarized-pdf-text.sh\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The script starts by defining the \u003Ccode>API_URL\u003C\u002Fcode> variable, which is set to the US-based API endpoint \u003Ccode>\"https:\u002F\u002Fapi.pdfrest.com\"\u003C\u002Fcode>. This is the default endpoint for global users. If you're located in Europe and need GDPR compliance, you can switch to the EU-based service by uncommenting the alternate \u003Ccode>API_URL\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>curl\u003C\u002Fcode> command is used to make a POST request to the \u003Ccode>summarized-pdf-text\u003C\u002Fcode> endpoint. The \u003Ccode>-X POST\u003C\u002Fcode> option specifies the HTTP method.\u003C\u002Fp>\n\n\u003Cp>The headers are defined with the \u003Ccode>-H\u003C\u002Fcode> flag. \u003Ccode>\"Accept: application\u002Fjson\"\u003C\u002Fcode> indicates that the client expects a JSON response. \u003Ccode>\"Content-Type: multipart\u002Fform-data\"\u003C\u002Fcode> specifies the format of the request body, which is necessary for file uploads. The \u003Ccode>\"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\u003C\u002Fcode> is a placeholder for your API key, which authenticates your request.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>-F\u003C\u002Fcode> flag is used to specify form data. \u003Ccode>\"file=@\u002Fpath\u002Fto\u002Ffile\"\u003C\u002Fcode> uploads the PDF file you want to summarize. Replace \u003Ccode>\u002Fpath\u002Fto\u002Ffile\u003C\u002Fcode> with the actual path to your PDF file. \u003Ccode>\"target_word_count=100\"\u003C\u002Fcode> sets the desired word count for the summary.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use cURL to send a request to the pdfRest Summarize PDF API endpoint. This allows you to automate the process of summarizing PDF documents, which can be a significant time-saver.\u003C\u002Fp>\n\n\u003Cp>To explore more functionalities, I encourage you to try out all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on each API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. Note that this example demonstrates a multipart API call, and code samples using JSON payloads can be found \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fsummarized-pdf-text.sh\">here\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-09-29T20:56:01.000+00:00","Learn how to use cURL to summarize PDF text using pdfRest Summarize PDF API.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-curl\u002F#article\",\n      \"headline\": \"How to Summarize PDF Text with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-curl\u002F\",\n      \"datePublished\": \"2025-09-29T20:56:01.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:10.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use cURL to summarize PDF text using pdfRest Summarize PDF API.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Summarize PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsummarize-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsummarized-pdf-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsummarize-pdf\"\n        }\n      ],\n      \"keywords\": \"AI, Analysis, Summarize PDF, Summary, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Summarize PDF Text with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10733,10734,10735,10736,10737,10738,10739],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1314,"name":1315,"slug":1316,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1306,"name":1307,"slug":1308,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1294,"name":1295,"slug":1296,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1279,"name":1280,"slug":1281,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-summarize-pdf-text-with-curl\u002F","How to Summarize PDF Text with cURL, Tutorial | pdfRest",{"id":10744,"uuid":10745,"title":10746,"slug":10747,"html":10748,"comment_id":10744,"feature_image":48,"featured":284,"visibility":1257,"created_at":10749,"updated_at":10750,"published_at":10749,"custom_excerpt":10751,"codeinjection_head":10752,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10753,"primary_tag":10761,"url":10762,"excerpt":10751,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10763,"meta_description":10751,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"68daf2a6533c9f26b943a660","d640f93f-b98a-4abe-b79d-a9bf412dda77","How to Summarize PDF Text with Java","how-to-summarize-pdf-text-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Summarize PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsummarize-pdf\u002F'>pdfRest Summarize PDF API Tool\u003C\u002Fa> is a powerful service that allows developers to extract and summarize text from PDF documents programmatically. This tutorial will guide you through the process of sending an API call to the Summarize PDF endpoint using Java. By integrating this tool into your Java application, you can automate the extraction of key information from PDFs, making it easier to process and analyze document content.\u003C\u002Fp>\n\n\u003Cp>Imagine a scenario where a company receives numerous lengthy PDF reports daily. Manually reading and summarizing these reports can be time-consuming and prone to errors. By using the Summarize PDF API, the company can automatically extract concise summaries, allowing employees to quickly grasp the essential points without having to read through the entire documents. This can significantly enhance productivity and ensure that critical information is not overlooked.\u003C\u002Fp>\n\n\u003Ch2>Summarize PDF with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONObject;\n\npublic class SummarizedPDFText {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"target_word_count\", \"100\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fsummarized-pdf-text\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client = new OkHttpClient().newBuilder().build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    return new JSONObject(json).toString(4);\n  }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FSummarizedPDFText.java\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary libraries such as \u003Ccode>io.github.cdimascio.dotenv.Dotenv\u003C\u002Fcode> for environment variable management, and \u003Ccode>okhttp3\u003C\u002Fcode> for HTTP client functionalities. The \u003Ccode>org.json.JSONObject\u003C\u002Fcode> is used for JSON manipulation.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\u003C\u002Fpre>\n\n\u003Cp>This line sets the API endpoint URL. For European users, an EU-based endpoint is available for GDPR compliance.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\u003C\u002Fpre>\n\n\u003Cp>This specifies the default file path for the PDF document to be summarized. It can be overridden by providing a file path as a command-line argument.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\u003C\u002Fpre>\n\n\u003Cp>The API key is required for authentication. It can be set directly in the code or through an environment variable \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">RequestBody requestBody = new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"target_word_count\", \"100\")\n            .build();\n\u003C\u002Fpre>\n\n\u003Cp>This snippet constructs a multipart form request body. The PDF file is added as a form data part, and a target word count for the summary is specified as 100 words.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Request request = new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fsummarized-pdf-text\")\n            .post(requestBody)\n            .build();\n\u003C\u002Fpre>\n\n\u003Cp>The request is built with the API key in the header, the endpoint URL, and the multipart request body.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">OkHttpClient client = new OkHttpClient().newBuilder().build();\nResponse response = client.newCall(request).execute();\n\u003C\u002Fpre>\n\n\u003Cp>An \u003Ccode>OkHttpClient\u003C\u002Fcode> instance is created to execute the request, and the response is captured.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use Java to call the pdfRest Summarize PDF API, sending a PDF document and receiving a summarized text response. This is just one of many functionalities offered by pdfRest. We encourage you to explore all the available API tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsummarize-pdf\u002F\">API Reference Guide\u003C\u002Fa>. This example demonstrates a multipart API call. For code samples using JSON payloads, visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FSummarizedPDFText.java\">this GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-09-29T20:57:10.000+00:00","2026-09-02T18:29:34.000+00:00","Learn how to leverage pdfRest Summarize PDF API using Java for PDF text content summarization.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-java\u002F#article\",\n      \"headline\": \"How to Summarize PDF Text with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-java\u002F\",\n      \"datePublished\": \"2025-09-29T20:57:10.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:10.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to leverage pdfRest Summarize PDF API using Java for PDF text content summarization.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Summarize PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsummarize-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsummarized-pdf-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsummarize-pdf\"\n        }\n      ],\n      \"keywords\": \"AI, Analysis, Java, Summarize PDF, Summary\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Summarize PDF Text with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10754,10755,10756,10757,10758,10759,10760],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1314,"name":1315,"slug":1316,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1306,"name":1307,"slug":1308,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1294,"name":1295,"slug":1296,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1279,"name":1280,"slug":1281,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-summarize-pdf-text-with-java\u002F","How to Summarize PDF Text with Java, Tutorial | pdfRest",{"id":10765,"uuid":10766,"title":10767,"slug":10768,"html":10769,"comment_id":10765,"feature_image":48,"featured":284,"visibility":1257,"created_at":10770,"updated_at":10750,"published_at":10770,"custom_excerpt":10771,"codeinjection_head":10772,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10773,"primary_tag":10781,"url":10782,"excerpt":10771,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10783,"meta_description":10771,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"68daf24e533c9f26b943a64c","82d1f49a-5eb4-48b1-91fe-76cb139dac60","How to Summarize PDF Text with JavaScript in NodeJS","how-to-summarize-pdf-text-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Summarize PDF with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsummarize-pdf\u002F'>pdfRest Summarize PDF API Tool\u003C\u002Fa> is a powerful utility that allows developers to extract and condense the text from PDF documents using JavaScript. This tutorial will guide you through the process of sending an API call to the Summarize PDF endpoint using JavaScript. By leveraging this tool, you can efficiently handle PDF documents and extract meaningful summaries, which can be particularly useful for applications that require text analysis or content management.\u003C\u002Fp>\n\n\u003Cp>A user might utilize the Summarize PDF tool to quickly extract key points from lengthy documents, such as research papers, legal contracts, or business reports. For instance, a legal professional could use this tool to summarize lengthy legal documents, making it easier to identify crucial information without manually sifting through pages of text.\u003C\u002Fp>\n\n\u003Ch2>Summarize PDF with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to summarize text from a PDF document.\nvar axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\ndata.append(\"target_word_count\", \"100\");\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: \"post\",\n  maxBodyLength: Infinity,\n  url: apiUrl + \"\u002Fsummarized-pdf-text\",\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", \u002F\u002F Replace with your API key\n    ...data.getHeaders(),\n  },\n  data: data,\n};\n\naxios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error.response?.data || error.message);\n  });\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fsummarized-pdf-text.js\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by requiring necessary modules: \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests, \u003Ccode>form-data\u003C\u002Fcode> for handling form data, and \u003Ccode>fs\u003C\u002Fcode> for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>apiUrl\u003C\u002Fcode> variable defines the endpoint URL for the API call. By default, it uses the US-based service, but an EU-based option is available for GDPR compliance.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\u003C\u002Fpre>\n\n\u003Cp>A \u003Ccode>FormData\u003C\u002Fcode> instance is created to append the PDF file and parameters. The file path is specified, and the \u003Ccode>target_word_count\u003C\u002Fcode> parameter sets the desired word count for the summary.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\ndata.append(\"target_word_count\", \"100\");\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>config\u003C\u002Fcode> object defines the request's configuration, including the HTTP method, URL, headers, and data. The \u003Ccode>Api-Key\u003C\u002Fcode> must be replaced with a valid API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: \"post\",\n  maxBodyLength: Infinity,\n  url: apiUrl + \"\u002Fsummarized-pdf-text\",\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", \u002F\u002F Replace with your API key\n    ...data.getHeaders(),\n  },\n  data: data,\n};\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>axios\u003C\u002Fcode> function sends the request, handling the response or any errors encountered during the process.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error.response?.data || error.message);\n  });\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to make an API call to the pdfRest Summarize PDF endpoint using JavaScript. This allows you to extract concise summaries from PDF documents efficiently. To explore more functionalities, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fsummarized-pdf-text.js\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-09-29T20:55:42.000+00:00","Learn how to use pdfRest Summarize PDF API with JavaScript to summarize PDF text content.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Summarize PDF Text with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2025-09-29T20:55:42.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:10.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Summarize PDF API with JavaScript to summarize PDF text content.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Summarize PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsummarize-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsummarized-pdf-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsummarize-pdf\"\n        }\n      ],\n      \"keywords\": \"AI, Analysis, JavaScript, Summarize PDF, Summary\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Summarize PDF Text with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10774,10775,10776,10777,10778,10779,10780],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1314,"name":1315,"slug":1316,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1294,"name":1295,"slug":1296,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1306,"name":1307,"slug":1308,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1279,"name":1280,"slug":1281,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-summarize-pdf-text-with-javascript-in-nodejs\u002F","How to Summarize PDF Text with JavaScript in NodeJS, Tutorial | pdfRest",{"id":10785,"uuid":10786,"title":10787,"slug":10788,"html":10789,"comment_id":10785,"feature_image":48,"featured":284,"visibility":1257,"created_at":10790,"updated_at":10791,"published_at":10790,"custom_excerpt":10792,"codeinjection_head":10793,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10794,"primary_tag":10802,"url":10803,"excerpt":10792,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10804,"meta_description":10792,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"68daf173533c9f26b943a638","ed92cc4c-9aba-43f3-8830-a23da87add26","How to Summarize PDF Text with PHP","how-to-summarize-pdf-text-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Summarize PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsummarize-pdf\u002F'>pdfRest Summarize PDF API Tool\u003C\u002Fa> is a powerful solution for developers looking to extract and condense text from PDF documents. This tutorial will guide you through the process of sending an API call to the Summarize PDF endpoint using PHP, allowing you to automate the summarization of PDF content efficiently.\u003C\u002Fp>\n\n\u003Cp>Users might need to summarize lengthy PDF documents to quickly grasp the main ideas without reading the entire document. For instance, a researcher could use this tool to summarize academic papers or reports, saving time while still gaining valuable insights from the documents.\u003C\u002Fp>\n\n\u003Ch2>Summarize PDF with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">\nrequire 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' =--> 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => 'filename.pdf',\n      'headers' => [\n        'Content-Type' => 'application\u002Fpdf'\n      ]\n    ],\n    [\n      'name' => 'target_word_count',\n      'contents' => '100'\n    ]\n  ]\n];\n\n$request = new Request('POST', $apiUrl.'\u002Fsummarized-pdf-text', $headers);\n$res = $client->sendAsync($request, $options)->wait();\necho $res->getBody();\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fsummarized-pdf-text.php\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by including the necessary libraries using Composer's autoload feature with \u003Ccode>require 'vendor\u002Fautoload.php';\u003C\u002Fcode>. It uses the Guzzle HTTP client to handle the HTTP requests.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>$apiUrl\u003C\u002Fcode> variable defines the endpoint for the API calls. By default, it uses the US-based service, but there's an option to switch to the EU-based service for GDPR compliance by uncommenting the alternative URL.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>$headers\u003C\u002Fcode> array includes the 'Api-Key', which is essential for authenticating requests. Replace 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' with your actual API key.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>$options\u003C\u002Fcode> array sets up a multipart request. It contains two main parts: the PDF file and the target word count. The 'file' part uses \u003Ccode>Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r')\u003C\u002Fcode> to read the PDF file, and you must specify the correct file path. The 'target_word_count' part specifies the desired word count for the summary.\u003C\u002Fp>\n\n\u003Cp>A \u003Ccode>Request\u003C\u002Fcode> object is created with the method 'POST', the API endpoint, and the headers. The request is then sent asynchronously with \u003Ccode>$client->sendAsync($request, $options)->wait();\u003C\u002Fcode>, and the response body is printed using \u003Ccode>echo $res->getBody();\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to make a multipart API call to the pdfRest Summarize PDF endpoint using PHP. This example demonstrated how to configure the request and handle the response.\u003C\u002Fp>\n\n\u003Cp>To explore more capabilities of pdfRest, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> to demo all available API tools. For detailed information on each API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example uses a multipart API call. For code samples using JSON payloads, visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fsummarized-pdf-text.php\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-09-29T20:52:03.000+00:00","2026-09-02T18:29:35.000+00:00","Learn how to use PHP to summarize PDF text content with the pdfRest Summarize PDF API.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-php\u002F#article\",\n      \"headline\": \"How to Summarize PDF Text with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-php\u002F\",\n      \"datePublished\": \"2025-09-29T20:52:03.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:11.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use PHP to summarize PDF text content with the pdfRest Summarize PDF API.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Summarize PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsummarize-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsummarized-pdf-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsummarize-pdf\"\n        }\n      ],\n      \"keywords\": \"AI, Analysis, PHP, Summarize PDF, Summary\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Summarize PDF Text with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10795,10796,10797,10798,10799,10800,10801],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1314,"name":1315,"slug":1316,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1294,"name":1295,"slug":1296,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1306,"name":1307,"slug":1308,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1279,"name":1280,"slug":1281,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-summarize-pdf-text-with-php\u002F","How to Summarize PDF Text with PHP, Tutorial | pdfRest",{"id":10806,"uuid":10807,"title":10808,"slug":10809,"html":10810,"comment_id":10806,"feature_image":48,"featured":284,"visibility":1257,"created_at":10811,"updated_at":10812,"published_at":10811,"custom_excerpt":10813,"codeinjection_head":10814,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10815,"primary_tag":10823,"url":10824,"excerpt":10813,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10825,"meta_description":10813,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"68daf08c533c9f26b943a62c","bbe6976e-758e-4a3c-ad6c-28cf5cba24a1","How to Summarize PDF Text with Python","how-to-summarize-pdf-text-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Summarize PDF Content in a Python Application\u003C\u002Fh2>\n\n\u003Cp>Long reports, research papers, contracts, and manuals can contain far more information than a user needs for an initial review. The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsummarize-pdf\u002F\">Summarize PDF API Tool\u003C\u002Fa> condenses PDF, Markdown, or plain-text content into a summary that a Python application can display, store, or pass into a larger workflow. The tool handles document text extraction, preserves useful structure as Markdown, and performs the summarization behind one API endpoint, so you do not have to assemble and maintain separate PDF parsing and AI integrations.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>\u002Fsummarized-pdf-text\u003C\u002Fcode> endpoint accepts either an uploaded file or the resource ID of a file already on the pdfRest processing service. Uploading a file is the simplest way to try the endpoint. Resource IDs are useful when summarization follows another pdfRest operation because the application can chain the calls without downloading and uploading the intermediate file.\u003C\u002Fp>\n\n\u003Ch2>Python Summarize PDF Code Example\u003C\u002Fh2>\n\n\u003Cp>The multipart example uses \u003Ccode>requests\u003C\u002Fcode> to send the request and \u003Ccode>requests-toolbelt\u003C\u002Fcode> to encode the PDF and parameters. Install both packages, replace the file path and API-key placeholders, and run the script from an environment that can reach the pdfRest Cloud API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\n\nendpoint_url = api_url+'\u002Fsummarized-pdf-text'\n\n# The endpoint can take a single PDF file or id as input.\nmp_encoder = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'target_word_count': '100',\n    }\n)\n\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\n\nprint(\"Sending POST request to summarized-pdf-text endpoint...\")\nresponse = requests.post(endpoint_url, data=mp_encoder, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent=2))\nelse:\n    print(response.text)\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fsummarized-pdf-text.py\">pdfRest Summarize PDF multipart Python sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Cp>If the source file already has a pdfRest resource ID, send a JSON payload instead of uploading it again as multipart data. See the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fsummarized-pdf-text.py\">Summarize PDF JSON-payload sample\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Control the Length and Structure of the Summary\u003C\u002Fh2>\n\n\u003Cp>The sample sets \u003Ccode>target_word_count\u003C\u002Fcode> to \u003Ccode>100\u003C\u002Fcode>. This value is a target rather than an exact limit; the generated result may be somewhat shorter or longer when that produces a more coherent summary. If the parameter is omitted, the current default is 400 words.\u003C\u002Fp>\n\n\u003Cp>Additional parameters let you tailor the result to the application instead of accepting one generic block of summary text:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>Use \u003Ccode>summary_format\u003C\u002Fcode> to request an overview, highlights, an abstract, bullet points, a numbered list, a table of contents, an outline, questions and answers, or action items.\u003C\u002Fli>\n\u003Cli>Use \u003Ccode>pages\u003C\u002Fcode> to summarize only the relevant page ranges, such as the body of a report without its cover pages or appendices.\u003C\u002Fli>\n\u003Cli>Use \u003Ccode>output_format\u003C\u002Fcode> to choose structured Markdown or plain text.\u003C\u002Fli>\n\u003Cli>Use \u003Ccode>output_type\u003C\u002Fcode> to receive the summary in the JSON response or as a downloadable output file.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>For example, an internal research portal might request an abstract, while a meeting-document workflow could request action items. A knowledge-base application may prefer Markdown because headings and lists are ready to render. These controls make the same endpoint useful across several products and workflows without requiring prompt engineering or custom formatting logic for each one.\u003C\u002Fp>\n\n\u003Ch2>Handle the API Response in Python\u003C\u002Fh2>\n\n\u003Cp>The sample checks \u003Ccode>response.ok\u003C\u002Fcode> before parsing JSON. In production, also set an appropriate timeout, catch network exceptions, and log the HTTP status and a safe error message when a request fails. Avoid printing API keys, source documents, or sensitive summary content into shared logs.\u003C\u002Fp>\n\n\u003Cp>Inspect the response structure before reading a summary field, especially if your application allows callers to change \u003Ccode>output_type\u003C\u002Fcode>. When a file is returned, store the output ID or download URL according to the application's retention and access-control requirements. When summary text is returned inline, validate that the expected field is present before displaying or saving it.\u003C\u002Fp>\n\n\u003Ch2>Present Summaries with Source Context\u003C\u002Fh2>\n\n\u003Cp>Summaries accelerate review by giving readers a focused orientation to longer material. For legal, medical, financial, or other high-stakes uses, an application can display the summary beside a link to the source PDF, making exact wording and supporting context immediately available when needed.\u003C\u002Fp>\n\n\u003Cp>Summarize PDF converts the document content to Markdown before summarization so headings, lists, and other structure can provide richer context. Your submitted files and data are never used to train AI models. Current summarization parameters and response schemas are documented in the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsummarize-pdf\">Summarize PDF API reference\u003C\u002Fa>, and you can generate requests in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> before adding the call to your application.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-09-29T20:48:12.000+00:00","2026-09-11T03:34:53.000+00:00","Learn how to use pdfRest Summarize PDF API to generate summaries of PDF text content with Python.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-python\u002F#article\",\n      \"headline\": \"How to Summarize PDF Text with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-python\u002F\",\n      \"datePublished\": \"2025-09-29T20:48:12.000Z\",\n      \"dateModified\": \"2026-09-10T18:59:32.275Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Summarize PDF API to generate summaries of PDF text content with Python.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Summarize PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fsummarize-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fsummarized-pdf-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fsummarize-pdf\"\n        }\n      ],\n      \"keywords\": \"AI, Analysis, Python, Summarize PDF, Summary\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Summarize PDF Text with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-summarize-pdf-text-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10816,10817,10818,10819,10820,10821,10822],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1314,"name":1315,"slug":1316,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1306,"name":1307,"slug":1308,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1294,"name":1295,"slug":1296,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1279,"name":1280,"slug":1281,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-summarize-pdf-text-with-python\u002F","How to Summarize PDF Text with Python, Tutorial | pdfRest",{"id":10827,"uuid":10828,"title":10829,"slug":10830,"html":10831,"comment_id":10827,"feature_image":48,"featured":284,"visibility":1257,"created_at":10832,"updated_at":10833,"published_at":10832,"custom_excerpt":10834,"codeinjection_head":10835,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10836,"primary_tag":10843,"url":10844,"excerpt":10834,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10845,"meta_description":10834,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"68f926fc533c9f26b943a7a2","3d799788-b447-436f-af30-20483775487a","How to Translate PDF Text in .NET with C#","how-to-translate-pdf-text-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Translate PDF Text with C#?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Ftranslate-pdf\u002F'>pdfRest Translate PDF API Tool\u003C\u002Fa> is designed to help developers seamlessly integrate PDF translation capabilities into their applications. By leveraging this API, you can send a PDF document and receive the translated text in your desired language. This tutorial will guide you through the process of making an API call to the Translate PDF endpoint using C#.\u003C\u002Fp>\n\n\u003Cp>Imagine you're working in a multinational company that frequently deals with documents in various languages. Using the Translate PDF API, you can automate the translation of these documents, ensuring that all team members, regardless of their native language, can access and understand the content. This can significantly enhance communication and collaboration across different regions.\u003C\u002Fp>\n\n\u003Ch2>Translate PDF Text with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">\u002F*\n * What this sample does:\n * - Translates PDF text via multipart\u002Fform-data.\n * - Routed from Program.cs as: `dotnet run -- translated-pdf-text-multipart \u003Cinputfile>`.\n *\n * Setup (environment):\n * - Copy .env.example to .env\n * - Set PDFREST_API_KEY=your_api_key_here\n * - Optional: set PDFREST_URL to override the API region. For EU\u002FGDPR compliance and proximity, use:\n *     PDFREST_URL=https:\u002F\u002Feu-api.pdfrest.com\n *   For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\n * Usage:\n *   dotnet run -- translated-pdf-text-multipart \u002Fpath\u002Fto\u002Finput.pdf\n *\n * Output:\n * - Prints the JSON response. Validation errors (args\u002Fenv) exit non-zero.\n *\u002F\n\nusing System.Text;\n\nnamespace Samples.EndpointExamples.MultipartPayload\n{\n    public static class TranslatedPdfText\n    {\n        public static async Task Execute(string[] args)\n        {\n            if (args == null || args.Length \u003C 1)\n            {\n                Console.Error.WriteLine(\"translated-pdf-text-multipart requires \u003Cinputfile>\");\n                Environment.Exit(1);\n                return;\n            }\n            var inputPath = args[0];\n            if (!File.Exists(inputPath))\n            {\n                Console.Error.WriteLine($\"File not found: {inputPath}\");\n                Environment.Exit(1);\n                return;\n            }\n            var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\n            if (string.IsNullOrWhiteSpace(apiKey))\n            {\n                Console.Error.WriteLine(\"Missing required environment variable: PDFREST_API_KEY\");\n                Environment.Exit(1);\n                return;\n            }\n            var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n\n            using (var httpClient = new HttpClient { BaseAddress = new Uri(baseUrl) })\n            using (var request = new HttpRequestMessage(HttpMethod.Post, \"translated-pdf-text\"))\n            {\n                request.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\n                request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n                var multipartContent = new MultipartFormDataContent();\n\n                var byteArray = File.ReadAllBytes(inputPath);\n                var byteAryContent = new ByteArrayContent(byteArray);\n                multipartContent.Add(byteAryContent, \"file\", Path.GetFileName(inputPath));\n                byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Foctet-stream\");\n\n                \u002F\u002F Translates text to American English. Format the output_language as a 2-3 character ISO 639 code, optionally with a region\u002Fscript (e.g., 'en', 'es', 'zh-Hant', 'eng-US').\n                var outLang = new ByteArrayContent(Encoding.UTF8.GetBytes(\"en-US\"));\n                multipartContent.Add(outLang, \"output_language\");\n\n                request.Content = multipartContent;\n                var response = await httpClient.SendAsync(request);\n                var apiResult = await response.Content.ReadAsStringAsync();\n\n                Console.WriteLine(\"API response received.\");\n                Console.WriteLine(apiResult);\n            }\n        }\n    }\n}\n\u003C\u002Finputfile>\u003C\u002Finputfile>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Ftranslated-pdf-text.cs\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by checking if the required arguments are provided. If not, it exits the program with an error message:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">if (args == null || args.Length \u003C 1)\n{\n    Console.Error.WriteLine(\"translated-pdf-text-multipart requires \u003Cinputfile>\");\n    Environment.Exit(1);\n    return;\n}\n\u003C\u002Finputfile>\u003C\u002Fpre>\n\n\u003Cp>Next, it verifies if the input file exists:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var inputPath = args[0];\nif (!File.Exists(inputPath))\n{\n    Console.Error.WriteLine($\"File not found: {inputPath}\");\n    Environment.Exit(1);\n    return;\n}\n\u003C\u002Fpre>\n\n\u003Cp>The code retrieves the API key from the environment variables, which is essential for authenticating the API request:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\nif (string.IsNullOrWhiteSpace(apiKey))\n{\n    Console.Error.WriteLine(\"Missing required environment variable: PDFREST_API_KEY\");\n    Environment.Exit(1);\n    return;\n}\n\u003C\u002Fpre>\n\n\u003Cp>The base URL for the API is set, defaulting to \u003Ccode>https:\u002F\u002Fapi.pdfrest.com\u003C\u002Fcode> unless overridden by an environment variable:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n\u003C\u002Fpre>\n\n\u003Cp>A new HTTP client and request are created, with the API key added to the request headers:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(baseUrl) })\nusing (var request = new HttpRequestMessage(HttpMethod.Post, \"translated-pdf-text\"))\n{\n    request.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\n    request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n\u003C\u002Fpre>\n\n\u003Cp>The PDF file is read into a byte array and added to the multipart form data content:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(inputPath);\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", Path.GetFileName(inputPath));\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Foctet-stream\");\n\u003C\u002Fpre>\n\n\u003Cp>The desired output language is specified using the ISO 639 code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var outLang = new ByteArrayContent(Encoding.UTF8.GetBytes(\"en-US\"));\nmultipartContent.Add(outLang, \"output_language\");\n\u003C\u002Fpre>\n\n\u003Cp>The request is sent, and the response is printed to the console:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\nvar apiResult = await response.Content.ReadAsStringAsync();\n\nConsole.WriteLine(\"API response received.\");\nConsole.WriteLine(apiResult);\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to make an API call to the pdfRest Translate PDF endpoint using C#. This allows you to translate PDF text into a specified language seamlessly. To further explore the capabilities of pdfRest, you can try out all the API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example demonstrates a multipart API call. For code samples using JSON payloads, visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Ftranslated-pdf-text.cs\">this GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-10-22T18:48:28.000+00:00","2026-09-02T18:29:36.000+00:00","Learn how to use the pdfRest Translate PDF API to translate PDF text to a different language with C#","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Translate PDF Text in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-in-net-with-c\u002F\",\n      \"datePublished\": \"2025-10-22T18:48:28.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:08.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use the pdfRest Translate PDF API to translate PDF text to a different language with C#\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Translate PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Ftranslate-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Ftranslated-pdf-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Ftranslate-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, AI, Translate PDF, Translation\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Translate PDF Text in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10837,10838,10839,10840,10841,10842],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1318,"name":1319,"slug":1320,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1279,"name":1280,"slug":1281,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1298,"name":1299,"slug":1300,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-translate-pdf-text-in-net-with-c\u002F","How to Translate PDF Text in .NET with C#, Tutorial | pdfRest",{"id":10847,"uuid":10848,"title":10849,"slug":10850,"html":10851,"comment_id":10847,"feature_image":48,"featured":284,"visibility":1257,"created_at":10852,"updated_at":10833,"published_at":10852,"custom_excerpt":10853,"codeinjection_head":10854,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10855,"primary_tag":10862,"url":10863,"excerpt":10853,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10864,"meta_description":10853,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"68f9278e533c9f26b943a7b6","0ddb5ee2-fed0-4062-a5ba-ba31d310bc9d","How to Translate PDF Text with cURL","how-to-translate-pdf-text-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Translate PDF Text with cURL?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Ftranslate-pdf\u002F'>pdfRest Translate PDF API Tool\u003C\u002Fa> is a powerful resource for converting the text within PDF files into different languages. This tutorial will guide you through the process of sending an API call to the Translate PDF endpoint using cURL, a command-line tool for transferring data with URLs. By leveraging this API, you can automate the translation of PDF documents, making it easier to handle multilingual content and streamline workflows.\u003C\u002Fp>\n\n\u003Cp>Imagine you are working for a global company that needs to distribute technical manuals or marketing materials in various languages. Instead of manually translating each document, you can use the Translate PDF API to quickly convert the text within your PDFs to the desired language, saving time and reducing the potential for human error.\u003C\u002Fp>\n\n\u003Ch2>Translate PDF Text with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">#!\u002Fbin\u002Fsh\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\ncurl -X POST \"$API_URL\u002Ftranslated-pdf-text\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output_language=en-US\" # Translates text to American English. Format the output_language as a 2-3 character ISO 639 code, optionally with a region\u002Fscript (e.g., 'en', 'es', 'zh-Hant', 'eng-US').\n\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Ftranslated-pdf-text.sh\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The script begins by setting the \u003Ccode>API_URL\u003C\u002Fcode> variable to the default US-based API service endpoint:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">API_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>This is the primary endpoint for global use. For European users who require GDPR compliance, you can switch to the EU-based service by uncommenting the alternative URL:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\"># API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>curl\u003C\u002Fcode> command is used to make a POST request to the \u003Ccode>\u002Ftranslated-pdf-text\u003C\u002Fcode> endpoint:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"$API_URL\u002Ftranslated-pdf-text\"\u003C\u002Fpre>\n\n\u003Cp>Several headers are included to specify the request format and authentication:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\" \\\n-H \"Content-Type: multipart\u002Fform-data\" \\\n-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>Accept\u003C\u002Fcode> header indicates that the response should be in JSON format. The \u003Ccode>Content-Type\u003C\u002Fcode> header specifies that the request body will be sent as \u003Ccode>multipart\u002Fform-data\u003C\u002Fcode>. The \u003Ccode>Api-Key\u003C\u002Fcode> header is used for authentication; replace \u003Ccode>xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\u003C\u002Fcode> with your actual API key.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>-F\u003C\u002Fcode> flag is used to specify form data. The \u003Ccode>file\u003C\u002Fcode> parameter uploads the PDF file to be translated:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\u003C\u002Fpre>\n\n\u003Cp>Replace \u003Ccode>\u002Fpath\u002Fto\u002Ffile\u003C\u002Fcode> with the actual path to your PDF file. The \u003Ccode>output_language\u003C\u002Fcode> parameter specifies the target language for translation:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output_language=en-US\"\u003C\u002Fpre>\n\n\u003Cp>Here, the text is translated to American English. The \u003Ccode>output_language\u003C\u002Fcode> should be formatted as a 2-3 character ISO 639 code, optionally with a region\u002Fscript (e.g., 'en', 'es', 'zh-Hant', 'eng-US').\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use cURL to make an API call to the pdfRest Translate PDF endpoint, allowing you to translate the text within a PDF document into another language. This can be a valuable tool for handling multilingual content efficiently.\u003C\u002Fp>\n\n\u003Cp>To explore further, try out all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. Note that this is an example of a multipart API call, and code samples using JSON payloads can be found \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Ftranslated-pdf-text.sh\">here\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-10-22T18:50:54.000+00:00","Learn how to use the pdfRest Translate PDF API with cURL to translate PDF text to a new language","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-curl\u002F#article\",\n      \"headline\": \"How to Translate PDF Text with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-curl\u002F\",\n      \"datePublished\": \"2025-10-22T18:50:54.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:08.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use the pdfRest Translate PDF API with cURL to translate PDF text to a new language\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Translate PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Ftranslate-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Ftranslated-pdf-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Ftranslate-pdf\"\n        }\n      ],\n      \"keywords\": \"AI, Translate PDF, Translation, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Translate PDF Text with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10856,10857,10858,10859,10860,10861],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1318,"name":1319,"slug":1320,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1279,"name":1280,"slug":1281,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1298,"name":1299,"slug":1300,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-translate-pdf-text-with-curl\u002F","How to Translate PDF Text with cURL, Tutorial | pdfRest",{"id":10866,"uuid":10867,"title":10868,"slug":10869,"html":10870,"comment_id":10866,"feature_image":48,"featured":284,"visibility":1257,"created_at":10871,"updated_at":10872,"published_at":10871,"custom_excerpt":10873,"codeinjection_head":10874,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10875,"primary_tag":10882,"url":10883,"excerpt":10873,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10884,"meta_description":10873,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"68f92803533c9f26b943a7c0","7023b5bc-12be-4cc5-a429-f63a9ce9a317","How to Translate PDF Text with Java","how-to-translate-pdf-text-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Translate PDF Text with Java?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Ftranslate-pdf\u002F'>pdfRest Translate PDF API Tool\u003C\u002Fa> provides a powerful way to convert the text within PDF files into different languages. This tutorial will guide you through the process of sending an API call using Java to the Translate PDF endpoint, enabling you to integrate PDF text translation capabilities into your Java applications seamlessly.\u003C\u002Fp>\n\n\u003Cp>Imagine you are a developer working on an application that processes documents for a global audience. You receive PDF documents in various languages and need to translate them into English for your team. Using the Translate PDF API, you can automate this process, saving time and reducing the potential for human error in manual translations.\u003C\u002Fp>\n\n\u003Ch2>Translate PDF Text with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONObject;\n\npublic class TranslatedPDFText {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            \u002F\u002F Translates text to American English. Format the output_language as a 2-3 character\n            \u002F\u002F ISO 639 code, optionally with a region\u002Fscript (e.g., 'en', 'es', 'zh-Hant',\n            \u002F\u002F 'eng-US').\n            .addFormDataPart(\"output_language\", \"en-US\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Ftranslated-pdf-text\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client = new OkHttpClient().newBuilder().build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    return new JSONObject(json).toString(4);\n  }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FTranslatedPDFText.java\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary libraries such as `io.github.cdimascio.dotenv` for environment variable management, `okhttp3` for HTTP requests, and `org.json` for JSON manipulation.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\u003C\u002Fpre>\n\n\u003Cp>This line sets the API endpoint URL. It defaults to the US-based service, but you can switch to the EU-based service for GDPR compliance.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\u003C\u002Fpre>\n\n\u003Cp>This specifies the default file path for the PDF to be translated. You can override this by providing a file path as a command-line argument.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\u003C\u002Fpre>\n\n\u003Cp>The API key is needed for authentication. You can set it in the environment variable `PDFREST_API_KEY` or directly in the code.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">RequestBody requestBody = new MultipartBody.Builder()\n    .setType(MultipartBody.FORM)\n    .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n    .addFormDataPart(\"output_language\", \"en-US\")\n    .build();\n\u003C\u002Fpre>\n\n\u003Cp>This snippet creates a multipart form request body. It includes the PDF file and specifies the output language using a 2-3 character ISO 639 code, with an optional region\u002Fscript.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Request request = new Request.Builder()\n    .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n    .url(API_URL + \"\u002Ftranslated-pdf-text\")\n    .post(requestBody)\n    .build();\n\u003C\u002Fpre>\n\n\u003Cp>A `Request` object is built with the API key, URL, and request body. The request is then executed using `OkHttpClient`.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use Java to make an API call to the pdfRest Translate PDF endpoint. This process allows you to automate the translation of PDF text into different languages.\u003C\u002Fp>\n\n\u003Cp>To explore more, try out the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. Note that this example demonstrates a multipart API call, and you can find code samples using JSON payloads \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FTranslatedPDFText.java\">here\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-10-22T18:52:51.000+00:00","2026-09-02T18:29:37.000+00:00","Learn how to translate PDF text to a new language in Java with the pdfRest Translate PDF API","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-java\u002F#article\",\n      \"headline\": \"How to Translate PDF Text with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-java\u002F\",\n      \"datePublished\": \"2025-10-22T18:52:51.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:08.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to translate PDF text to a new language in Java with the pdfRest Translate PDF API\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Translate PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Ftranslate-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Ftranslated-pdf-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Ftranslate-pdf\"\n        }\n      ],\n      \"keywords\": \"AI, Java, Translate PDF, Translation\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Translate PDF Text with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10876,10877,10878,10879,10880,10881],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1318,"name":1319,"slug":1320,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1279,"name":1280,"slug":1281,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1298,"name":1299,"slug":1300,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-translate-pdf-text-with-java\u002F","How to Translate PDF Text with Java, Tutorial | pdfRest",{"id":10886,"uuid":10887,"title":10888,"slug":10889,"html":10890,"comment_id":10886,"feature_image":48,"featured":284,"visibility":1257,"created_at":10891,"updated_at":10872,"published_at":10891,"custom_excerpt":10892,"codeinjection_head":10893,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10894,"primary_tag":10901,"url":10902,"excerpt":10892,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10903,"meta_description":10892,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"68f9274c533c9f26b943a7ac","98ecb402-efac-47f6-b57f-f51bc1a33f22","How to Translate PDF Text with JavaScript in NodeJS","how-to-translate-pdf-text-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Translate PDF Text with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Ftranslate-pdf\u002F'>pdfRest Translate PDF API Tool\u003C\u002Fa> is a powerful resource that allows developers to translate text within PDF documents into different languages using JavaScript. This tutorial will guide you through the process of sending an API call to the Translate PDF endpoint using JavaScript, making it easier to integrate translation capabilities into your applications.\u003C\u002Fp>\n\n\u003Cp>Imagine a scenario where a multinational corporation needs to distribute product manuals in various languages to their global customer base. By using the Translate PDF API, they can automate the translation of these manuals directly from PDF files, ensuring consistency and accuracy while saving time and resources.\u003C\u002Fp>\n\n\u003Ch2>Translate PDF Text with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to translate text from a PDF document.\nvar axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\n\u002F\u002F Translates text to American English. Format the output_language as a 2-3 character ISO 639 code, optionally with a region\u002Fscript (e.g., 'en', 'es', 'zh-Hant', 'eng-US').\ndata.append(\"output_language\", \"en-US\");\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: \"post\",\n  maxBodyLength: Infinity,\n  url: apiUrl + \"\u002Ftranslated-pdf-text\",\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", \u002F\u002F Replace with your API key\n    ...data.getHeaders(),\n  },\n  data: data,\n};\n\naxios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error.response?.data || error.message);\n  });\n\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Ftranslated-pdf-text.js\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary modules: \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests, \u003Ccode>form-data\u003C\u002Fcode> for handling form submissions, and \u003Ccode>fs\u003C\u002Fcode> for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>apiUrl\u003C\u002Fcode> variable is set to the US-based API endpoint by default. An alternative EU-based endpoint is provided for GDPR compliance, which can be used by uncommenting the respective line.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\u003C\u002Fpre>\n\n\u003Cp>A new \u003Ccode>FormData\u003C\u002Fcode> instance is created, and the PDF file is appended using \u003Ccode>fs.createReadStream\u003C\u002Fcode>. The \u003Ccode>output_language\u003C\u002Fcode> parameter specifies the target language for translation, formatted as a 2-3 character ISO 639 code.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\ndata.append(\"output_language\", \"en-US\");\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>config\u003C\u002Fcode> object defines the request parameters for \u003Ccode>axios\u003C\u002Fcode>, including the HTTP method, URL, headers (with API key), and the form data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: \"post\",\n  maxBodyLength: Infinity,\n  url: apiUrl + \"\u002Ftranslated-pdf-text\",\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    ...data.getHeaders(),\n  },\n  data: data,\n};\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>axios\u003C\u002Fcode> request is executed, and the response or error is logged to the console.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error.response?.data || error.message);\n  });\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use JavaScript to send an API call to the pdfRest Translate PDF endpoint, enabling you to translate text within PDF documents. This capability can be integrated into various applications to enhance multilingual support.\u003C\u002Fp>\n\n\u003Cp>To explore more, try out all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>. Note that this example demonstrates a multipart API call; for JSON payload examples, visit the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Ftranslated-pdf-text.js\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-10-22T18:49:48.000+00:00","Learn how to use the pdfRest Translate PDF API with JavaScript to translate PDF text to a different language","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Translate PDF Text with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2025-10-22T18:49:48.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:08.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use the pdfRest Translate PDF API with JavaScript to translate PDF text to a different language\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Translate PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Ftranslate-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Ftranslated-pdf-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Ftranslate-pdf\"\n        }\n      ],\n      \"keywords\": \"AI, JavaScript, Translate PDF, Translation\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Translate PDF Text with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10895,10896,10897,10898,10899,10900],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1318,"name":1319,"slug":1320,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1279,"name":1280,"slug":1281,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1298,"name":1299,"slug":1300,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-translate-pdf-text-with-javascript-in-nodejs\u002F","How to Translate PDF Text with JavaScript in NodeJS, Tutorial | pdfRest",{"id":10905,"uuid":10906,"title":10907,"slug":10908,"html":10909,"comment_id":10905,"feature_image":48,"featured":284,"visibility":1257,"created_at":10910,"updated_at":10872,"published_at":10910,"custom_excerpt":10911,"codeinjection_head":10912,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10913,"primary_tag":10920,"url":10921,"excerpt":10911,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10922,"meta_description":10911,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"68f926cc533c9f26b943a798","443c8791-e777-4a7e-a073-f560ebb9047b","How to Translate PDF Text with PHP","how-to-translate-pdf-text-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Translate PDF Text with PHP?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Ftranslate-pdf\u002F'>pdfRest Translate PDF API Tool\u003C\u002Fa> provides a seamless way to convert the text within a PDF document into a specified language using an API call. This tutorial will guide you through the process of sending an API request to the Translate PDF endpoint using PHP, allowing you to leverage this powerful tool in your applications.\u003C\u002Fp>\n\n\u003Cp>Imagine a scenario where a multinational company receives PDF documents in various languages. By using the Translate PDF API, they can automatically translate these documents into a common language, such as English, for easier processing and understanding by their global team. This can significantly enhance workflow efficiency and communication across different regions.\u003C\u002Fp>\n\n\u003Ch2>Translate PDF Text with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">\nrequire 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' =--> 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => 'filename.pdf',\n      'headers' => [\n        'Content-Type' => 'application\u002Fpdf'\n      ]\n    ],\n    [\n      \u002F\u002F Translates text to American English. Format the output_language as a 2-3 character ISO 639 code, optionally with a region\u002Fscript (e.g., 'en', 'es', 'zh-Hant', 'eng-US').\n      'name' => 'output_language',\n      'contents' => 'en-US'\n    ]\n  ]\n];\n\n$request = new Request('POST', $apiUrl.'\u002Ftranslated-pdf-text', $headers);\n$res = $client->sendAsync($request, $options)->wait();\necho $res->getBody();\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Ftranslated-pdf-text.php\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by including the necessary libraries using Composer's autoload feature:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">require 'vendor\u002Fautoload.php';\n\u003C\u002Fpre>\n\n\u003Cp>Next, it initializes the Guzzle HTTP client, which is used to make HTTP requests:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">use GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\u003C\u002Fpre>\n\n\u003Cp>By default, the API URL is set to the US-based endpoint:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\u003C\u002Fpre>\n\n\u003Cp>For European users, there's an option to switch to the EU-based service for GDPR compliance by uncommenting the alternative URL.\u003C\u002Fp>\n\n\u003Cp>To authenticate the API request, an API key is included in the headers:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The API request is configured to send a multipart form-data payload. The 'file' part includes the PDF file to be translated:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n'filename' => 'filename.pdf',\n'headers' => [\n  'Content-Type' => 'application\u002Fpdf'\n]\n\u003C\u002Fpre>\n\n\u003Cp>The 'output_language' specifies the desired language for translation. It uses ISO 639 codes:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">'name' => 'output_language',\n'contents' => 'en-US'\n\u003C\u002Fpre>\n\n\u003Cp>The request is then created and sent asynchronously, waiting for the response:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$request = new Request('POST', $apiUrl.'\u002Ftranslated-pdf-text', $headers);\n$res = $client->sendAsync($request, $options)->wait();\necho $res->getBody();\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to make an API call to the pdfRest Translate PDF endpoint using PHP. This allows you to translate PDF text into different languages programmatically.\u003C\u002Fp>\n\n\u003Cp>To explore more functionalities, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example demonstrates a multipart API call. You can find code samples using JSON payloads \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Ftranslated-pdf-text.php\">here\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-10-22T18:47:40.000+00:00","Learn how to translate PDF text to a different language with PHP using the pdfRest Translate PDF API","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-php\u002F#article\",\n      \"headline\": \"How to Translate PDF Text with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-php\u002F\",\n      \"datePublished\": \"2025-10-22T18:47:40.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:08.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to translate PDF text to a different language with PHP using the pdfRest Translate PDF API\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Translate PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Ftranslate-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Ftranslated-pdf-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Ftranslate-pdf\"\n        }\n      ],\n      \"keywords\": \"AI, PHP, Translate PDF, Translation\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Translate PDF Text with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10914,10915,10916,10917,10918,10919],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1318,"name":1319,"slug":1320,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1279,"name":1280,"slug":1281,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1298,"name":1299,"slug":1300,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-translate-pdf-text-with-php\u002F","How to Translate PDF Text with PHP, Tutorial | pdfRest",{"id":10924,"uuid":10925,"title":10926,"slug":10927,"html":10928,"comment_id":10924,"feature_image":48,"featured":284,"visibility":1257,"created_at":10929,"updated_at":10930,"published_at":10929,"custom_excerpt":10931,"codeinjection_head":10932,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10933,"primary_tag":10940,"url":10941,"excerpt":10931,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10942,"meta_description":10931,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"68f926bc533c9f26b943a78e","618cca72-111c-423f-830f-dfae3950f7a7","How to Translate PDF Text with Python","how-to-translate-pdf-text-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Translate PDF Text with Python?\u003C\u002Fh2>\n\n\u003Cp>The \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Ftranslate-pdf\u002F'>pdfRest Translate PDF API Tool\u003C\u002Fa> is a powerful resource for developers who need to convert PDF documents into different languages. This tutorial will guide you through the process of sending an API call to the Translate PDF endpoint using Python, allowing you to automate the translation of PDF text with ease.\u003C\u002Fp>\n\n\u003Cp>Imagine you are working in a multinational company that frequently deals with documents in various languages. Using the Translate PDF API, you can quickly translate reports, contracts, or any PDF documents into the desired language, facilitating better communication and understanding across different regions.\u003C\u002Fp>\n\n\u003Ch2>Translate PDF Text with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\n\nendpoint_url = api_url+'\u002Ftranslated-pdf-text'\n\n# The endpoint can take a single PDF file or id as input.\nmp_encoder = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        # Translates text to American English. Format the output_language as a 2-3 character ISO 639 code, optionally with a region\u002Fscript (e.g., 'en', 'es', 'zh-Hant', 'eng-US').\n        'output_language': 'en-US',\n    }\n)\n\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\n\nprint(\"Sending POST request to translated-pdf-text endpoint...\")\nresponse = requests.post(endpoint_url, data=mp_encoder, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent=2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Ftranslated-pdf-text.py\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary libraries: \u003Ccode>requests_toolbelt\u003C\u002Fcode> for handling multipart encoding, \u003Ccode>requests\u003C\u002Fcode> for making HTTP requests, and \u003Ccode>json\u003C\u002Fcode> for parsing JSON responses.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">api_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\u003C\u002Fpre>\n\n\u003Cp>This sets the base URL for the API. By default, it uses the US-based service. For European users, the EU-based service can be used by uncommenting the alternative URL, ensuring GDPR compliance and potentially better performance.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">endpoint_url = api_url+'\u002Ftranslated-pdf-text'\n\u003C\u002Fpre>\n\n\u003Cp>The endpoint URL is constructed by appending \u003Ccode>\u002Ftranslated-pdf-text\u003C\u002Fcode> to the base API URL. This is the specific endpoint for translating PDF text.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output_language': 'en-US',\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>MultipartEncoder\u003C\u002Fcode> is used to create a multipart form-data payload. The \u003Ccode>fields\u003C\u002Fcode> dictionary includes:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Ccode>file\u003C\u002Fcode>: The PDF file to be translated, opened in binary read mode.\u003C\u002Fli>\n\u003Cli>\u003Ccode>output_language\u003C\u002Fcode>: Specifies the target language for translation using a 2-3 character ISO 639 code, optionally with a region\u002Fscript (e.g., 'en', 'es', 'zh-Hant').\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>headers\u003C\u002Fcode> dictionary specifies the request headers, including the \u003Ccode>Api-Key\u003C\u002Fcode> for authentication, which should be replaced with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(endpoint_url, data=mp_encoder, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This line sends a POST request to the endpoint with the encoded data and headers. The response is stored in the \u003Ccode>response\u003C\u002Fcode> variable.\u003C\u002Fp>\n\n\u003Cp>If the request is successful, the response JSON is printed in an indented format. Otherwise, the error message is displayed.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to send a request to the Translate PDF API using Python. This is just one of the many tools available through pdfRest. To explore more, try out all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further details, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example demonstrates a multipart API call. For code samples using JSON payloads, visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Ftranslated-pdf-text.py\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2025-10-22T18:47:24.000+00:00","2026-09-02T18:29:38.000+00:00","Learn how to translate PDF text to a different language using the pdfRest Translate PDF API with Python","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-python\u002F#article\",\n      \"headline\": \"How to Translate PDF Text with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-python\u002F\",\n      \"datePublished\": \"2025-10-22T18:47:24.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:09.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to translate PDF text to a different language using the pdfRest Translate PDF API with Python\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Translate PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Ftranslate-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Ftranslated-pdf-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Ftranslate-pdf\"\n        }\n      ],\n      \"keywords\": \"AI, Python, Translate PDF, Translation\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Translate PDF Text with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-translate-pdf-text-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10934,10935,10936,10937,10938,10939],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1318,"name":1319,"slug":1320,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1279,"name":1280,"slug":1281,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1298,"name":1299,"slug":1300,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-translate-pdf-text-with-python\u002F","How to Translate PDF Text with Python, Tutorial | pdfRest",{"id":10944,"uuid":10945,"title":10946,"slug":10947,"html":10948,"comment_id":10944,"feature_image":48,"featured":284,"visibility":1257,"created_at":10949,"updated_at":10930,"published_at":10949,"custom_excerpt":10950,"codeinjection_head":10951,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10952,"primary_tag":10957,"url":10958,"excerpt":10950,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10959,"meta_description":10950,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"673ed171533c9f26b9439079","507235f0-5be4-4727-ab66-ae2fce731221","How to Unzip Files in .NET with C#","how-to-unzip-files-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Unzip Files with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fzip-files\u002F'>Zip Files API Tool\u003C\u002Fa> provides a powerful and efficient way to handle file unzipping operations through API calls. By leveraging this tool, developers can automate the process of unzipping files directly from their applications using C#. This tutorial will guide you through the steps of sending an API call to unzip files using C#, showcasing how to integrate this functionality seamlessly into your applications.\u003C\u002Fp>\n\n\n\u003Cp>Imagine a scenario where you are developing an application that handles large volumes of documents received in compressed formats. You might need to extract these documents from a zip file to process them individually. Using the pdfRest Zip Files API Tool, you can automate this extraction process, ensuring that your application remains efficient and responsive.\u003C\u002Fp>\n\n\n\u003Ch2>Unzip Files with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"unzip\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Funzip.cs\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The example begins by setting up an \u003Ccode>HttpClient\u003C\u002Fcode> with a base address pointing to the pdfRest API endpoint: \u003Ccode>https:\u002F\u002Fapi.pdfrest.com\u003C\u002Fcode>. This client is used to send HTTP requests.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>Next, an \u003Ccode>HttpRequestMessage\u003C\u002Fcode> is created to send a POST request to the \"unzip\" endpoint. This endpoint is responsible for handling the zipping operation.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var request = new HttpRequestMessage(HttpMethod.Post, \"unzip\"))\n\u003C\u002Fpre>\n\n\u003Cp>The request headers are configured to include an API key, which is necessary for authentication. The API key should be replaced with a valid key obtained from your pdfRest account.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>The request accepts JSON responses, as indicated by setting the \u003Ccode>Accept\u003C\u002Fcode> header.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n\u003C\u002Fpre>\n\n\u003Cp>A \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> object is created to hold the file data. The file is read into a byte array from the specified path and added to the multipart content with a name and file name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name\");\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>Content-Type\u003C\u002Fcode> header is set to \"application\u002Fpdf\" to specify the type of file being sent.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\u003C\u002Fpre>\n\n\u003Cp>The request content is set to the multipart content, and the request is sent asynchronously. The response is read as a string and printed to the console.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\nvar apiResult = await response.Content.ReadAsStringAsync();\nConsole.WriteLine(\"API response received.\");\nConsole.WriteLine(apiResult);\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use C# to send an API call to the pdfRest Zip Files API Tool. This example demonstrated how to set up the necessary headers, create a multipart form data request, and handle the response. By following these steps, you can integrate file zipping capabilities into your applications.\u003C\u002Fp>\n\n\u003Cp>To explore more, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. Additionally, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for detailed documentation on all available endpoints and parameters.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Funzip.cs\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-21T06:21:37.000+00:00","Learn how to unzip files from .zip archives with C# using the pdfRest Zip Files API Tool","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Unzip Files in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-11-21T06:21:37.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:20.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to unzip files from .zip archives with C# using the pdfRest Zip Files API Tool\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Zip Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fzip-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Funzip API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fzip-files\"\n        }\n      ],\n      \"keywords\": \".NET, Zip Files\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Unzip Files in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10953,10954,10955,10956],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1915,"name":1916,"slug":1917,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-unzip-files-in-net-with-c\u002F","How to Unzip Files in .NET with C#, Tutorial | pdfRest",{"id":10961,"uuid":10962,"title":10963,"slug":10964,"html":10965,"comment_id":10961,"feature_image":48,"featured":284,"visibility":1257,"created_at":10966,"updated_at":10967,"published_at":10966,"custom_excerpt":10968,"codeinjection_head":10969,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10970,"primary_tag":10975,"url":10976,"excerpt":10968,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10977,"meta_description":10968,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"673ed1cb533c9f26b9439087","101868f2-2d43-42de-bb2c-1595a428588b","How to Unzip Files with cURL","how-to-unzip-files-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Unzip Files with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fzip-files\u002F'>Zip Files API Tool\u003C\u002Fa> is a powerful resource for developers looking to manage and manipulate zip files programmatically. This tutorial will demonstrate how to send an API call to unzip files using cURL, a command-line tool for transferring data with URLs. By leveraging cURL, developers can automate the process of unzipping files directly from their applications or scripts, integrating seamlessly into their workflows.\u003C\u002Fp>\n\n\u003Cp>A user might need to unzip files to extract specific documents or data for further processing. For example, a company receiving bulk data from clients might use the pdfRest Zip Files API to automatically unzip and process these files, saving time and reducing manual effort. This can be particularly useful for businesses that handle large volumes of data and need an efficient way to manage file extraction.\u003C\u002Fp>\n\n\u003Ch2>Unzip Files with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Funzip\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Funzip.sh\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided cURL command is a POST request to the pdfRest API endpoint for unzipping files. Let's break down each part of the command:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Funzip\"\u003C\u002Fpre>\n\n\u003Cp>This line specifies that the request is a POST request to \u002Funzip, which is the endpoint for the unzip operation.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the client expects a JSON response from the server. JSON is a lightweight data interchange format that's easy for humans to read and write, and easy for machines to parse and generate.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\u003C\u002Fpre>\n\n\u003Cp>This header specifies that the request body is formatted as multipart\u002Fform-data. This is typically used for file uploads, allowing the client to send files and data in a single request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\u003C\u002Fpre>\n\n\u003Cp>The API key is used to authenticate the request with the pdfRest API. It should be replaced with your actual API key. This key is essential for accessing the API's functionalities securely.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\u003C\u002Fpre>\n\n\u003Cp>This option uploads a file to the API. The '@' symbol indicates that the file is being uploaded from the local file system, and '\u002Fpath\u002Fto\u002Ffile' should be replaced with the actual path to the file you wish to unzip.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial has shown how to use cURL to make an API call to the pdfRest Zip Files API, allowing you to unzip files programmatically. By understanding each part of the cURL command, you can effectively integrate this functionality into your applications.\u003C\u002Fp>\n\n\u003Cp>To further explore the capabilities of pdfRest, you are encouraged to try out all the API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information on the API's capabilities, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example demonstrates a multipart API call. For code samples using JSON payloads, please visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Funzip.sh\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-21T06:23:07.000+00:00","2026-09-02T18:29:39.000+00:00","Learn how to use the pdfRest Zip Files API Tool with cURL to unzip files from .zip archives","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-curl\u002F#article\",\n      \"headline\": \"How to Unzip Files with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-curl\u002F\",\n      \"datePublished\": \"2024-11-21T06:23:07.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:19.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use the pdfRest Zip Files API Tool with cURL to unzip files from .zip archives\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Zip Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fzip-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Funzip API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fzip-files\"\n        }\n      ],\n      \"keywords\": \"Zip Files, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Unzip Files with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10971,10972,10973,10974],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1915,"name":1916,"slug":1917,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-unzip-files-with-curl\u002F","How to Unzip Files with cURL, Tutorial | pdfRest",{"id":10979,"uuid":10980,"title":10981,"slug":10982,"html":10983,"comment_id":10979,"feature_image":48,"featured":284,"visibility":1257,"created_at":10984,"updated_at":10967,"published_at":10984,"custom_excerpt":10985,"codeinjection_head":10986,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":10987,"primary_tag":10992,"url":10993,"excerpt":10985,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":10994,"meta_description":10985,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"673ed0ab533c9f26b943905d","ff3131c1-1090-42bc-9c73-b6e7af7c0b44","How to Unzip Files with Java","how-to-unzip-files-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Unzip Files with Java?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fzip-files\u002F'>Zip Files API Tool\u003C\u002Fa> is a powerful resource that allows developers to manage file decompression seamlessly. This tutorial will guide you through the process of sending an API call to unzip files using Java, demonstrating how to integrate this functionality into your applications.\u003C\u002Fp>\n\n\n\u003Cp>Unzipping files is essential for accessing and processing individual files within a compressed archive. For instance, a user might receive a large number of documents in a zip file from a cloud service. By unzipping these files, the user can efficiently access and manage each document, ensuring that all files are available for processing without any being overlooked.\u003C\u002Fp>\n\n\n\u003Ch2>Unzip Files with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class Unzip {\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.zip\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Funzip\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FUnzip.java\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary libraries such as \u003Ccode>Dotenv\u003C\u002Fcode> for environment variable management, \u003Ccode>OkHttpClient\u003C\u002Fcode> for HTTP requests, and \u003Ccode>JSONObject\u003C\u002Fcode> for JSON handling.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.zip\";\nprivate static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\u003C\u002Fpre>\n\n\u003Cp>These lines define default values for the file path and API key. The API key can be stored in an environment variable named \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode> or directly in the code.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\u003C\u002Fpre>\n\n\u003Cp>This line loads environment variables using the Dotenv library, allowing you to manage sensitive information like API keys securely.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">RequestBody requestBody = new MultipartBody.Builder()\n    .setType(MultipartBody.FORM)\n    .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n    .build();\n\u003C\u002Fpre>\n\n\u003Cp>Here, a multipart form request body is created, which includes the file to be unzipped. The \u003Ccode>addFormDataPart\u003C\u002Fcode> method attaches the file to the request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Request request = new Request.Builder()\n    .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n    .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Funzip\")\n    .post(requestBody)\n    .build();\n\u003C\u002Fpre>\n\n\u003Cp>This snippet constructs the HTTP POST request, setting the API endpoint URL and attaching the API key in the header.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">OkHttpClient client = new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\u003C\u002Fpre>\n\n\u003Cp>An HTTP client is instantiated with a 60-second read timeout to handle the request execution.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to send an API call to the pdfRest Zip Files endpoint using Java. This process allows you to manage file compression and decompression efficiently within your applications.\u003C\u002Fp>\n\n\u003Cp>To further explore the capabilities of pdfRest, try out all the API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FUnzip.java\">here\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-21T06:18:19.000+00:00","Learn how to use the pdfRest Zip Files API Tool to unzip files from .zip archives with Java","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-java\u002F#article\",\n      \"headline\": \"How to Unzip Files with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-java\u002F\",\n      \"datePublished\": \"2024-11-21T06:18:19.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:20.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use the pdfRest Zip Files API Tool to unzip files from .zip archives with Java\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Zip Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fzip-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Funzip API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fzip-files\"\n        }\n      ],\n      \"keywords\": \"Java, Zip Files\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Unzip Files with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[10988,10989,10990,10991],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1915,"name":1916,"slug":1917,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-unzip-files-with-java\u002F","How to Unzip Files with Java, Tutorial | pdfRest",{"id":10996,"uuid":10997,"title":10998,"slug":10999,"html":11000,"comment_id":10996,"feature_image":48,"featured":284,"visibility":1257,"created_at":11001,"updated_at":10967,"published_at":11001,"custom_excerpt":11002,"codeinjection_head":11003,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11004,"primary_tag":11009,"url":11010,"excerpt":11002,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11011,"meta_description":11002,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"673ed10a533c9f26b9439069","59d47886-fb6e-4484-8847-d3519aadb46f","How to Unzip Files with JavaScript in NodeJS","how-to-unzip-files-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Unzip Files with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fzip-files\u002F'>Zip Files API Tool\u003C\u002Fa> is a powerful resource for developers looking to manage file compression and decompression through API calls. This tutorial will guide you through the process of sending an API call to unzip files using JavaScript. By leveraging this tool, you can automate the handling of zip files within your applications, making it easier to manage and process large sets of data.\u003C\u002Fp>\n\n\u003Cp>You might use the Zip Files API to handle multiple document uploads on a web application. For instance, a user could upload a zip file containing several PDFs, and your application could automatically unzip and process each file individually. This can be particularly useful in environments where file management efficiency is crucial, such as in document management systems or data analysis platforms.\u003C\u002Fp>\n\n\u003Ch2>Unzip Files with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F**\n * This request demonstrates how to unzip a file\n *\u002F\nvar axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: \"post\",\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: \"https:\u002F\u002Fapi.pdfrest.com\u002Funzip\",\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", \u002F\u002F Replace with your API key\n    ...data.getHeaders(), \u002F\u002F set headers for the request\n  },\n  data: data, \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error);\n  });\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Funzip.js\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided code begins by importing necessary modules: \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests, \u003Ccode>form-data\u003C\u002Fcode> for handling form submissions, and \u003Ccode>fs\u003C\u002Fcode> for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\n\u003C\u002Fpre>\n\n\u003Cp>This snippet creates a new \u003Ccode>FormData\u003C\u002Fcode> instance and appends a file to it. The \u003Ccode>fs.createReadStream\u003C\u002Fcode> method is used to read the file located at \u003Ccode>\u002Fpath\u002Fto\u002Ffile\u003C\u002Fcode>. Ensure to replace this path with the actual path of your zip file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: \"post\",\n  maxBodyLength: Infinity,\n  url: \"https:\u002F\u002Fapi.pdfrest.com\u002Funzip\",\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    ...data.getHeaders(),\n  },\n  data: data,\n};\n\u003C\u002Fpre>\n\n\u003Cp>This section defines the configuration for the HTTP request. The \u003Ccode>method\u003C\u002Fcode> is set to \u003Ccode>post\u003C\u002Fcode>, and \u003Ccode>maxBodyLength\u003C\u002Fcode> is set to \u003Ccode>Infinity\u003C\u002Fcode> to accommodate large files. The \u003Ccode>url\u003C\u002Fcode> specifies the endpoint for unzipping files. The \u003Ccode>headers\u003C\u002Fcode> include an \u003Ccode>Api-Key\u003C\u002Fcode> which must be replaced with your actual API key. The \u003Ccode>data\u003C\u002Fcode> field contains the form data to be sent in the request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error);\n  });\n\u003C\u002Fpre>\n\n\u003Cp>This part sends the request using \u003Ccode>axios\u003C\u002Fcode>. If the request is successful, the response data is logged to the console. If there is an error, it is caught and logged instead.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use JavaScript to make an API call to the pdfRest Zip Files endpoint, allowing you to unzip files programmatically. This can significantly enhance your application's ability to manage and process files efficiently.\u003C\u002Fp>\n\n\u003Cp>To explore more capabilities of the pdfRest API, try out all the tools available in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed documentation, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example demonstrates a multipart API call. For code samples using JSON payloads, visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Funzip.js\">this GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-21T06:19:54.000+00:00","Learn how to unzip files from .zip archives using the pdfRest Zip Files API Tool with JavaScript","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Unzip Files with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-11-21T06:19:54.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:20.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to unzip files from .zip archives using the pdfRest Zip Files API Tool with JavaScript\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Zip Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fzip-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Funzip API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fzip-files\"\n        }\n      ],\n      \"keywords\": \"JavaScript, Zip Files\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Unzip Files with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11005,11006,11007,11008],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1915,"name":1916,"slug":1917,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-unzip-files-with-javascript-in-nodejs\u002F","How to Unzip Files with JavaScript in NodeJS, Tutorial | pdfRest",{"id":11013,"uuid":11014,"title":11015,"slug":11016,"html":11017,"comment_id":11013,"feature_image":48,"featured":284,"visibility":1257,"created_at":11018,"updated_at":11019,"published_at":11018,"custom_excerpt":11020,"codeinjection_head":11021,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11022,"primary_tag":11027,"url":11028,"excerpt":11020,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11029,"meta_description":11020,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"673ed2d7533c9f26b9439099","2ebd634a-e926-4ff8-a473-fe013c259803","How to Unzip Files with PHP","how-to-unzip-files-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Unzip Files with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fzip-files\u002F'>Zip Files API Tool\u003C\u002Fa> provides a powerful and efficient way to manage zip files through API calls. By leveraging this tool, developers can easily integrate unzip file functionalities into their PHP applications. This tutorial will guide you through the process of sending an API call to the pdfRest service to unzip files using PHP, offering a seamless and automated solution for extracting and managing compressed files.\u003C\u002Fp>\n\n\n\u003Cp>Users often need to handle large volumes of data, such as images, documents, or backups. Unzipping these files can facilitate efficient processing and access to individual files. For instance, a company might use the Zip Files API to extract daily backup files received in a compressed format, ensuring quick access and efficient data management.\u003C\u002Fp>\n\n\n\u003Ch2>Unzip Files with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">\nrequire 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\n$headers = [\n  'Api-Key' =--> 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => 'file.zip', \u002F\u002F Set the filename for the file to be processed, in this case, 'file.zip'.\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Funzip', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the unzipped content.\n\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Funzip.php\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary classes from the Guzzle HTTP client library, which is used to send HTTP requests in PHP. The \u003Ccode>require 'vendor\u002Fautoload.php';\u003C\u002Fcode> line ensures that all necessary classes are loaded.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">use GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\u003C\u002Fpre>\n\n\u003Cp>Next, a new instance of the Guzzle HTTP client is created with \u003Ccode>$client = new Client();\u003C\u002Fcode>. This client will be used to send the API request.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>$headers\u003C\u002Fcode> array is defined to include the 'Api-Key' header, which is crucial for authenticating the API request. Replace 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>$options\u003C\u002Fcode> array specifies the multipart form data for the request. The 'name' field is set to 'file', indicating the file parameter. The 'contents' field uses \u003Ccode>Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r')\u003C\u002Fcode> to open the specified file for reading. The 'filename' field sets the name of the file being uploaded, and the 'headers' array includes the 'Content-Type' header.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => 'file.zip',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ]\n  ]\n];\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>A new POST request is created with the API endpoint \u003Ccode>'https:\u002F\u002Fapi.pdfrest.com\u002Funzip'\u003C\u002Fcode> and the headers using \u003Ccode>new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Funzip', $headers);\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Funzip', $headers);\n\u003C\u002Fpre>\n\n\u003Cp>The asynchronous request is sent using \u003Ccode>$client->sendAsync($request, $options)->wait();\u003C\u002Fcode>, and the response body is outputted with \u003Ccode>echo $res->getBody();\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$res = $client->sendAsync($request, $options)->wait();\necho $res->getBody();\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial demonstrated how to use PHP to send an API call to the pdfRest service to unzip files. By following these steps, you can integrate similar functionalities into your applications, enhancing your file management capabilities.\u003C\u002Fp>\n\n\u003Cp>To explore more features and tools offered by pdfRest, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed documentation, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example showcases a multipart API call. For examples using JSON payloads, visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Funzip.php\">this GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-21T06:27:35.000+00:00","2026-09-02T18:29:40.000+00:00","Learn how to unzip .zip archives using the pdfRest Zip Files API Tool with PHP","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-php\u002F#article\",\n      \"headline\": \"How to Unzip Files with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-php\u002F\",\n      \"datePublished\": \"2024-11-21T06:27:35.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:19.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to unzip .zip archives using the pdfRest Zip Files API Tool with PHP\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Zip Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fzip-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Funzip API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fzip-files\"\n        }\n      ],\n      \"keywords\": \"PHP, Zip Files\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Unzip Files with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11023,11024,11025,11026],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1915,"name":1916,"slug":1917,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-unzip-files-with-php\u002F","How to Unzip Files with PHP, Tutorial | pdfRest",{"id":11031,"uuid":11032,"title":11033,"slug":11034,"html":11035,"comment_id":11031,"feature_image":48,"featured":284,"visibility":1257,"created_at":11036,"updated_at":11019,"published_at":11036,"custom_excerpt":11037,"codeinjection_head":11038,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11039,"primary_tag":11044,"url":11045,"excerpt":11037,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11046,"meta_description":11037,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"673ed312533c9f26b94390a3","29ac6f76-b146-452c-b915-d86edd88b120","How to Unzip Files with Python","how-to-unzip-files-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Unzip Files with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fzip-files\u002F'>Zip Files API Tool\u003C\u002Fa> offers a powerful and convenient solution for unzipping files programmatically. This tutorial will guide you through the process of sending an API call to unzip files using Python, leveraging the pdfRest API. This functionality is particularly beneficial when dealing with compressed files that need to be extracted and processed within an automated workflow.\u003C\u002Fp>\n\n\u003Cp>Users might need to unzip files for various reasons. For example, a business might receive a batch of compressed invoices that require extraction and individual processing. Automating this task through an API call can save time and reduce the potential for human error, ensuring that files are handled efficiently and consistently.\u003C\u002Fp>\n\n\u003Ch2>Unzip Files with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nunzip_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Funzip'\n\nmp_encoder_unzip = MultipartEncoder(\n    fields={\n        'file': ('file_name.zip', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fzip'),\n        'output' : 'example_out'\n    }\n)\n\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_unzip.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to unzip endpoint...\")\nresponse = requests.post(unzip_endpoint_url, data=mp_encoder_unzip, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Funzip.py\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary modules: \u003Ccode>MultipartEncoder\u003C\u002Fcode> from \u003Ccode>requests_toolbelt\u003C\u002Fcode>, and \u003Ccode>requests\u003C\u002Fcode> and \u003Ccode>json\u003C\u002Fcode> for handling HTTP requests and JSON data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">unzip_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Funzip'\n\u003C\u002Fpre>\n\n\u003Cp>This line sets the URL for the unzip endpoint of the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_unzip = MultipartEncoder(\n    fields={\n        'file': ('file_name.zip', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fzip'),\n        'output' : 'example_out'\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>MultipartEncoder\u003C\u002Fcode> is used to create a multipart\u002Fform-data payload. The \u003Ccode>fields\u003C\u002Fcode> dictionary contains:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Ccode>'file'\u003C\u002Fcode>: A tuple where the first element is the file name, the second is the file object opened in binary read mode, and the third is the MIME type.\u003C\u002Fli>\n\u003Cli>\u003Ccode>'output'\u003C\u002Fcode>: Specifies the name of the output file after extraction.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_unzip.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>headers\u003C\u002Fcode> dictionary includes:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Ccode>'Accept'\u003C\u002Fcode>: Indicates that the client expects a JSON response.\u003C\u002Fli>\n\u003Cli>\u003Ccode>'Content-Type'\u003C\u002Fcode>: Set to the content type of the \u003Ccode>MultipartEncoder\u003C\u002Fcode> instance.\u003C\u002Fli>\n\u003Cli>\u003Ccode>'Api-Key'\u003C\u002Fcode>: A placeholder for your unique API key.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-python\">response = requests.post(unzip_endpoint_url, data=mp_encoder_unzip, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This line sends a POST request to the unzip endpoint with the multipart data and headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>If the request is successful, the JSON response is printed in a formatted manner. Otherwise, the error message is displayed.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use Python to make an API call to the pdfRest Zip Files API Tool, allowing you to unzip files programmatically. This can be a valuable tool for automating file management tasks.\u003C\u002Fp>\n\n\u003Cp>To explore more, try out all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further reading and a deeper understanding, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example demonstrates a multipart API call. For code samples using JSON payloads, visit \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Funzip.py\">this GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-21T06:28:34.000+00:00","Learn how to use the pdfRest Zip Files API Tool to unzip .zip archives with Python","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-python\u002F#article\",\n      \"headline\": \"How to Unzip Files with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-python\u002F\",\n      \"datePublished\": \"2024-11-21T06:28:34.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:19.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use the pdfRest Zip Files API Tool to unzip .zip archives with Python\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Zip Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fzip-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Funzip API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fzip-files\"\n        }\n      ],\n      \"keywords\": \"Python, Zip Files\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Unzip Files with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-unzip-files-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11040,11041,11042,11043],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1915,"name":1916,"slug":1917,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-unzip-files-with-python\u002F","How to Unzip Files with Python, Tutorial | pdfRest",{"id":11048,"uuid":11049,"title":11050,"slug":11051,"html":11052,"comment_id":11048,"feature_image":48,"featured":284,"visibility":1257,"created_at":11053,"updated_at":11054,"published_at":11053,"custom_excerpt":11055,"codeinjection_head":11056,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11057,"primary_tag":11062,"url":11063,"excerpt":11055,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11064,"meta_description":11055,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65e7779b533c9f26b94366ba","0ab8fde8-dd39-4cc1-af0c-6f55f28db09f","How to Upload a Single Binary File to pdfRest in .NET with C#","how-to-upload-a-single-binary-file-to-pdfrest-in-net-with-c-2","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Upload Files with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fupload-files\u002F'>Upload Files API Tool\u003C\u002Fa> is a powerful resource for developers who need to upload PDF files to a server for processing. This API provides a simple and secure way to send files over the internet, ensuring that they can be easily accessed for further manipulation or storage. In this tutorial, we will demonstrate how to make an API call to the pdfRest Upload Files endpoint using C#. This is particularly useful for applications that need to handle PDF documents, such as document management systems, content management platforms, or any software that requires the processing of PDF files.\u003C\u002Fp>\n\n\u003Cp>Imagine a scenario where a legal firm needs to upload and process a large number of case-related PDF documents. They could use this API to automate the upload process, saving time and reducing the risk of human error. By integrating the Upload Files API into their software, they can streamline the workflow, allowing lawyers and paralegals to focus on more critical tasks while the system takes care of the document handling.\u003C\u002Fp>\n\n\u003Ch2>Upload Files with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"upload\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(\"application\u002Fjson\"));\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Foctet-stream\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Filename\", \"filename.pdf\");\n\n        request.Content = byteAryContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"Upload response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fupload.cs\">pdfRest C# Sample Code\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided C# code snippet demonstrates how to upload a file to the pdfRest API. Let's break down the key components of this code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>This line initializes an instance of HttpClient with the base address set to the pdfRest API endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var request = new HttpRequestMessage(HttpMethod.Post, \"upload\"))\n\u003C\u002Fpre>\n\n\u003Cp>Here, we're creating a new HttpRequestMessage for a POST request to the \"upload\" endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>The API key is added to the request headers. This key is required to authenticate the request with the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\nvar byteAryContent = new ByteArrayContent(byteArray);\n\u003C\u002Fpre>\n\n\u003Cp>We read the file that needs to be uploaded into a byte array and then wrap it in a ByteArrayContent object.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Foctet-stream\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Filename\", \"filename.pdf\");\n\u003C\u002Fpre>\n\n\u003Cp>These lines add the necessary headers to the content, indicating the type of the file and its name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Content = byteAryContent;\nvar response = await httpClient.SendAsync(request);\n\u003C\u002Fpre>\n\n\u003Cp>The content is attached to the request, and the request is sent asynchronously. The response from the server is captured in the 'response' variable.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the response content is read as a string, which contains the result of the upload operation.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps above, we've successfully uploaded a file to the pdfRest API using C#. This functionality is essential for any application that needs to process PDF files remotely. With the pdfRest API, developers can not only upload but also convert, merge, and manipulate PDF documents as needed.\u003C\u002Fp>\n\n\u003Cp>Encouraged by this tutorial, you may want to explore more of what pdfRest has to offer. Feel free to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For a comprehensive understanding of the capabilities and how to use them, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-05T19:50:51.000+00:00","2026-09-02T18:29:41.000+00:00","Learn how to use C# to upload a binary file to pdfRest using the Upload API Tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-in-net-with-c-2\u002F#article\",\n      \"headline\": \"How to Upload a Single Binary File to pdfRest in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-in-net-with-c-2\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-in-net-with-c-2\u002F\",\n      \"datePublished\": \"2024-03-05T19:50:51.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:45.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use C# to upload a binary file to pdfRest using the Upload API Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Upload Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fupload-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fupload API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fupload-files\"\n        }\n      ],\n      \"keywords\": \".NET, Upload Files\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Upload a Single Binary File to pdfRest in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-in-net-with-c-2\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11058,11059,11060,11061],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1911,"name":1912,"slug":1913,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-in-net-with-c-2\u002F","How to Upload a Single Binary File to pdfRest in .NET with C#, Tutorial | pdfRest",{"id":11066,"uuid":11067,"title":11068,"slug":11069,"html":11070,"comment_id":11066,"feature_image":48,"featured":284,"visibility":1257,"created_at":10168,"updated_at":10243,"published_at":10243,"custom_excerpt":11071,"codeinjection_head":11072,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11073,"primary_tag":11078,"url":11079,"excerpt":11071,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11080,"meta_description":11071,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a9750ce533c9f26b943b796","606dd504-03d5-4b4b-8463-ea3afc2f4ab5","How to Upload a Single Binary File to pdfRest with cURL","how-to-upload-a-single-binary-file-to-pdfrest-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Cp>In this tutorial, we'll walk through how to upload a single binary file to pdfRest with cURL and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fupload-files\u002F\">Upload Files API Tool\u003C\u002Fa>. The example sends the file as the raw HTTP request body, supplies its name in a header, and captures the returned resource ID for later API calls.\u003C\u002Fp>\n\n\u003Ch2>Why Upload a Single Binary File to pdfRest with cURL?\u003C\u002Fh2>\n\n\u003Cp>Uploading a source once and referencing it by resource ID can simplify multi-step workflows. Later calls can reuse the managed file without transferring the same bytes again.\u003C\u002Fp>\n\n\u003Cp>A document-processing service might upload a large PDF at the beginning of a job, then send its ID to compression, extraction, and security operations. The raw binary upload shown here keeps that first transfer compact and returns the identifier needed by those steps.\u003C\u002Fp>\n\n\u003Cp>This upload mode sends the file bytes as the HTTP body rather than wrapping them in multipart form data. The separate \u003Ccode>content-filename\u003C\u002Fcode> header supplies the name that pdfRest associates with the resource.\u003C\u002Fp>\n\n\u003Ch2>cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">#!\u002Fbin\u002Fsh\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\nUPLOAD_ID=$(curl --location \"$API_URL\u002Fupload\" \\\n--header 'api-key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \\\n--header 'content-filename: filename.pdf' \\\n--data-binary '@\u002Fpath\u002Fto\u002Ffile' \\\n | jq -r '.files.[0].id')\n\necho \"File successfully uploaded with an ID of: $UPLOAD_ID\"\u003C\u002Fpre>\n\n\u003Cp>Source for Upload a Single Binary to pdfRest: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fupload.sh\">View the cURL sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Choose the pdfRest service region\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>The script targets the US service by default and includes the EU hostname as a commented alternative. Keep every call in one workflow on the same regional service.\u003C\u002Fp>\n\n\u003Ch3>Send the file as the binary request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">--data-binary '@\u002Fpath\u002Fto\u002Ffile' \\\u003C\u002Fpre>\n\n\u003Cp>Unlike multipart upload, \u003Ccode>--data-binary\u003C\u002Fcode> places the local file bytes directly in the HTTP body and preserves them without form encoding.\u003C\u002Fp>\n\n\u003Ch3>Supply authentication and resource metadata\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">--header 'api-key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \\\n--header 'content-filename: filename.pdf' \\\u003C\u002Fpre>\n\n\u003Cp>The API key authenticates the call, while \u003Ccode>content-filename\u003C\u002Fcode> provides the managed resource name because no multipart file part is present.\u003C\u002Fp>\n\n\u003Ch3>Capture the returned resource ID\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">UPLOAD_ID=$(curl --location \"$API_URL\u002Fupload\" \\\n--header 'api-key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \\\n--header 'content-filename: filename.pdf' \\\n--data-binary '@\u002Fpath\u002Fto\u002Ffile' \\\n | jq -r '.files.[0].id')\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>--data-binary\u003C\u002Fcode> preserves the uploaded bytes, while \u003Ccode>jq -r\u003C\u002Fcode> extracts the first file ID from the JSON response into a shell variable.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial gives you a minimal cURL pattern for staging one binary file and retaining its resource ID for compatible pdfRest operations.\u003C\u002Fp>\n\n\u003Cp>Use a meaningful filename and store the returned ID with the job that owns it. Resource IDs remain temporary, so download required results or reuse the file before retention expires, then delete it explicitly when appropriate.\u003C\u002Fp>\n\n\u003Cp>Continue exploring the Upload a Single Binary to pdfRest workflow in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the complete Upload a Single Binary to pdfRest request contract, accepted values, defaults, and limitations, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fupload-files\u002F\">Upload Files API Tool documentation\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Learn how to upload one file as a raw binary body with cURL and capture its pdfRest resource ID for later API calls.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-curl\u002F#article\",\n      \"headline\": \"How to Upload a Single Binary File to pdfRest with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-curl\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to upload one file as a raw binary body with cURL and capture its pdfRest resource ID for later API calls.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Upload Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fupload-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fupload API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fupload-files\"\n        }\n      ],\n      \"keywords\": \"Upload Files, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Upload a Single Binary File to pdfRest with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11074,11075,11076,11077],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1911,"name":1912,"slug":1913,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-curl\u002F","How to Upload a Single Binary File to pdfRest with cURL, Tutorial | pdfRest",{"id":11082,"uuid":11083,"title":11084,"slug":11085,"html":11086,"comment_id":11082,"feature_image":48,"featured":284,"visibility":1257,"created_at":11087,"updated_at":11054,"published_at":11088,"custom_excerpt":11089,"codeinjection_head":11090,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11091,"primary_tag":11096,"url":11097,"excerpt":11089,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11098,"meta_description":11089,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c61533c9f26b943b5ae","e0155552-66b0-4a87-9f25-0ba3e7fe0156","How to Upload a Single Binary File to pdfRest with Java","how-to-upload-a-single-binary-file-to-pdfrest-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>Learn how to upload a single binary file to pdfRest with Java and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fupload-files\u002F\">Upload Files API Tool\u003C\u002Fa>. The code sends raw file bytes to \u003Ccode>\u002Fupload\u003C\u002Fcode>, provides the filename in a header, and reads the new resource ID. We'll move from input and authentication setup through the request and returned data involved when you upload a single binary file to pdfRest.\u003C\u002Fp>\n\n\u003Ch2>Why Upload a Single Binary File to pdfRest with Java?\u003C\u002Fh2>\n\n\u003Cp>A multi-step application may want to transfer a source once and reference it by ID in later operations. Uploading first separates file transfer from the processing request and avoids repeated uploads.\u003C\u002Fp>\n\n\u003Cp>The Java example sends the file bytes directly to \u003Ccode>\u002Fupload\u003C\u002Fcode> and supplies the filename in the \u003Ccode>Content-Filename\u003C\u002Fcode> header. Binary upload mode does not wrap the file in multipart form data.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class Upload {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody requestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .header(\"Content-Filename\", \"File.pdf\")\n            .url(API_URL + \"\u002Fupload\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client = new OkHttpClient().newBuilder().build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FUpload.java\">Java sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The Java setup assigns a clear role to each library: HTTP communication, credential lookup, or JSON handling.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody requestBody =\u003C\u002Fpre>\n\n\u003Cp>The input setup keeps a visible default path, accepts an override from the command line, and reads the API key through dotenv.\u003C\u002Fp>\n\n\u003Ch3>Build the binary request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody requestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .header(\"Content-Filename\", \"File.pdf\")\n            .url(API_URL + \"\u002Fupload\")\n            .post(requestBody)\n            .build();\n    try {\u003C\u002Fpre>\n\n\u003Cp>The file becomes the HTTP request body itself, and \u003Ccode>Content-Filename\u003C\u002Fcode> tells pdfRest what name to assign the uploaded resource. OkHttp derives \u003Ccode>Content-Type\u003C\u002Fcode> from the media type supplied to \u003Ccode>RequestBody.create\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .header(\"Content-Filename\", \"File.pdf\")\n            .url(API_URL + \"\u002Fupload\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client = new OkHttpClient().newBuilder().build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\u003C\u002Fpre>\n\n\u003Cp>This POST request posts the multipart content to pdfRest and keeps deployment-region changes independent of the rest of the Java code.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    try {\n      OkHttpClient client = new OkHttpClient().newBuilder().build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>A successful upload returns a \u003Ccode>files\u003C\u002Fcode> array containing the new resource ID and file details, which can be retained for a later API request.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>Together, we stepped through the Java request needed to upload a single binary file to pdfRest. With that foundation, resource IDs can be reused by compatible API Tools until deletion or the configured retention period removes the file.\u003C\u002Fp>\n\n\u003Cp>As you build this into a larger workflow, set \u003Ccode>Content-Filename\u003C\u002Fcode> to a meaningful name because later operations use resource metadata as well as the stored bytes. Retain the returned ID only as long as the workflow needs it, then delete the resource explicitly or allow the configured retention policy to expire it.\u003C\u002Fp>\n\n\u003Cp>Try the Upload a Single Binary to pdfRest operation with representative files in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. Review the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fupload-files\u002F\">Upload Files API Tool documentation\u003C\u002Fa> for supported values and production considerations.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T17:33:21.000+00:00","2026-09-01T21:57:41.000+00:00","Upload one local file to pdfRest with Java and retain its resource ID for later calls.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-java\u002F#article\",\n      \"headline\": \"How to Upload a Single Binary File to pdfRest with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:41.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:41.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Upload one local file to pdfRest with Java and retain its resource ID for later calls.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Upload Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fupload-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fupload API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fupload-files\"\n        }\n      ],\n      \"keywords\": \"Java, Upload Files\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Upload a Single Binary File to pdfRest with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11092,11093,11094,11095],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1911,"name":1912,"slug":1913,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-java\u002F","Upload a Single Binary File to pdfRest with Java | pdfRest",{"id":11100,"uuid":11101,"title":11102,"slug":11103,"html":11104,"comment_id":11100,"feature_image":48,"featured":284,"visibility":1257,"created_at":11105,"updated_at":10243,"published_at":10243,"custom_excerpt":11106,"codeinjection_head":11107,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11108,"primary_tag":11113,"url":11114,"excerpt":11106,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11115,"meta_description":11106,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a9764e3533c9f26b943b825","f6e37137-ff2e-43a8-9053-3b3de2b49a23","How to Upload a Single Binary File to pdfRest with JavaScript in NodeJS","how-to-upload-a-single-binary-file-to-pdfrest-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Cp>Follow this JavaScript in NodeJS walkthrough to upload one raw binary file to pdfRest with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fupload-files\u002F\">Upload Files API Tool\u003C\u002Fa>. You'll see the complete Upload a Single Binary to pdfRest sample first, then examine the transport code and API fields that matter when this JavaScript in NodeJS pattern moves into an application.\u003C\u002Fp>\n\n\u003Ch2>Why Upload a Single Binary File to pdfRest with JavaScript in NodeJS?\u003C\u002Fh2>\n\n\u003Cp>A managed upload is useful when several document operations will consume the same source. NodeJS can transfer the file once, store the returned ID with application state, and refer to that ID in compatible JSON or multipart requests.\u003C\u002Fp>\n\n\u003Cp>For example, a document worker may stage a large PDF before sending it through extraction and security steps. Reusing the resource avoids repeating the original upload at every stage and makes the workflow easier to resume.\u003C\u002Fp>\n\n\u003Cp>The raw-upload form differs from the multipart upload used for several files. Axios streams the file directly as the request data while headers provide the API key, binary media type, and filename.\u003C\u002Fp>\n\n\u003Ch2>JavaScript in NodeJS Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\nvar upload_data = fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\");\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: \"post\",\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: apiUrl + \"\u002Fupload\",\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", \u002F\u002F Replace with your API key\n    \"Content-Filename\": \"filename.pdf\",\n    \"Content-Type\": \"application\u002Foctet-stream\",\n  },\n  data: upload_data, \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error);\n  });\u003C\u002Fpre>\n\n\u003Cp>Source for Upload a Single Binary to pdfRest: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fupload.js\">View the JavaScript in NodeJS sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the NodeJS request and file modules\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\u003C\u002Fpre>\n\n\u003Cp>Axios sends the HTTP calls for Upload a Single Binary to pdfRest, \u003Ccode>FormData\u003C\u002Fcode> constructs multipart bodies when needed, and Node's \u003Ccode>fs\u003C\u002Fcode> module opens local files as streams. Together, these packages provide the transport and file handling required by the JavaScript Upload a Single Binary to pdfRest sample.\u003C\u002Fp>\n\n\u003Ch3>Select the pdfRest service region\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\nvar upload_data = fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\");\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>apiUrl\u003C\u002Fcode> centralizes regional routing for Upload a Single Binary to pdfRest. The NodeJS Upload a Single Binary to pdfRest flow can switch to the documented EU hostname without changing the endpoint paths that follow.\u003C\u002Fp>\n\n\u003Ch3>Open the file as the request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">var upload_data = fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\");\n\n\u002F\u002F define configuration options for axios request\nvar config = {\u003C\u002Fpre>\n\n\u003Cp>This JavaScript in NodeJS raw-upload request places file bytes directly in the HTTP body. Because this JavaScript in NodeJS Upload a Single Binary to pdfRest call has no multipart file part, \u003Ccode>content-filename\u003C\u002Fcode> supplies the resource name.\u003C\u002Fp>\n\n\u003Ch3>Configure the binary headers and endpoint\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: \"post\",\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: apiUrl + \"\u002Fupload\",\n  headers: {\n    \"Api-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\", \u002F\u002F Replace with your API key\n    \"Content-Filename\": \"filename.pdf\",\n    \"Content-Type\": \"application\u002Foctet-stream\",\n  },\n  data: upload_data, \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\u003C\u002Fpre>\n\n\u003Cp>The JavaScript in NodeJS request joins the Upload a Single Binary to pdfRest endpoint, authentication header, and prepared body. For this Upload a Single Binary to pdfRest call, the multipart metadata generated by JavaScript in NodeJS must remain paired with the body so pdfRest can separate files from options.\u003C\u002Fp>\n\n\u003Ch3>Read the uploaded resource response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n  .then(function (response) {\n    console.log(JSON.stringify(response.data));\n  })\n  .catch(function (error) {\n    console.log(error);\n  });\u003C\u002Fpre>\n\n\u003Cp>The final Upload a Single Binary to pdfRest handling in JavaScript in NodeJS exposes the HTTP result and JSON body. Before using a Upload a Single Binary to pdfRest output or request ID, production JavaScript in NodeJS code should verify the status and retain the identifier required by the next step.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You can now stage one file with a raw binary JavaScript in NodeJS request and carry its managed resource ID into compatible pdfRest operations.\u003C\u002Fp>\n\n\u003Cp>Handle the file stream and API response errors before persisting the resource ID. Keep the ID associated with its original filename and region, then delete the resource explicitly when early cleanup is appropriate.\u003C\u002Fp>\n\n\u003Cp>Try the Upload a Single Binary to pdfRest workflow with a representative file in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, then adapt the request in JavaScript in NodeJS. The \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fupload-files\u002F\">Upload Files API Tool documentation\u003C\u002Fa> provides the complete JavaScript in NodeJS context for Upload a Single Binary to pdfRest values, defaults, and limitations.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T23:50:59.000+00:00","Send a single raw binary file from NodeJS to pdfRest and capture the resource information used by later calls.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Upload a Single Binary File to pdfRest with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Send a single raw binary file from NodeJS to pdfRest and capture the resource information used by later calls.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Upload Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fupload-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fupload API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fupload-files\"\n        }\n      ],\n      \"keywords\": \"JavaScript, Upload Files\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Upload a Single Binary File to pdfRest with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11109,11110,11111,11112],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1911,"name":1912,"slug":1913,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-javascript-in-nodejs\u002F","Upload a Single Binary File to pdfRest with JavaScript in NodeJS | pdfRest",{"id":11117,"uuid":11118,"title":11119,"slug":11120,"html":11121,"comment_id":11117,"feature_image":48,"featured":284,"visibility":1257,"created_at":10206,"updated_at":10243,"published_at":10243,"custom_excerpt":11122,"codeinjection_head":11123,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11124,"primary_tag":11129,"url":11130,"excerpt":11122,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11131,"meta_description":11122,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a9764e2533c9f26b943b81c","8dc22c66-0943-4516-a811-4ff0eba8cd92","How to Upload a Single Binary File to pdfRest with PHP","how-to-upload-a-single-binary-file-to-pdfrest-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Cp>In this tutorial, we'll use PHP and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fupload-files\u002F\">Upload Files API Tool\u003C\u002Fa> to upload one raw binary file to pdfRest. The complete Upload a Single Binary to pdfRest repository sample stays visible while we explain the request fields and response behavior a PHP application must adapt safely.\u003C\u002Fp>\n\n\u003Ch2>Why Upload a Single Binary File to pdfRest with PHP?\u003C\u002Fh2>\n\n\u003Cp>Uploading a source once can simplify a multi-step workflow that references the same document repeatedly. The returned resource ID allows compatible API Tools to use the managed file without another byte transfer.\u003C\u002Fp>\n\n\u003Cp>A PHP invoice service might stage a large statement before applying several operations, such as compression and encryption. Keeping the ID in the job record separates the initial file transfer from each later processing call.\u003C\u002Fp>\n\n\u003Cp>This example uses raw binary upload rather than multipart form data. The file bytes become the HTTP body, \u003Ccode>Content-Type\u003C\u002Fcode> is \u003Ccode>application\u002Foctet-stream\u003C\u002Fcode>, and \u003Ccode>content-filename\u003C\u002Fcode> supplies the resource name that multipart metadata would ordinarily carry.\u003C\u002Fp>\n\n\u003Ch2>PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n$client = new Client(['http_errors' => false]);\n$headers = [\n  'api-key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n  'content-filename' => 'filename.pdf',\n  'Content-Type' => 'application\u002Foctet-stream'\n];\n$body = file_get_contents('\u002Fpath\u002Fto\u002Ffile');\n$request = new Request('POST', $apiUrl.'\u002Fupload', $headers, $body);\n$res = $client->sendAsync($request)->wait();\necho $res->getBody();\u003C\u002Fpre>\n\n\u003Cp>Source for Upload a Single Binary to pdfRest: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fupload.php\">View the PHP sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load Guzzle and its stream helpers\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\u003C\u002Fpre>\n\n\u003Cp>Guzzle supplies the HTTP client and PSR-7 request objects used throughout the Upload a Single Binary to pdfRest example. For this PHP Upload a Single Binary to pdfRest flow, \u003Ccode>Utils::tryFopen\u003C\u002Fcode> creates readable multipart streams without loading every uploaded byte into one string.\u003C\u002Fp>\n\n\u003Ch3>Select the pdfRest service region\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n$client = new Client(['http_errors' => false]);\n$headers = [\u003C\u002Fpre>\n\n\u003Cp>The active \u003Ccode>$apiUrl\u003C\u002Fcode> selects the US service for Upload a Single Binary to pdfRest; the commented assignment shows the EU alternative. Keep the PHP uploads, request IDs, and generated resources for Upload a Single Binary to pdfRest on that same regional host.\u003C\u002Fp>\n\n\u003Ch3>Build the raw binary upload\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">$headers = [\n  'api-key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n  'content-filename' => 'filename.pdf',\n  'Content-Type' => 'application\u002Foctet-stream'\n];\n$body = file_get_contents('\u002Fpath\u002Fto\u002Ffile');\n$request = new Request('POST', $apiUrl.'\u002Fupload', $headers, $body);\n$res = $client->sendAsync($request)->wait();\necho $res->getBody();\u003C\u002Fpre>\n\n\u003Cp>This PHP raw-upload request places file bytes directly in the HTTP body. Because this PHP Upload a Single Binary to pdfRest call has no multipart file part, \u003Ccode>content-filename\u003C\u002Fcode> supplies the resource name.\u003C\u002Fp>\n\n\u003Ch3>Send the body and inspect the response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">];\n$body = file_get_contents('\u002Fpath\u002Fto\u002Ffile');\n$request = new Request('POST', $apiUrl.'\u002Fupload', $headers, $body);\n$res = $client->sendAsync($request)->wait();\necho $res->getBody();\u003C\u002Fpre>\n\n\u003Cp>The final Upload a Single Binary to pdfRest handling in PHP exposes the HTTP result and JSON body. Before using a Upload a Single Binary to pdfRest output or request ID, production PHP code should verify the status and retain the identifier required by the next step.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You can now stage one file with a raw binary PHP request and carry its managed resource ID into compatible pdfRest operations.\u003C\u002Fp>\n\n\u003Cp>Use a meaningful filename, verify the returned \u003Ccode>files\u003C\u002Fcode> entry, and retain its ID only as long as the workflow needs it. Resource storage is temporary, so download durable results or complete dependent calls before retention expires.\u003C\u002Fp>\n\n\u003Cp>Try the Upload a Single Binary to pdfRest workflow with a representative file in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, then adapt the request in PHP. The \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fupload-files\u002F\">Upload Files API Tool documentation\u003C\u002Fa> provides the complete PHP context for Upload a Single Binary to pdfRest values, defaults, and limitations.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Upload one binary file to pdfRest from PHP and receive a managed resource ID for later API requests.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-php\u002F#article\",\n      \"headline\": \"How to Upload a Single Binary File to pdfRest with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-php\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Upload one binary file to pdfRest from PHP and receive a managed resource ID for later API requests.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Upload Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fupload-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fupload API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fupload-files\"\n        }\n      ],\n      \"keywords\": \"PHP, Upload Files\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Upload a Single Binary File to pdfRest with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11125,11126,11127,11128],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1911,"name":1912,"slug":1913,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-php\u002F","Upload a Single Binary File to pdfRest with PHP | pdfRest",{"id":11133,"uuid":11134,"title":11135,"slug":11136,"html":11137,"comment_id":11133,"feature_image":48,"featured":284,"visibility":1257,"created_at":11138,"updated_at":11054,"published_at":11138,"custom_excerpt":11139,"codeinjection_head":11140,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11141,"primary_tag":11146,"url":11147,"excerpt":11139,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11148,"meta_description":11139,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65e1085e533c9f26b9436654","dada00f2-c936-48f5-98a8-08030a4c21df","How to Upload a Single Binary File to pdfRest with Python","how-to-upload-a-single-binary-file-to-pdfrest-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Upload Files with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fupload-files\u002F'>Upload Files API Tool\u003C\u002Fa> is a powerful resource for developers who need to upload files to a server for processing. This API provides an easy-to-use interface for transferring files such as PDFs or images to the pdfRest server, where they can be manipulated or transformed according to the user's needs.\u003C\u002Fp>\n\n\u003Cp>This tutorial will guide you through the process of sending an API call to Upload Files using Python, a popular programming language known for its simplicity and readability.\u003C\u002Fp>\n\n\u003Cp>In a business context, the ability to programmatically upload files can be crucial. For instance, a company might need to batch process a large number of invoices, convert scanned documents into searchable PDFs, or integrate file upload capabilities into their internal systems or customer-facing applications. By automating this process with the pdfRest API and Python, businesses can save time, reduce errors, and increase efficiency.\u003C\u002Fp>\n\n\u003Ch2>Upload Files with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">import requests\nimport json\n\nwith open('\u002Fpath\u002Fto\u002Ffile', 'rb') as f:\n    upload_data = f.read()\n\nprint(\"Uploading file...\")\nupload_response = requests.post(url='https:\u002F\u002Fapi.pdfrest.com\u002Fupload',\n                    data=upload_data,\n                    headers={'Content-Type': 'application\u002Foctet-stream', 'Content-Filename': 'file.pdf', \"API-Key\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"})\n\nprint(\"Upload response status code: \" + str(upload_response.status_code))\n\nif upload_response.ok:\n    upload_response_json = upload_response.json()\n    print(json.dumps(upload_response_json, indent = 2))\n\nelse:\n    print(upload_response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Source of the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fupload.py\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided code is an example of how to upload files to the pdfRest server using a multipart\u002Fform-data request in Python. Let's break down the key parts of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">upload_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fupload'\n\u003C\u002Fpre>\n\n\u003Cp>This is the API endpoint URL to which the files will be uploaded.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">files = [\n    ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n    ...\n]\n\u003C\u002Fpre>\n\n\u003Cp>Here we define the files to be uploaded. Each file is represented as a tuple containing the file name, a file object opened in binary mode, and the MIME type.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">for i in range(len(files)):\n    upload_request_data.append((\"file\", files[i]))\n\u003C\u002Fpre>\n\n\u003Cp>This loop constructs the data payload for the POST request, appending each file to the `upload_request_data` list.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_upload.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\n\u003C\u002Fpre>\n\n\u003Cp>The headers include the expected 'Content-Type' set by the `MultipartEncoder`, the 'Accept' header indicating we expect a JSON response, and the 'Api-Key' which should be replaced with your actual API key from pdfRest.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(upload_endpoint_url, data=mp_encoder_upload, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This line sends the POST request to the upload endpoint with the data and headers we defined earlier.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the tutorial above, you've learned how to upload files to the pdfRest server using Python. This is a fundamental step in automating the process of file handling and manipulation in your applications. With this knowledge, you can now explore other capabilities of the pdfRest API, such as converting, merging, or securing PDF files.\u003C\u002Fp>\n\n\u003Cp>To further your understanding and capabilities, feel free to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For a comprehensive guide to the API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-29T22:42:38.000+00:00","Learn how to use Python to upload a single binary file by calling Upload Files API Tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-python\u002F#article\",\n      \"headline\": \"How to Upload a Single Binary File to pdfRest with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-python\u002F\",\n      \"datePublished\": \"2024-02-29T22:42:38.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:45.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use Python to upload a single binary file by calling Upload Files API Tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Upload Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fupload-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fupload API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fupload-files\"\n        }\n      ],\n      \"keywords\": \"Python, Upload Files\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Upload a Single Binary File to pdfRest with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11142,11143,11144,11145],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1911,"name":1912,"slug":1913,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-upload-a-single-binary-file-to-pdfrest-with-python\u002F","How to Upload a Single Binary File to pdfRest with Python, Tutorial | pdfRest",{"id":11150,"uuid":11151,"title":11152,"slug":11153,"html":11154,"comment_id":11150,"feature_image":48,"featured":284,"visibility":1257,"created_at":11155,"updated_at":11156,"published_at":11155,"custom_excerpt":11157,"codeinjection_head":11158,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11159,"primary_tag":11164,"url":11165,"excerpt":11157,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11166,"meta_description":11157,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65c51133533c9f26b9436116","542746e7-00b1-415b-8820-4e48cbb8542e","How to Upload Multiple Files to pdfRest in .NET with C#","how-to-upload-multiple-files-to-pdfrest-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Upload Multiple Files in One C# Request\u003C\u002Fh2>\n\n\u003Cp>Document workflows often begin with a related set of files rather than a single PDF. The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fupload-files\u002F\">Upload Files API Tool\u003C\u002Fa> lets a .NET application upload multiple local files in one multipart request to \u003Ccode>\u002Fupload\u003C\u002Fcode>. The response associates each original filename with a unique resource ID that can be passed into later pdfRest operations.\u003C\u002Fp>\n\n\u003Cp>Pre-uploading is optional because processing tools can accept files directly. It is useful when several steps will reuse the same inputs or when the application wants to separate transfer from processing. Once the files have resource IDs, subsequent API calls can use compact JSON bodies instead of uploading the same binaries again. This reduces repeated transfer and makes multi-step request logic easier to track.\u003C\u002Fp>\n\n\u003Cp>For example, a C# claims portal can upload a claim form, supporting photographs, and a policy document together. The application records each returned resource ID, passes the relevant PDFs to Merge PDFs, and retains the image IDs for other processing. A single intake request keeps the submitted names and server resources aligned without requiring a separate upload call for every item.\u003C\u002Fp>\n\n\u003Cp>This adapted example accepts multiple file paths, adds each file under the repeated multipart field name \u003Ccode>file\u003C\u002Fcode>, and prints the JSON response.\u003C\u002Fp>\n\n\u003Ch2>C# Multiple-File Upload Example\u003C\u002Fh2>\n\n\u003Cp>Set \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode> in the environment and optionally set \u003Ccode>PDFREST_URL\u003C\u002Fcode> to select the US or EU Cloud API. Pass at least two valid file paths to the sample. The application should validate its own allowed file types and size limits before constructing the request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">\u002F*\n * What this sample does:\n * - Uploads multiple files as resources using multipart\u002Fform-data.\n * - Routed from Program.cs as: `dotnet run -- upload-multiple inputFile1 inputFile2 [...]`.\n *\n * Setup (environment):\n * - Copy .env.example to .env\n * - Set PDFREST_API_KEY=your_api_key_here\n * - Optional: set PDFREST_URL to override the API region. For EU\u002FGDPR compliance and proximity, use:\n *     PDFREST_URL=https:\u002F\u002Feu-api.pdfrest.com\n *   For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\n * Usage:\n *   dotnet run -- upload-multiple \u002Fpath\u002Fto\u002Finput1.pdf \u002Fpath\u002Fto\u002Finput2.pdf\n *\n * Output:\n * - Prints the JSON response (resource metadata). Validation errors exit non-zero.\n *\u002F\n\nusing System.Text;\n\nnamespace Samples.EndpointExamples.MultipartPayload\n{\n    public static class Upload\n    {\n        public static async Task Execute(string[] args)\n        {\n            if (args == null || args.Length \u003C 2)\n            {\n                Console.Error.WriteLine(\"upload-multiple requires inputFile1 inputFile2 [...]\");\n                Environment.Exit(1);\n                return;\n            }\n\n            foreach (var inputPath in args)\n            {\n                if (!File.Exists(inputPath))\n                {\n                    Console.Error.WriteLine($\"File not found: {inputPath}\");\n                    Environment.Exit(1);\n                    return;\n                }\n            }\n\n            var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\");\n            if (string.IsNullOrWhiteSpace(apiKey))\n            {\n                Console.Error.WriteLine(\"Missing required environment variable: PDFREST_API_KEY\");\n                Environment.Exit(1);\n                return;\n            }\n\n            var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n\n            using (var httpClient = new HttpClient { BaseAddress = new Uri(baseUrl) })\n            using (var request = new HttpRequestMessage(HttpMethod.Post, \"upload\"))\n            {\n                request.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\n                request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n                var multipartContent = new MultipartFormDataContent();\n\n                foreach (var inputPath in args)\n                {\n                    var byteArray = File.ReadAllBytes(inputPath);\n                    var byteAryContent = new ByteArrayContent(byteArray);\n                    multipartContent.Add(byteAryContent, \"file\", Path.GetFileName(inputPath));\n                    byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Foctet-stream\");\n                }\n\n                request.Content = multipartContent;\n                var response = await httpClient.SendAsync(request);\n                var apiResult = await response.Content.ReadAsStringAsync();\n\n                Console.WriteLine(\"API response received.\");\n                Console.WriteLine(apiResult);\n            }\n        }\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Starting point: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fupload.cs\">pdfRest Upload Files multipart C# sample\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Repeat the \u003Ccode>file\u003C\u002Fcode> Field for Each Local File\u003C\u002Fh2>\n\n\u003Cp>\u003Ccode>MultipartFormDataContent\u003C\u002Fcode> represents the request body. Add every local file as a separate content part with the same form field name, \u003Ccode>file\u003C\u002Fcode>, and its own original filename. The Upload Files endpoint recognizes the repeated field and returns a resource entry for each uploaded item. Do not combine local \u003Ccode>file\u003C\u002Fcode> parts with \u003Ccode>url\u003C\u002Fcode> fields in the same request.\u003C\u002Fp>\n\n\u003Cp>The sample follows the official repository's \u003Ccode>ByteArrayContent\u003C\u002Fcode> pattern for clarity and repeats that pattern for every path. For larger files or batches, adapt the request to use \u003Ccode>StreamContent\u003C\u002Fcode> so the application does not hold all file bytes in memory at once. The total size of all files in the call is subject to the upload limit for the account's plan, even though the tool does not impose a separate file-count limit.\u003C\u002Fp>\n\n\u003Cp>The response is JSON, but the local file upload request itself is multipart form data. Parse the response collection by filename and resource ID, verify that every expected file is present, and store the mapping with the document job. Do not rely only on array position if filenames provide a safer association.\u003C\u002Fp>\n\n\u003Ch2>Choose the Correct Upload Method\u003C\u002Fh2>\n\n\u003Cp>Multiple local files require multipart form data. A single local file can alternatively be sent as a raw binary request with \u003Ccode>application\u002Foctet-stream\u003C\u002Fcode> and a \u003Ccode>Content-Filename\u003C\u002Fcode> header. Files already hosted at public URLs can be submitted by repeating the endpoint's \u003Ccode>url\u003C\u002Fcode> parameter instead of downloading them into the application first. Local files and public URLs cannot be mixed in one call.\u003C\u002Fp>\n\n\u003Cp>The repository file currently located under “JSON Payload” for C# Upload sends one raw binary file; it is not a JSON request and does not demonstrate multiple-file upload. For that reason, this tutorial should not describe it as the common JSON-payload alternative. The JSON benefit appears in subsequent processing calls, where the resource IDs returned by Upload Files can replace new multipart uploads.\u003C\u002Fp>\n\n\u003Cp>Check the HTTP status and response schema before starting downstream work. Add appropriate timeouts and cancellation, keep the API key out of source control, and avoid logging document content. Use \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> to inspect upload behavior and consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fupload-files\">Upload Files API reference\u003C\u002Fa> for current file, URL, and response requirements.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-02-08T17:36:51.000+00:00","2026-09-10T19:46:00.000+00:00","Learn how to Upload Multiple Files to pdfRest in .NET with C# by calling Upload Files API Tool by pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Upload Multiple Files to pdfRest in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-02-08T17:36:51.000Z\",\n      \"dateModified\": \"2026-09-10T19:31:23.947Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to Upload Multiple Files to pdfRest in .NET with C# by calling Upload Files API Tool by pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Upload Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fupload-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fupload API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fupload-files\"\n        }\n      ],\n      \"keywords\": \".NET, Upload Files\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Upload Multiple Files to pdfRest in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11160,11161,11162,11163],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1911,"name":1912,"slug":1913,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-upload-multiple-files-to-pdfrest-in-net-with-c\u002F","How to Upload Multiple Files to pdfRest in .NET with C#, Tutorial | pdfRest",{"id":11168,"uuid":11169,"title":11170,"slug":11171,"html":11172,"comment_id":11168,"feature_image":48,"featured":284,"visibility":1257,"created_at":10168,"updated_at":10243,"published_at":10243,"custom_excerpt":11173,"codeinjection_head":11174,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11175,"primary_tag":11180,"url":11181,"excerpt":11173,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11182,"meta_description":11173,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a9750ce533c9f26b943b79f","e2322806-eb93-42ff-a6e1-1337ad406f92","How to Upload Multiple Files to pdfRest with cURL","how-to-upload-multiple-files-to-pdfrest-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Cp>Follow this cURL walkthrough to upload multiple files to pdfRest with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fupload-files\u002F\">Upload Files API Tool\u003C\u002Fa>. Along the way, you'll learn which parts are ordinary cURL syntax, which fields are needed to upload multiple files to pdfRest, and what to expect from the API response.\u003C\u002Fp>\n\n\u003Ch2>Why Upload Multiple Files to pdfRest with cURL?\u003C\u002Fh2>\n\n\u003Cp>Batch and document-assembly workflows often need several resources before processing can begin. One multipart upload can stage all of those inputs and return the IDs used by later merge, attachment, or conversion calls.\u003C\u002Fp>\n\n\u003Cp>For instance, a case-management job might upload a signed agreement, supporting image, and data file together. The application can retain the filename-to-ID mapping and then choose the correct resource for each subsequent API Tool.\u003C\u002Fp>\n\n\u003Cp>The request repeats the same \u003Ccode>file\u003C\u002Fcode> field once per local input. cURL creates one multipart body, and the response contains a \u003Ccode>files\u003C\u002Fcode> entry for every accepted upload.\u003C\u002Fp>\n\n\u003Ch2>cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\ncurl -X POST \"$API_URL\u002Fupload\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\u003C\u002Fpre>\n\n\u003Cp>Source for Upload Multiple to pdfRest: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fupload.sh\">View the cURL sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Choose the pdfRest service region\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\"># By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\u003C\u002Fpre>\n\n\u003Cp>The service URL is kept in one variable so the request can use either the US or EU pdfRest environment without changing the remaining command.\u003C\u002Fp>\n\n\u003Ch3>Start an authenticated multipart upload\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"$API_URL\u002Fupload\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\u003C\u002Fpre>\n\n\u003Cp>The request posts to \u003Ccode>\u002Fupload\u003C\u002Fcode>, asks for JSON, explicitly declares multipart form data, and supplies the placeholder API key used for authentication.\u003C\u002Fp>\n\n\u003Ch3>Add every local file as its own multipart part\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\u003C\u002Fpre>\n\n\u003Cp>Each \u003Ccode>-F \"file=@...\"\u003C\u002Fcode> argument adds another binary file part. Repeating the field name is intentional and differs from sending a comma-separated list of paths.\u003C\u002Fp>\n\n\u003Ch3>Interpret the upload response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"$API_URL\u002Fupload\"\u003C\u002Fpre>\n\n\u003Cp>A successful response contains a \u003Ccode>files\u003C\u002Fcode> array with resource IDs and file details. Preserve the association between each local filename and its returned ID before starting later operations.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>After completing the example, you can stage several files with one cURL request and carry their resource IDs into a larger document workflow.\u003C\u002Fp>\n\n\u003Cp>Do not rely on array position after the response leaves the upload layer. Store each returned filename and ID together, confirm that every expected file was accepted, and clean up the resources when the workflow is complete.\u003C\u002Fp>\n\n\u003Cp>Continue exploring the Upload Multiple to pdfRest workflow in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For the complete Upload Multiple to pdfRest request contract, accepted values, defaults, and limitations, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fupload-files\u002F\">Upload Files API Tool documentation\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Learn how to upload several files in one cURL multipart request and preserve their returned resource IDs for later processing.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-with-curl\u002F#article\",\n      \"headline\": \"How to Upload Multiple Files to pdfRest with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-with-curl\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to upload several files in one cURL multipart request and preserve their returned resource IDs for later processing.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Upload Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fupload-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fupload API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fupload-files\"\n        }\n      ],\n      \"keywords\": \"Upload Files, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Upload Multiple Files to pdfRest with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11176,11177,11178,11179],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1911,"name":1912,"slug":1913,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-upload-multiple-files-to-pdfrest-with-curl\u002F","How to Upload Multiple Files to pdfRest with cURL, Tutorial | pdfRest",{"id":11184,"uuid":11185,"title":11186,"slug":11187,"html":11188,"comment_id":11184,"feature_image":48,"featured":284,"visibility":1257,"created_at":11087,"updated_at":11189,"published_at":11088,"custom_excerpt":11190,"codeinjection_head":11191,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11192,"primary_tag":11197,"url":11198,"excerpt":11190,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11199,"meta_description":11190,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c61533c9f26b943b5b7","e548ba14-8a9a-4758-ad87-fc9de036e586","How to Upload Multiple Files to pdfRest with Java","how-to-upload-multiple-files-to-pdfrest-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>Follow this Java walkthrough to upload multiple files to pdfRest with the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fupload-files\u002F\">Upload Files API Tool\u003C\u002Fa>. The example adds several files under repeated multipart \u003Ccode>file\u003C\u002Fcode> fields and maps the response entries back to those inputs. Along the way, you'll see which fields are needed to upload multiple files to pdfRest and how the response fits into later processing.\u003C\u002Fp>\n\n\u003Ch2>Why Upload Multiple Files to pdfRest with Java?\u003C\u002Fh2>\n\n\u003Cp>A batch workflow may need several source documents before it can merge, compare, or process them. A single upload call stages the files and returns IDs that subsequent requests can reference.\u003C\u002Fp>\n\n\u003Cp>The Java sample appends each local file under the repeated \u003Ccode>file\u003C\u002Fcode> field. The output order corresponds to the uploaded parts, so applications should retain the returned filename-to-ID association.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class Upload {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the paths to your file here, or as the arguments when running the program.\n  private static final String[] DEFAULT_FILE_PATHS =\n      new String[] {\"\u002Fpath\u002Fto\u002Ffile1.pdf\", \"\u002Fpath\u002Fto\u002Ffile2.pdf\"};\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    String[] inputFilePaths;\n    if (args.length > 0) {\n      inputFilePaths = args;\n    } else {\n      inputFilePaths = DEFAULT_FILE_PATHS;\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    MultipartBody.Builder bodyBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM);\n\n    for (String inputFilePath : inputFilePaths) {\n      final File inputFile = new File(inputFilePath);\n      final RequestBody inputFileRequestBody =\n          RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n      bodyBuilder.addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody);\n    }\n\n    RequestBody requestBody = bodyBuilder.build();\n\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fupload\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client = new OkHttpClient().newBuilder().build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FUpload.java\">Java sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The library group uses OkHttp for transport, dotenv for loading \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode>, and \u003Ccode>org.json\u003C\u002Fcode> for structured request or response data.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">private static final String[] DEFAULT_FILE_PATHS =\n      new String[] {\"\u002Fpath\u002Fto\u002Ffile1.pdf\", \"\u002Fpath\u002Fto\u002Ffile2.pdf\"};\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    String[] inputFilePaths;\n    if (args.length > 0) {\n      inputFilePaths = args;\n    } else {\n      inputFilePaths = DEFAULT_FILE_PATHS;\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    MultipartBody.Builder bodyBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM);\n\n    for (String inputFilePath : inputFilePaths) {\n      final File inputFile = new File(inputFilePath);\n      final RequestBody inputFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>The input is an array of file paths; supplying arguments replaces the entire default list before the upload body is assembled.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    MultipartBody.Builder bodyBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM);\n\n    for (String inputFilePath : inputFilePaths) {\n      final File inputFile = new File(inputFilePath);\n      final RequestBody inputFileRequestBody =\n          RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n      bodyBuilder.addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody);\n    }\n\n    RequestBody requestBody = bodyBuilder.build();\n\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\u003C\u002Fpre>\n\n\u003Cp>The Java sample appends each local file under the repeated \u003Ccode>file\u003C\u002Fcode> field. The output order corresponds to the uploaded parts, so applications should retain the returned filename-to-ID association. The multipart builder uses the form multipart type required for combining uploaded content with operation parameters.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fupload\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client = new OkHttpClient().newBuilder().build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\u003C\u002Fpre>\n\n\u003Cp>The authenticated call ties the body to its endpoint and applies the required \u003Ccode>Api-Key\u003C\u002Fcode> header before OkHttp sends it.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    try {\n      OkHttpClient client = new OkHttpClient().newBuilder().build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>Each uploaded file appears in the response \u003Ccode>files\u003C\u002Fcode> array with its resource ID; preserve the filename-to-ID relationship when later calls depend on input order.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial showed how a Java application can upload multiple files to pdfRest. With that foundation, you can use batch upload for merge inputs, attachment workflows, document packets, and other multi-resource operations.\u003C\u002Fp>\n\n\u003Cp>For production use, do not assume an ID based only on array position after the response leaves the upload layer; store each returned filename and resource ID together. Check that every expected file was accepted before starting a merge or another operation that requires the complete set.\u003C\u002Fp>\n\n\u003Cp>Use \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> to inspect the request and output from the Upload Multiple to pdfRest operation. For the complete set of options supported by Upload Multiple to pdfRest, consult the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fupload-files\u002F\">Upload Files API Tool documentation\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-02T18:29:43.000+00:00","Upload multiple files in one Java multipart request and capture their resource IDs.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-with-java\u002F#article\",\n      \"headline\": \"How to Upload Multiple Files to pdfRest with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:41.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:41.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Upload multiple files in one Java multipart request and capture their resource IDs.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Upload Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fupload-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fupload API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fupload-files\"\n        }\n      ],\n      \"keywords\": \"Java, Upload Files\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Upload Multiple Files to pdfRest with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11193,11194,11195,11196],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1911,"name":1912,"slug":1913,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-upload-multiple-files-to-pdfrest-with-java\u002F","Upload Multiple Files to pdfRest with Java | pdfRest",{"id":11201,"uuid":11202,"title":11203,"slug":11204,"html":11205,"comment_id":11201,"feature_image":48,"featured":284,"visibility":1257,"created_at":11206,"updated_at":10243,"published_at":10243,"custom_excerpt":11207,"codeinjection_head":11208,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11209,"primary_tag":11214,"url":11215,"excerpt":11207,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11216,"meta_description":11207,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a977076533c9f26b943b837","571f2083-0f8e-45bc-b012-8eace13771c4","How to Upload Multiple Files to pdfRest with JavaScript in NodeJS","how-to-upload-multiple-files-to-pdfrest-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Cp>Learn how to upload multiple files to pdfRest in one multipart request using JavaScript in NodeJS and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fupload-files\u002F\">Upload Files API Tool\u003C\u002Fa>. This Upload Multiple to pdfRest tutorial keeps the official sample intact and breaks down authentication, payload construction, endpoint behavior, and result handling for JavaScript in NodeJS.\u003C\u002Fp>\n\n\u003Ch2>Why Upload Multiple Files to pdfRest with JavaScript in NodeJS?\u003C\u002Fh2>\n\n\u003Cp>A single multipart request can prepare all of the inputs needed by a larger pdfRest workflow. This reduces request setup and gives the NodeJS caller one response containing the uploaded file resources.\u003C\u002Fp>\n\n\u003Cp>A closing-document service could upload a contract, exhibit, and signature image before it assembles the final packet. Each result ID can then be routed to the operation that understands that source.\u003C\u002Fp>\n\n\u003Cp>The sample appends the \u003Ccode>file\u003C\u002Fcode> field three times to one \u003Ccode>FormData\u003C\u002Fcode> object. Axios uses the generated boundary headers from that object, so callers should not substitute a manually written multipart boundary.\u003C\u002Fp>\n\n\u003Ch2>JavaScript in NodeJS Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\u002F\u002F This request demonstrates how to upload a document to the service.\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n\u002F\u002F Create a new form data object and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: apiUrl + '\u002Fupload',\n  headers: {\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error);\n});\u003C\u002Fpre>\n\n\u003Cp>Source for Upload Multiple to pdfRest: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fupload.js\">View the JavaScript in NodeJS sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the NodeJS request and file modules\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\u003C\u002Fpre>\n\n\u003Cp>Axios sends the HTTP calls for Upload Multiple to pdfRest, \u003Ccode>FormData\u003C\u002Fcode> constructs multipart bodies when needed, and Node's \u003Ccode>fs\u003C\u002Fcode> module opens local files as streams. Together, these packages provide the transport and file handling required by the JavaScript Upload Multiple to pdfRest sample.\u003C\u002Fp>\n\n\u003Ch3>Select the pdfRest service region\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n\u002F\u002F Create a new form data object and append the PDF file and parameters to it\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>apiUrl\u003C\u002Fcode> centralizes regional routing for Upload Multiple to pdfRest. The NodeJS Upload Multiple to pdfRest flow can switch to the documented EU hostname without changing the endpoint paths that follow.\u003C\u002Fp>\n\n\u003Ch3>Append several files to one FormData body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\ndata.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile\"));\n\n\u002F\u002F define configuration options for axios request\nvar config = {\u003C\u002Fpre>\n\n\u003Cp>Each local source is added by JavaScript in NodeJS under another \u003Ccode>file\u003C\u002Fcode> part in the same multipart body. The Upload Multiple to pdfRest response returns several resources whose filenames and IDs the JavaScript in NodeJS caller should keep paired.\u003C\u002Fp>\n\n\u003Ch3>Configure the multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: apiUrl + '\u002Fupload',\n  headers: {\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\u003C\u002Fpre>\n\n\u003Cp>The JavaScript in NodeJS request joins the Upload Multiple to pdfRest endpoint, authentication header, and prepared body. For this Upload Multiple to pdfRest call, the multipart metadata generated by JavaScript in NodeJS must remain paired with the body so pdfRest can separate files from options.\u003C\u002Fp>\n\n\u003Ch3>Read the collection of uploaded resources\u003C\u002Fh3>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error);\n});\u003C\u002Fpre>\n\n\u003Cp>The final Upload Multiple to pdfRest handling in JavaScript in NodeJS exposes the HTTP result and JSON body. Before using a Upload Multiple to pdfRest output or request ID, production JavaScript in NodeJS code should verify the status and retain the identifier required by the next step.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You now know how JavaScript in NodeJS can send several files in one multipart body and preserve the resource information returned for each upload.\u003C\u002Fp>\n\n\u003Cp>Check the upload response before launching dependent work and preserve names with IDs. If one local stream cannot be opened, fail the batch deliberately rather than allowing the remaining resources to masquerade as a complete set.\u003C\u002Fp>\n\n\u003Cp>Try the Upload Multiple to pdfRest workflow with a representative file in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, then adapt the request in JavaScript in NodeJS. The \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fupload-files\u002F\">Upload Files API Tool documentation\u003C\u002Fa> provides the complete JavaScript in NodeJS context for Upload Multiple to pdfRest values, defaults, and limitations.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-02T00:40:22.000+00:00","Stage multiple local files with one NodeJS multipart upload and use the returned resource records in later calls.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Upload Multiple Files to pdfRest with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Stage multiple local files with one NodeJS multipart upload and use the returned resource records in later calls.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Upload Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fupload-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fupload API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fupload-files\"\n        }\n      ],\n      \"keywords\": \"JavaScript, Upload Files\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Upload Multiple Files to pdfRest with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11210,11211,11212,11213],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1911,"name":1912,"slug":1913,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-upload-multiple-files-to-pdfrest-with-javascript-in-nodejs\u002F","Upload Multiple Files to pdfRest with JavaScript in NodeJS | pdfRest",{"id":11218,"uuid":11219,"title":11220,"slug":11221,"html":11222,"comment_id":11218,"feature_image":48,"featured":284,"visibility":1257,"created_at":11206,"updated_at":11223,"published_at":11223,"custom_excerpt":11224,"codeinjection_head":11225,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11226,"primary_tag":11231,"url":11232,"excerpt":11224,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11233,"meta_description":11224,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a977076533c9f26b943b82e","f2ccb5dc-da8b-43e4-a25e-5554d3a2f2b7","How to Upload Multiple Files to pdfRest with PHP","how-to-upload-multiple-files-to-pdfrest-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This step-by-step guide demonstrates how to upload multiple files to pdfRest in one multipart request from a PHP application through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fupload-files\u002F\">Upload Files API Tool\u003C\u002Fa>. Along the way, we'll distinguish the PHP syntax from the Upload Multiple to pdfRest API contract and show how its returned data supports the next step.\u003C\u002Fp>\n\n\u003Ch2>Why Upload Multiple Files to pdfRest with PHP?\u003C\u002Fh2>\n\n\u003Cp>Document assembly and batch processing often require several inputs before the next operation can begin. Upload Files can stage those resources together and return one response describing every accepted file.\u003C\u002Fp>\n\n\u003Cp>A PHP claims application might upload a signed form, supporting photograph, and spreadsheet in one call. It can preserve the filename-to-ID mapping and then choose the correct resource for attachment, conversion, or merging steps.\u003C\u002Fp>\n\n\u003Cp>Each file is represented by a separate multipart part with the same \u003Ccode>file\u003C\u002Fcode> field name. Repeating the field is intentional; sending one comma-separated path would not create three uploaded resources.\u003C\u002Fp>\n\n\u003Ch2>PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the first file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile1', 'r'), \u002F\u002F Open the first file for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile1', \u002F\u002F Set the filename for the first file to be uploaded.\n      'headers' => [\n        'Content-Type' => '\u003CContent-type header for file1>' \u002F\u002F Set the Content-Type header for the first file.\n      ]\n    ],\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the second file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile2', 'r'), \u002F\u002F Open the second file for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile2', \u002F\u002F Set the filename for the second file to be uploaded.\n      'headers' => [\n        'Content-Type' => '\u003CContent-type header for file2>' \u002F\u002F Set the Content-Type header for the second file.\n      ]\n    ],\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the third file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile3', 'r'), \u002F\u002F Open the third file for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile3', \u002F\u002F Set the filename for the third file to be uploaded.\n      'headers' => [\n        'Content-Type' => '\u003CContent-type header for file3>' \u002F\u002F Set the Content-Type header for the third file.\n      ]\n    ]\n  ]\n];\n\n$request = new Request('POST', $apiUrl.'\u002Fupload', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body.\u003C\u002Fpre>\n\n\u003Cp>Source for Upload Multiple to pdfRest: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fupload.php\">View the PHP sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load Guzzle and its stream helpers\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\u003C\u002Fpre>\n\n\u003Cp>Guzzle supplies the HTTP client and PSR-7 request objects used throughout the Upload Multiple to pdfRest example. For this PHP Upload Multiple to pdfRest flow, \u003Ccode>Utils::tryFopen\u003C\u002Fcode> creates readable multipart streams without loading every uploaded byte into one string.\u003C\u002Fp>\n\n\u003Ch3>Select the pdfRest service region\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\u003C\u002Fpre>\n\n\u003Cp>The active \u003Ccode>$apiUrl\u003C\u002Fcode> selects the US service for Upload Multiple to pdfRest; the commented assignment shows the EU alternative. Keep the PHP uploads, request IDs, and generated resources for Upload Multiple to pdfRest on that same regional host.\u003C\u002Fp>\n\n\u003Ch3>Add each file as a repeated multipart part\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the first file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile1', 'r'), \u002F\u002F Open the first file for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile1', \u002F\u002F Set the filename for the first file to be uploaded.\n      'headers' => [\n        'Content-Type' => '\u003CContent-type header for file1>' \u002F\u002F Set the Content-Type header for the first file.\n      ]\n    ],\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the second file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile2', 'r'), \u002F\u002F Open the second file for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile2', \u002F\u002F Set the filename for the second file to be uploaded.\n      'headers' => [\n        'Content-Type' => '\u003CContent-type header for file2>' \u002F\u002F Set the Content-Type header for the second file.\n      ]\n    ],\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the third file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile3', 'r'), \u002F\u002F Open the third file for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile3', \u002F\u002F Set the filename for the third file to be uploaded.\n      'headers' => [\n        'Content-Type' => '\u003CContent-type header for file3>' \u002F\u002F Set the Content-Type header for the third file.\n      ]\n    ]\n  ]\n];\n\n$request = new Request('POST', $apiUrl.'\u002Fupload', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body.\u003C\u002Fpre>\n\n\u003Cp>Each local source is added by PHP under another \u003Ccode>file\u003C\u002Fcode> part in the same multipart body. The Upload Multiple to pdfRest response returns several resources whose filenames and IDs the PHP caller should keep paired.\u003C\u002Fp>\n\n\u003Ch3>Send the multipart upload\u003C\u002Fh3>\n\n\u003Cpre class=\"language-php\">$request = new Request('POST', $apiUrl.'\u002Fupload', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body.\u003C\u002Fpre>\n\n\u003Cp>The PHP request joins the Upload Multiple to pdfRest endpoint, authentication header, and prepared body. For this Upload Multiple to pdfRest call, the multipart metadata generated by PHP must remain paired with the body so pdfRest can separate files from options.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You now know how PHP can send several files in one multipart body and preserve the resource information returned for each upload.\u003C\u002Fp>\n\n\u003Cp>Confirm that the response contains every expected input and store each ID beside its filename rather than relying only on array position. Partial or reordered application data should not cause a later workflow to process the wrong document.\u003C\u002Fp>\n\n\u003Cp>Try the Upload Multiple to pdfRest workflow with a representative file in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, then adapt the request in PHP. The \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fupload-files\u002F\">Upload Files API Tool documentation\u003C\u002Fa> provides the complete PHP context for Upload Multiple to pdfRest values, defaults, and limitations.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-03T17:04:44.000+00:00","Upload several files in one PHP multipart request and retain the resource IDs returned for later document workflows.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-with-php\u002F#article\",\n      \"headline\": \"How to Upload Multiple Files to pdfRest with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-with-php\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Upload several files in one PHP multipart request and retain the resource IDs returned for later document workflows.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Upload Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fupload-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fupload API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fupload-files\"\n        }\n      ],\n      \"keywords\": \"PHP, Upload Files\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Upload Multiple Files to pdfRest with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11227,11228,11229,11230],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1911,"name":1912,"slug":1913,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-upload-multiple-files-to-pdfrest-with-php\u002F","Upload Multiple Files to pdfRest with PHP | pdfRest",{"id":11235,"uuid":11236,"title":11237,"slug":11238,"html":11239,"comment_id":11235,"feature_image":48,"featured":284,"visibility":1257,"created_at":11206,"updated_at":11223,"published_at":11223,"custom_excerpt":11240,"codeinjection_head":11241,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11242,"primary_tag":11247,"url":11248,"excerpt":11240,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11249,"meta_description":11240,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a977076533c9f26b943b840","4650ffd4-2959-4314-8588-f1953b81d599","How to Upload Multiple Files to pdfRest with Python","how-to-upload-multiple-files-to-pdfrest-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Cp>In this tutorial, we'll use Python and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fupload-files\u002F\">Upload Files API Tool\u003C\u002Fa> to upload multiple files to pdfRest in one multipart request. The complete Upload Multiple to pdfRest repository sample stays visible while we explain the request fields and response behavior a Python application must adapt safely.\u003C\u002Fp>\n\n\u003Ch2>Why Upload Multiple Files to pdfRest with Python?\u003C\u002Fh2>\n\n\u003Cp>Batch-oriented Python applications may need to stage a related collection before they can merge, compare, or transform it. One Upload Files request can transfer the collection and return managed IDs for each member.\u003C\u002Fp>\n\n\u003Cp>A research archive could upload a report, source image, and data appendix together, then associate each response entry with the ingest record. Later jobs can reference the right ID without reopening the original local file.\u003C\u002Fp>\n\n\u003Cp>The sample creates an array of repeated \u003Ccode>(\"file\", file_tuple)\u003C\u002Fcode> entries because a dictionary cannot represent the same multipart field more than once. \u003Ccode>MultipartEncoder\u003C\u002Fcode> serializes that ordered list with the correct boundary.\u003C\u002Fp>\n\n\u003Ch2>Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\n\nupload_endpoint_url = api_url+'\u002Fupload'\n\n# The \u002Fupload endpoint can take one or more files or urls as input and transfers them to the pdfRest server for processing.\n# This sample takes 3 files and uploads it to the pdfRest service.\nupload_request_data = []\n\n# Array of tuples that contains information about the file that will be uploaded to the pdfRest server.\n# The 'application\u002Fpdf' string below is known as a MIME type, which is a label used to identify the type of a file so that it is handled properly by software.\n# Please see https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FWeb\u002FHTTP\u002FBasics_of_HTTP\u002FMIME_types\u002FCommon_types for more information about MIME types.\nfiles = [\n    ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n    ('file_name2.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n    ('file_name.jpg', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'image\u002Fjpeg')\n]\n\n# Structure the data that will be sent to POST upload request as an array of tuples\nfor i in range(len(files)):\n    upload_request_data.append((\"file\", files[i]))\n\nmp_encoder_upload = MultipartEncoder(\n    fields=upload_request_data\n)\n\n# Let's set the headers that the upload endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_upload.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to upload endpoint...\")\nresponse = requests.post(upload_endpoint_url, data=mp_encoder_upload, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\u003C\u002Fpre>\n\n\u003Cp>Source for Upload Multiple to pdfRest: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fupload.py\">View the Python sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Import the HTTP and multipart helpers\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\u003C\u002Fpre>\n\n\u003Cp>\u003Ccode>requests\u003C\u002Fcode> handles the HTTP exchange for Upload Multiple to pdfRest, while \u003Ccode>MultipartEncoder\u003C\u002Fcode> constructs form-data bodies with a boundary that the request header can reuse. The remaining Python modules support the response or timing behavior used specifically by Upload Multiple to pdfRest.\u003C\u002Fp>\n\n\u003Ch3>Select the pdfRest service region\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\"># By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\n\nupload_endpoint_url = api_url+'\u002Fupload'\u003C\u002Fpre>\n\n\u003Cp>The Python configuration keeps the pdfRest hostname separate from each Upload Multiple to pdfRest route. Using one regional base URL throughout this Python Upload Multiple to pdfRest job keeps its returned identifiers available to later requests.\u003C\u002Fp>\n\n\u003Ch3>Create the ordered repeated-file fields\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\">upload_request_data = []\n\n# Array of tuples that contains information about the file that will be uploaded to the pdfRest server.\n# The 'application\u002Fpdf' string below is known as a MIME type, which is a label used to identify the type of a file so that it is handled properly by software.\n# Please see https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FWeb\u002FHTTP\u002FBasics_of_HTTP\u002FMIME_types\u002FCommon_types for more information about MIME types.\nfiles = [\n    ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n    ('file_name2.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n    ('file_name.jpg', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'image\u002Fjpeg')\n]\n\n# Structure the data that will be sent to POST upload request as an array of tuples\nfor i in range(len(files)):\n    upload_request_data.append((\"file\", files[i]))\n\nmp_encoder_upload = MultipartEncoder(\n    fields=upload_request_data\n)\n\n# Let's set the headers that the upload endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\u003C\u002Fpre>\n\n\u003Cp>Each local source is added by Python under another \u003Ccode>file\u003C\u002Fcode> part in the same multipart body. The Upload Multiple to pdfRest response returns several resources whose filenames and IDs the Python caller should keep paired.\u003C\u002Fp>\n\n\u003Ch3>Send the encoded multipart request\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_upload.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to upload endpoint...\")\nresponse = requests.post(upload_endpoint_url, data=mp_encoder_upload, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\u003C\u002Fpre>\n\n\u003Cp>The Python request joins the Upload Multiple to pdfRest endpoint, authentication header, and prepared body. For this Upload Multiple to pdfRest call, the multipart metadata generated by Python must remain paired with the body so pdfRest can separate files from options.\u003C\u002Fp>\n\n\u003Ch3>Inspect the upload response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\u003C\u002Fpre>\n\n\u003Cp>The final Upload Multiple to pdfRest handling in Python exposes the HTTP result and JSON body. Before using a Upload Multiple to pdfRest output or request ID, production Python code should verify the status and retain the identifier required by the next step.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>You now know how Python can send several files in one multipart body and preserve the resource information returned for each upload.\u003C\u002Fp>\n\n\u003Cp>Open files with controlled lifetimes in long-running services and validate that the response count matches the request count. Store IDs with filenames and clean up temporary resources when downstream processing has finished.\u003C\u002Fp>\n\n\u003Cp>Try the Upload Multiple to pdfRest workflow with a representative file in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>, then adapt the request in Python. The \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fupload-files\u002F\">Upload Files API Tool documentation\u003C\u002Fa> provides the complete Python context for Upload Multiple to pdfRest values, defaults, and limitations.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Build a Python multipart upload containing several files and capture their pdfRest resource records for later processing.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-with-python\u002F#article\",\n      \"headline\": \"How to Upload Multiple Files to pdfRest with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-with-python\u002F\",\n      \"datePublished\": \"2026-09-03T00:00:00.000Z\",\n      \"dateModified\": \"2026-09-03T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Build a Python multipart upload containing several files and capture their pdfRest resource records for later processing.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Upload Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fupload-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fupload API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fupload-files\"\n        }\n      ],\n      \"keywords\": \"Python, Upload Files\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Upload Multiple Files to pdfRest with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-upload-multiple-files-to-pdfrest-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11243,11244,11245,11246],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1911,"name":1912,"slug":1913,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-upload-multiple-files-to-pdfrest-with-python\u002F","Upload Multiple Files to pdfRest with Python | pdfRest",{"id":11251,"uuid":11252,"title":11253,"slug":11254,"html":11255,"comment_id":11251,"feature_image":48,"featured":284,"visibility":1257,"created_at":11256,"updated_at":11189,"published_at":11256,"custom_excerpt":11257,"codeinjection_head":11258,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11259,"primary_tag":11269,"url":11270,"excerpt":11257,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11271,"meta_description":11257,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"66ab986b533c9f26b94380b4","7a811d62-ef58-4d5e-8101-328b5f6d0468","How to Use OCR to Extract Text from PDF Images in .NET with C#","how-to-use-ocr-to-extract-text-from-pdf-images-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use OCR to Extract Text from PDF with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest OCR PDF API Tool is a powerful resource for converting scanned documents and images into searchable and extractable text. This tutorial will show you how to send API calls to OCR PDF and Extract Text with C#, making it easier to integrate OCR functionality into your C# applications.\u003C\u002Fp>\n\n\u003Cp>Imagine you have a large collection of scanned documents that you need to search through for specific information. Manually transcribing these documents would be time-consuming and error-prone. By using the OCR PDF and Extract Text API Tools, you can automate the process of extracting text from these documents, making them searchable and editable, thus saving time and improving accuracy.\u003C\u002Fp>\n\n\u003Ch2>PDF OCR Text Extraction with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using Newtonsoft.Json.Linq;\nusing System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass OcrWithExtractText\n{\n    private static readonly string apiKey = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"; \u002F\u002F Your API key here\n\n    static async Task Main(string[] args)\n    {\n        using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n        {\n            \u002F\u002F Upload PDF for OCR\n            using var ocrRequest = new HttpRequestMessage(HttpMethod.Post, \"pdf-with-ocr-text\");\n\n            ocrRequest.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\n            ocrRequest.Headers.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue(\"application\u002Fjson\"));\n            var ocrMultipartContent = new MultipartFormDataContent();\n\n            var pdfByteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\n            var pdfByteArrayContent = new ByteArrayContent(pdfByteArray);\n            ocrMultipartContent.Add(pdfByteArrayContent, \"file\", \"file.pdf\");\n            pdfByteArrayContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n            ocrRequest.Content = ocrMultipartContent;\n            var ocrResponse = await httpClient.SendAsync(ocrRequest);\n\n            var ocrResult = await ocrResponse.Content.ReadAsStringAsync();\n            Console.WriteLine(\"OCR response received.\");\n            Console.WriteLine(ocrResult);\n\n            dynamic ocrResponseData = JObject.Parse(ocrResult);\n            string ocrPDFID = ocrResponseData.outputId;\n\n            \u002F\u002F Extract text from OCR'd PDF\n            using var extractTextRequest = new HttpRequestMessage(HttpMethod.Post, \"extracted-text\");\n\n            extractTextRequest.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\n            extractTextRequest.Headers.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue(\"application\u002Fjson\"));\n            var extractTextMultipartContent = new MultipartFormDataContent();\n\n            var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(ocrPDFID));\n            extractTextMultipartContent.Add(byteArrayOption, \"id\");\n\n            extractTextRequest.Content = extractTextMultipartContent;\n            var extractTextResponse = await httpClient.SendAsync(extractTextRequest);\n\n            var extractTextResult = await extractTextResponse.Content.ReadAsStringAsync();\n            Console.WriteLine(\"Extract text response received.\");\n            Console.WriteLine(extractTextResult);\n\n            dynamic extractTextResponseData = JObject.Parse(extractTextResult);\n            string fullText = extractTextResponseData.fullText;\n\n            Console.WriteLine(\"Extracted text:\");\n            Console.WriteLine(fullText);\n        }\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FComplex%20Flow%20Examples\u002Focr-with-extract-text.cs\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>Let's break down the provided code to understand how it works:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">private static readonly string apiKey = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"; \u002F\u002F Your API key here\n\u003C\u002Fpre>\n\n\u003Cp>This line defines the API key required to authenticate your requests to the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>Here, we create an instance of \u003Ccode>HttpClient\u003C\u002Fcode> with the base address set to the pdfRest API URL.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using var ocrRequest = new HttpRequestMessage(HttpMethod.Post, \"pdf-with-ocr-text\");\n\u003C\u002Fpre>\n\n\u003Cp>This line initializes a new HTTP POST request to the \u003Ccode>pdf-with-ocr-text\u003C\u002Fcode> endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">ocrRequest.Headers.TryAddWithoutValidation(\"Api-Key\", apiKey);\nocrRequest.Headers.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue(\"application\u002Fjson\"));\n\u003C\u002Fpre>\n\n\u003Cp>These lines add the necessary headers to the request, including the API key and the expected response format (JSON).\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var pdfByteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\nvar pdfByteArrayContent = new ByteArrayContent(pdfByteArray);\nocrMultipartContent.Add(pdfByteArrayContent, \"file\", \"file.pdf\");\npdfByteArrayContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\u003C\u002Fpre>\n\n\u003Cp>Here, we read the PDF file into a byte array and add it to the request content as a multipart form data. The content type is set to \u003Ccode>application\u002Fpdf\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var ocrResponse = await httpClient.SendAsync(ocrRequest);\nvar ocrResult = await ocrResponse.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>We send the OCR request and read the response content as a string.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">dynamic ocrResponseData = JObject.Parse(ocrResult);\nstring ocrPDFID = ocrResponseData.outputId;\n\u003C\u002Fpre>\n\n\u003Cp>The response is parsed as a JSON object, and the output ID of the OCR'd PDF is extracted.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using var extractTextRequest = new HttpRequestMessage(HttpMethod.Post, \"extracted-text\");\n\u003C\u002Fpre>\n\n\u003Cp>We initialize a new HTTP POST request to the \u003Ccode>extracted-text\u003C\u002Fcode> endpoint for extracting text from the OCR'd PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(ocrPDFID));\nextractTextMultipartContent.Add(byteArrayOption, \"id\");\n\u003C\u002Fpre>\n\n\u003Cp>The OCR'd PDF ID is added to the request content as a multipart form data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var extractTextResponse = await httpClient.SendAsync(extractTextRequest);\nvar extractTextResult = await extractTextResponse.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>We send the extract text request and read the response content as a string.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">dynamic extractTextResponseData = JObject.Parse(extractTextResult);\nstring fullText = extractTextResponseData.fullText;\n\u003C\u002Fpre>\n\n\u003Cp>The response is parsed as a JSON object, and the extracted text is retrieved.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we demonstrated how to use the pdfRest OCR PDF API tool with the Extract Text API tool to extract image-based text from a PDF using C#. By following these steps, you can integrate OCR functionality into your own C# applications.\u003C\u002Fp>\n\n\u003Cp>To explore more functionalities, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-08-01T14:15:07.000+00:00","Learn how to extract all text from a PDF using pdfRest OCR PDF and Extract Text API Tools with C#","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Use OCR to Extract Text from PDF Images in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-08-01T14:15:07.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:26.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to extract all text from a PDF using pdfRest OCR PDF and Extract Text API Tools with C#\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Extract Text API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fextracted-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-text\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"OCR PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Focr-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-ocr-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Focr-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Data, Extract, Extract Text, OCR, OCR PDF, Text\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Use OCR to Extract Text from PDF Images in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11260,11261,11262,11263,11264,11265,11266,11267,11268],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1488,"name":1489,"slug":1490,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1492,"name":1493,"slug":1494,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1476,"name":1477,"slug":1478,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-in-net-with-c\u002F","How to Use OCR to Extract Text from PDF Images in .NET with C#, Tutorial | pdfRest",{"id":11273,"uuid":11274,"title":11275,"slug":11276,"html":11277,"comment_id":11273,"feature_image":48,"featured":284,"visibility":1257,"created_at":11278,"updated_at":11279,"published_at":11278,"custom_excerpt":11280,"codeinjection_head":11281,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11282,"primary_tag":11292,"url":11293,"excerpt":11280,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11294,"meta_description":11280,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"66ab9a81533c9f26b94380c8","8dfbadfa-f6b0-4512-a851-4b56ceff1979","How to Use OCR to Extract Text from PDF Images with cURL","how-to-use-ocr-to-extract-text-from-pdf-images-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use OCR to Extract Text from PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest OCR PDF API Tool is a powerful resource that allows you to convert scanned documents into PDFs with searchable and extractable text using Optical Character Recognition (OCR). This tutorial will guide you through the process of sending API calls to OCR PDF and Extract Text with cURL, a command-line tool for transferring data using various network protocols.\u003C\u002Fp>\n\n\u003Cp>Imagine you have a stack of scanned documents that you need to analyze in aggregrate. For instance, a law firm might have hundreds of pages of legal documents that need to be assessed. Using the pdfRest OCR PDF and Extract Text API Tools, you can automate this process, extracting all text for further processing or analysis.\u003C\u002Fp>\n\n\u003Ch2>PDF OCR Text Extraction with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">#!\u002Fbin\u002Fsh\n\n# In this sample, we will show how to convert a scanned document into a PDF with\n# searchable and extractable text using Optical Character Recognition (OCR), and then\n# extract that text from the newly created document.\n#\n# First, we will upload a scanned PDF to the \u002Fpdf-with-ocr-text route and capture the\n# output ID. Then, we will send the output ID to the \u002Fextracted-text route, which will\n# return the newly added text.\n\nAPI_KEY=\"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" # Replace with your API key\n\n# Upload PDF for OCR\nOCR_PDF_ID=$(curl -s -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-ocr-text\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: $API_KEY\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile.pdf\" \\\n  -F \"output=example_pdf-with-ocr-text_out\"\\\n  | jq -r '.outputId')\n\n\n# Extract text from OCR'd PDF\nEXTRACT_TEXT_RESPONSE=$(curl -s -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fextracted-text\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: $API_KEY\" \\\n  -F \"id=$OCR_PDF_ID\")\n\n\nFULL_TEXT=$(echo $EXTRACT_TEXT_RESPONSE | jq -r '.fullText')\necho \"Extracted text: $FULL_TEXT\"\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FComplex%20Flow%20Examples\u002Focr-with-extract-text.sh\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The script begins by defining the API key:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">API_KEY=\"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" # Replace with your API key\u003C\u002Fpre>\n\n\u003Cp>Replace the placeholder with your actual API key from pdfRest.\u003C\u002Fp>\n\n\u003Cp>Next, we upload the PDF for OCR processing:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">OCR_PDF_ID=$(curl -s -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-ocr-text\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: $API_KEY\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile.pdf\" \\\n  -F \"output=example_pdf-with-ocr-text_out\"\\\n  | jq -r '.outputId')\u003C\u002Fpre>\n\n\u003Cp>This cURL command sends a POST request to the \u003Ccode>https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-ocr-text\u003C\u002Fcode> endpoint. The headers specify that the request accepts JSON responses and that the content type is multipart\u002Fform-data. The \u003Ccode>-F\u003C\u002Fcode> flag is used to specify the file to upload and the desired output name. The \u003Ccode>jq\u003C\u002Fcode> command extracts the \u003Ccode>outputId\u003C\u002Fcode> from the JSON response.\u003C\u002Fp>\n\n\u003Cp>Then, we extract the text from the OCR'd PDF:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">EXTRACT_TEXT_RESPONSE=$(curl -s -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fextracted-text\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: $API_KEY\" \\\n  -F \"id=$OCR_PDF_ID\")\u003C\u002Fpre>\n\n\u003Cp>This cURL command sends another POST request, this time to the \u003Ccode>https:\u002F\u002Fapi.pdfrest.com\u002Fextracted-text\u003C\u002Fcode> endpoint. The \u003Ccode>id\u003C\u002Fcode> parameter is set to the \u003Ccode>outputId\u003C\u002Fcode> obtained from the previous step.\u003C\u002Fp>\n\n\u003Cp>Finally, we extract and print the full text:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">FULL_TEXT=$(echo $EXTRACT_TEXT_RESPONSE | jq -r '.fullText')\necho \"Extracted text: $FULL_TEXT\"\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>jq\u003C\u002Fcode> command extracts the \u003Ccode>fullText\u003C\u002Fcode> field from the JSON response, and the script prints the extracted text.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use cURL to send an API call to the pdfRest OCR PDF API Tool and extract the text from the OCR'd PDF. This process can be incredibly useful for PDF image-based text extraction.\u003C\u002Fp>\n\n\u003Cp>To explore more functionalities, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on each endpoint, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-08-01T14:24:01.000+00:00","2026-09-02T18:29:44.000+00:00","Learn how to use pdfRest OCR PDF and Extract Text API Tools to extract all text from a PDF with cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-curl\u002F#article\",\n      \"headline\": \"How to Use OCR to Extract Text from PDF Images with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-curl\u002F\",\n      \"datePublished\": \"2024-08-01T14:24:01.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:26.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest OCR PDF and Extract Text API Tools to extract all text from a PDF with cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Extract Text API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fextracted-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-text\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"OCR PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Focr-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-ocr-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Focr-pdf\"\n        }\n      ],\n      \"keywords\": \"Data, Extract, Extract Text, OCR, OCR PDF, Text, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Use OCR to Extract Text from PDF Images with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11283,11284,11285,11286,11287,11288,11289,11290,11291],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1488,"name":1489,"slug":1490,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1492,"name":1493,"slug":1494,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1476,"name":1477,"slug":1478,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-curl\u002F","How to Use OCR to Extract Text from PDF Images with cURL, Tutorial | pdfRest",{"id":11296,"uuid":11297,"title":11298,"slug":11299,"html":11300,"comment_id":11296,"feature_image":48,"featured":284,"visibility":1257,"created_at":11087,"updated_at":11279,"published_at":11088,"custom_excerpt":11301,"codeinjection_head":11302,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11303,"primary_tag":11313,"url":11314,"excerpt":11301,"reading_time":369,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11315,"meta_description":11301,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c61533c9f26b943b5c0","4bcfbaf0-3ddb-4a88-aab4-49b233f80480","How to Use OCR to Extract Text from PDF Images with Java","how-to-use-ocr-to-extract-text-from-pdf-images-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>In the following tutorial, you'll use Java and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Focr-pdf\u002F\">OCR PDF API Tool\u003C\u002Fa> to use OCR to extract text from PDF images. The complex flow passes the OCR output ID directly into Extract Text, avoiding a download and re-upload between operations. The example is designed to clarify both the API-specific fields and the surrounding HTTP request used to use OCR to extract text from PDF images.\u003C\u002Fp>\n\n\u003Ch2>Why Use OCR to Extract Text from PDF Images with Java?\u003C\u002Fh2>\n\n\u003Cp>A scanned document may contain visible words but no searchable text objects. The two-step workflow first adds an OCR text layer and then extracts that recognized content for indexing or analysis.\u003C\u002Fp>\n\n\u003Cp>The Complex Flow example passes the OCR call’s \u003Ccode>outputId\u003C\u002Fcode> into \u003Ccode>\u002Fextracted-text\u003C\u002Fcode>. This resource-ID handoff avoids downloading and uploading the intermediate PDF.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\n\u002F* In this sample, we will show how to convert a scanned document into a PDF with\n * searchable and extractable text using Optical Character Recognition (OCR), and then\n * extract that text from the newly created document.\n *\n * First, we will upload a scanned PDF to the \u002Fpdf-with-ocr-text route and capture the\n * output ID. Then, we will send the output ID to the \u002Fextracted-text route, which will\n * return the newly added text.\n *\u002F\n\npublic class OcrWithExtractText {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your PDF file here, or as the first argument when running the program.\n  private static final String DEFAULT_PDF_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File pdfFile;\n    if (args.length > 0) {\n      pdfFile = new File(args[0]);\n    } else {\n      pdfFile = new File(DEFAULT_PDF_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody pdfFileRequestBody =\n        RequestBody.create(pdfFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody ocrRequestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", pdfFile.getName(), pdfFileRequestBody)\n            .addFormDataPart(\"output\", \"example_pdf-with-ocr-text_out\")\n            .build();\n    Request ocrRequest =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf-with-ocr-text\")\n            .post(ocrRequestBody)\n            .build();\n    try {\n      OkHttpClient ocrClient =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response ocrResponse = ocrClient.newCall(ocrRequest).execute();\n\n      System.out.println(\"Response status code: \" + ocrResponse.code());\n      if (ocrResponse.body() != null) {\n        String ocrResponseString = ocrResponse.body().string();\n\n        JSONObject ocrJSON = new JSONObject(ocrResponseString);\n        if (ocrJSON.has(\"error\")) {\n          System.out.println(\"Error during OCR call: \" + ocrResponseString);\n          return;\n        }\n\n        String ocrPDFID = ocrJSON.get(\"outputId\").toString();\n        System.out.println(\"Got the output ID: \" + ocrPDFID);\n\n        RequestBody extractRequestBody =\n            new MultipartBody.Builder()\n                .setType(MultipartBody.FORM)\n                .addFormDataPart(\"id\", ocrPDFID)\n                .build();\n        Request extractRequest =\n            new Request.Builder()\n                .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n                .url(API_URL + \"\u002Fextracted-text\")\n                .post(extractRequestBody)\n                .build();\n        try {\n          OkHttpClient extractClient =\n              new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n          Response extractResponse = extractClient.newCall(extractRequest).execute();\n\n          System.out.println(\"Response status code: \" + extractResponse.code());\n          if (extractResponse.body() != null) {\n            String extractResponseString = extractResponse.body().string();\n\n            JSONObject extractJSON = new JSONObject(extractResponseString);\n            if (extractJSON.has(\"error\")) {\n              System.out.println(\"Error during text extraction call: \" + extractResponseString);\n              return;\n            }\n\n            System.out.println(extractJSON.getString(\"fullText\"));\n          }\n        } catch (IOException e) {\n          throw new RuntimeException(e);\n        }\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FComplex%20Flow%20Examples\u002FOcrWithExtractText.java\">Java sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>This client combines OkHttp networking with dotenv configuration and \u003Ccode>org.json\u003C\u002Fcode> processing.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your PDF file here, or as the first argument when running the program.\n  private static final String DEFAULT_PDF_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File pdfFile;\n    if (args.length > 0) {\n      pdfFile = new File(args[0]);\n    } else {\n      pdfFile = new File(DEFAULT_PDF_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody pdfFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>The sample configuration separates file selection from authentication so either value can change without rewriting the request.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody pdfFileRequestBody =\n        RequestBody.create(pdfFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody ocrRequestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", pdfFile.getName(), pdfFileRequestBody)\n            .addFormDataPart(\"output\", \"example_pdf-with-ocr-text_out\")\n            .build();\n    Request ocrRequest =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf-with-ocr-text\")\n            .post(ocrRequestBody)\n            .build();\n    try {\n      OkHttpClient ocrClient =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The Complex Flow example passes the OCR call’s \u003Ccode>outputId\u003C\u002Fcode> into \u003Ccode>\u002Fextracted-text\u003C\u002Fcode>. This resource-ID handoff avoids downloading and uploading the intermediate PDF. This request body collects the named parts before OkHttp calculates the final multipart header and body encoding.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request ocrRequest =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf-with-ocr-text\")\n            .post(ocrRequestBody)\n            .build();\n    try {\n      OkHttpClient ocrClient =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The HTTP request adds the API key header, selects the operation URL, and attaches the prepared body; changing the base constant switches between US and EU service hosts.\u003C\u002Fp>\n\n\u003Ch3>Pass resources between workflow stages\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">if (ocrJSON.has(\"error\")) {\n          System.out.println(\"Error during OCR call: \" + ocrResponseString);\n          return;\n        }\n\n        String ocrPDFID = ocrJSON.get(\"outputId\").toString();\n        System.out.println(\"Got the output ID: \" + ocrPDFID);\n\n        RequestBody extractRequestBody =\n            new MultipartBody.Builder()\n                .setType(MultipartBody.FORM)\n                .addFormDataPart(\"id\", ocrPDFID)\n                .build();\n        Request extractRequest =\n            new Request.Builder()\n                .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\u003C\u002Fpre>\n\n\u003Cp>In the Use OCR to Extract Text from PDF Images workflow, Java reads the generated resource ID from one response and supplies it to the next endpoint, avoiding a download and another upload of the intermediate file.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">OkHttpClient ocrClient =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response ocrResponse = ocrClient.newCall(ocrRequest).execute();\n\n      System.out.println(\"Response status code: \" + ocrResponse.code());\n      if (ocrResponse.body() != null) {\n        String ocrResponseString = ocrResponse.body().string();\n\n        JSONObject ocrJSON = new JSONObject(ocrResponseString);\n        if (ocrJSON.has(\"error\")) {\n          System.out.println(\"Error during OCR call: \" + ocrResponseString);\n          return;\n        }\n\n        String ocrPDFID = ocrJSON.get(\"outputId\").toString();\u003C\u002Fpre>\n\n\u003Cp>The first response supplies the OCR PDF resource ID, while the second returns the recognized text; the example checks both stages for errors before printing \u003Ccode>fullText\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>We have now covered the request and response flow for using Java to use OCR to extract text from PDF images. With that foundation, you can use OCR plus extraction for scanned correspondence, historical records, receipts, and image-based document archives.\u003C\u002Fp>\n\n\u003Cp>Before relying on the result in an automated workflow, keep in mind that recognition quality depends on scan resolution, orientation, language, and image clarity, so test the actual document population. Preserve both the searchable PDF ID and extracted text when later steps need visual verification of what OCR recognized.\u003C\u002Fp>\n\n\u003Cp>Continue testing representative documents with the Use OCR to Extract Text from PDF Images operation in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. The \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Focr-pdf\u002F\">OCR PDF API Tool documentation\u003C\u002Fa> provides authoritative defaults, accepted fields, and limitations for the Use OCR to Extract Text from PDF Images operation.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Apply OCR and then extract the recognized text from image-only PDFs with Java.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-java\u002F#article\",\n      \"headline\": \"How to Use OCR to Extract Text from PDF Images with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:41.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:41.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Apply OCR and then extract the recognized text from image-only PDFs with Java.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Extract Text API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fextracted-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-text\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"OCR PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Focr-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-ocr-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Focr-pdf\"\n        }\n      ],\n      \"keywords\": \"Data, Extract, Extract Text, Java, OCR, OCR PDF, Text\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Use OCR to Extract Text from PDF Images with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11304,11305,11306,11307,11308,11309,11310,11311,11312],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1488,"name":1489,"slug":1490,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1492,"name":1493,"slug":1494,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1476,"name":1477,"slug":1478,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-java\u002F","Use OCR to Extract Text from PDF Images with Java | pdfRest",{"id":11317,"uuid":11318,"title":11319,"slug":11320,"html":11321,"comment_id":11317,"feature_image":48,"featured":284,"visibility":1257,"created_at":11322,"updated_at":11279,"published_at":11322,"custom_excerpt":11323,"codeinjection_head":11324,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11325,"primary_tag":11335,"url":11336,"excerpt":11323,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11337,"meta_description":11323,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"66ab98c8533c9f26b94380be","e332f4e7-2f57-42ee-a126-fd244a779b0c","How to Use OCR to Extract Text from PDF Images with JavaScript in NodeJS","how-to-use-ocr-to-extract-text-from-pdf-images-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use OCR to Extract Text from PDF with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest OCR PDF API Tool allows developers to convert scanned documents into PDFs with searchable and extractable text using Optical Character Recognition (OCR). This tutorial will demonstrate how to send an API call to OCR a PDF and then use the Extract Text API Tool to extract the text using JavaScript, making your documents more accessible and easier to manage.\u003C\u002Fp>\n\n\u003Cp>Imagine you have a large collection of scanned documents, such as invoices or contracts, that you need to search through for specific information. By using OCR, you can convert these scanned images into text-searchable PDFs and then extract all text, enabling you to quickly locate the information you need without manually sifting through each document.\u003C\u002Fp>\n\n\u003Ch2>PDF OCR Text Extraction with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\n\n\u002F* In this sample, we will show how to convert a scanned document into a PDF with\n* searchable and extractable text using Optical Character Recognition (OCR), and then\n* extract that text from the newly created document.\n*\n* First, we will upload a scanned PDF to the \u002Fpdf-with-ocr-text route and capture the\n* output ID. Then, we will send the output ID to the \u002Fextracted-text route, which will\n* return the newly added text.\n*\u002F\n\nvar apiKey = \"xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"; \u002F\u002F Replace with your API key\n\nvar ocrData = new FormData();\nocrData.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile.pdf\"), \"file_name.pdf\");\nocrData.append(\"output\", \"example_pdf-with-ocr-text_out\");\n\nvar ocrConfig = {\n  method: \"post\",\n  maxBodyLength: Infinity,\n  url: \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-ocr-text\",\n  headers: {\n    \"Api-Key\": apiKey,\n    ...ocrData.getHeaders(),\n  },\n  data: ocrData,\n};\n\nconsole.log(\"Sending POST request to OCR endpoint...\");\naxios(ocrConfig)\n  .then(function (response) {\n    console.log(\"Response status code: \" + response.status);\n\n    if (response.status === 200) {\n      var ocrPDFID = response.data.outputId;\n      console.log(\"Got the output ID: \" + ocrPDFID);\n\n      var extractData = new FormData();\n      extractData.append(\"id\", ocrPDFID);\n\n      var extractConfig = {\n        method: \"post\",\n        maxBodyLength: Infinity,\n        url: \"https:\u002F\u002Fapi.pdfrest.com\u002Fextracted-text\",\n        headers: {\n          \"Api-Key\": apiKey,\n          ...extractData.getHeaders(),\n        },\n        data: extractData,\n      };\n\n      console.log(\"Sending POST request to extract text endpoint...\");\n      axios(extractConfig)\n        .then(function (extractResponse) {\n          console.log(\"Response status code: \" + extractResponse.status);\n\n          if (extractResponse.status === 200) {\n            console.log(extractResponse.data.fullText);\n          } else {\n            console.log(extractResponse.data);\n          }\n        })\n        .catch(function (error) {\n          console.log(error.response ? error.response.data : error.message);\n        });\n    } else {\n      console.log(response.data);\n    }\n  })\n  .catch(function (error) {\n    console.log(error.response ? error.response.data : error.message);\n  });\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FComplex%20Flow%20Examples\u002Focr-with-extract-text.js\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided code demonstrates how to use the pdfRest OCR PDF API Tool to convert a scanned document into a PDF with searchable text and then extract that text. Let's break down the code step-by-step:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require(\"axios\");\nvar FormData = require(\"form-data\");\nvar fs = require(\"fs\");\n\u003C\u002Fpre>\n\n\u003Cp>Here, we import the necessary modules: \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests, \u003Ccode>FormData\u003C\u002Fcode> for handling form data, and \u003Ccode>fs\u003C\u002Fcode> for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var apiKey = \"xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"; \u002F\u002F Replace with your API key\n\u003C\u002Fpre>\n\n\u003Cp>Replace the placeholder with your actual API key from pdfRest.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var ocrData = new FormData();\nocrData.append(\"file\", fs.createReadStream(\"\u002Fpath\u002Fto\u002Ffile.pdf\"), \"file_name.pdf\");\nocrData.append(\"output\", \"example_pdf-with-ocr-text_out\");\n\u003C\u002Fpre>\n\n\u003Cp>We create a new \u003Ccode>FormData\u003C\u002Fcode> object and append the scanned PDF file and an output identifier. The \u003Ccode>file\u003C\u002Fcode> field is the PDF to be processed, and the \u003Ccode>output\u003C\u002Fcode> field is a unique identifier for the output file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var ocrConfig = {\n  method: \"post\",\n  maxBodyLength: Infinity,\n  url: \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-ocr-text\",\n  headers: {\n    \"Api-Key\": apiKey,\n    ...ocrData.getHeaders(),\n  },\n  data: ocrData,\n};\n\u003C\u002Fpre>\n\n\u003Cp>We configure the POST request to the \u003Ccode>\u002Fpdf-with-ocr-text\u003C\u002Fcode> endpoint, including the API key and form data in the headers and body, respectively.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(ocrConfig)\n  .then(function (response) {\n    console.log(\"Response status code: \" + response.status);\n\n    if (response.status === 200) {\n      var ocrPDFID = response.data.outputId;\n      console.log(\"Got the output ID: \" + ocrPDFID);\n\u003C\u002Fpre>\n\n\u003Cp>We send the POST request and check if the response status is 200 (OK). If successful, we capture the \u003Ccode>outputId\u003C\u002Fcode> from the response, which is used to identify the processed PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">      var extractData = new FormData();\n      extractData.append(\"id\", ocrPDFID);\n\n      var extractConfig = {\n        method: \"post\",\n        maxBodyLength: Infinity,\n        url: \"https:\u002F\u002Fapi.pdfrest.com\u002Fextracted-text\",\n        headers: {\n          \"Api-Key\": apiKey,\n          ...extractData.getHeaders(),\n        },\n        data: extractData,\n      };\n\n      console.log(\"Sending POST request to extract text endpoint...\");\n      axios(extractConfig)\n        .then(function (extractResponse) {\n          console.log(\"Response status code: \" + extractResponse.status);\n\n          if (extractResponse.status === 200) {\n            console.log(extractResponse.data.fullText);\n          } else {\n            console.log(extractResponse.data);\n          }\n        })\n        .catch(function (error) {\n          console.log(error.response ? error.response.data : error.message);\n        });\n    } else {\n      console.log(response.data);\n    }\n  })\n  .catch(function (error) {\n    console.log(error.response ? error.response.data : error.message);\n  });\n\u003C\u002Fpre>\n\n\u003Cp>We create another \u003Ccode>FormData\u003C\u002Fcode> object with the \u003Ccode>outputId\u003C\u002Fcode> and configure a POST request to the \u003Ccode>\u002Fextracted-text\u003C\u002Fcode> endpoint. If successful, the extracted text is printed to the console.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use the pdfRest OCR PDF and Extract Text API Tools to convert a scanned document into a searchable PDF and extract the text using JavaScript. This process can be invaluable for managing and searching through large collections of scanned documents.\u003C\u002Fp>\n\n\u003Cp>To explore more functionalities, try out all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on each endpoint, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-08-01T14:16:40.000+00:00","Learn how to extract all text from a PDF using pdfRest OCR PDF and Extract Text API Tools with JavaScript ","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Use OCR to Extract Text from PDF Images with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-08-01T14:16:40.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:26.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to extract all text from a PDF using pdfRest OCR PDF and Extract Text API Tools with JavaScript \",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Extract Text API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fextracted-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-text\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"OCR PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Focr-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-ocr-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Focr-pdf\"\n        }\n      ],\n      \"keywords\": \"Data, Extract, Extract Text, JavaScript, OCR, OCR PDF, Text\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Use OCR to Extract Text from PDF Images with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11326,11327,11328,11329,11330,11331,11332,11333,11334],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1488,"name":1489,"slug":1490,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1492,"name":1493,"slug":1494,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1476,"name":1477,"slug":1478,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-javascript-in-nodejs\u002F","How to Use OCR to Extract Text from PDF Images with JavaScript in NodeJS, Tutorial | pdfRest",{"id":11339,"uuid":11340,"title":11341,"slug":11342,"html":11343,"comment_id":11339,"feature_image":48,"featured":284,"visibility":1257,"created_at":11344,"updated_at":11345,"published_at":11344,"custom_excerpt":11346,"codeinjection_head":11347,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11348,"primary_tag":11358,"url":11359,"excerpt":11346,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11360,"meta_description":11346,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"66ab9817533c9f26b94380aa","8f21a624-7998-4f8d-925b-58ddd586f1e4","How to Use OCR to Extract Text from PDF Images with PHP","how-to-use-ocr-to-extract-text-from-pdf-images-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use OCR to Extract Text from PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest OCR PDF API Tool is a powerful service that allows you to convert scanned documents into PDFs with searchable and extractable text using Optical Character Recognition (OCR). This tutorial will demonstrate how to send API calls to OCR PDF and Extract Text with PHP, enabling you to integrate OCR functionality into your PHP applications seamlessly.\u003C\u002Fp>\n\n\u003Cp>Imagine you have a large archive of scanned documents, such as invoices or historical records, that you need to search through or analyze. By using OCR, you can extract all text from these image-based documents, making it easier to find specific information. This can save significant time and effort compared to manually reviewing each document.\u003C\u002Fp>\n\n\u003Ch2>PDF OCR Text Extraction with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">\n\nrequire 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n\u002F* In this sample, we will show how to convert a scanned document into a PDF with\n * searchable and extractable text using Optical Character Recognition (OCR), and then\n * extract that text from the newly created document.\n *\n * First, we will upload a scanned PDF to the \u002Fpdf-with-ocr-text route and capture the\n * output ID. Then, we will send the output ID to the \u002Fextracted-text route, which will\n * return the newly added text.\n *\u002F\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' =--> 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Replace with your API key\n];\n\n\u002F\u002F Upload PDF for OCR\n$pdfToOCROptions = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile.pdf', 'r'),\n      'filename' => 'file.pdf',\n      'headers' => [\n        'Content-Type' => 'application\u002Fpdf'\n      ]\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'example_pdf-with-ocr-text_out'\n    ]\n  ]\n];\n\n$pdfToOCRRequest = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-ocr-text', $headers);\n\necho \"Sending POST request to OCR endpoint...\\n\";\n$pdfToOCRResponse = $client->sendAsync($pdfToOCRRequest, $pdfToOCROptions)->wait();\n\necho \"Response status code: \" . $pdfToOCRResponse->getStatusCode() . \"\\n\";\n\n$ocrPDFID = json_decode($pdfToOCRResponse->getBody())->outputId;\necho \"Got the output ID: \" . $ocrPDFID . \"\\n\";\n\n\u002F\u002F Extract text from OCR'd PDF\n$extractTextOptions = [\n  'multipart' => [\n    [\n      'name' => 'id',\n      'contents' => $ocrPDFID\n    ]\n  ]\n];\n\n$extractTextRequest = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fextracted-text', $headers);\n\necho \"Sending POST request to extract text endpoint...\\n\";\n$extractTextResponse = $client->sendAsync($extractTextRequest, $extractTextOptions)->wait();\n\necho \"Response status code: \" . $extractTextResponse->getStatusCode() . \"\\n\";\n\n$fullText = json_decode($extractTextResponse->getBody())->fullText;\necho $fullText . \"\\n\";\n\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FComplex%20Flow%20Examples\u002Focr-with-extract-text.php\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided PHP code uses the Guzzle HTTP client to interact with the pdfRest API. Here's a detailed breakdown of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\u003C\u002Fpre>\n\n\u003Cp>This section includes the necessary dependencies and namespaces. It uses Composer's autoload feature to load the Guzzle HTTP client and related classes.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$client = new Client();\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Replace with your API key\n];\n\u003C\u002Fpre>\n\n\u003Cp>Here, a new Guzzle HTTP client is instantiated, and the headers for the API request are defined. Replace 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$pdfToOCROptions = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile.pdf', 'r'),\n      'filename' => 'file.pdf',\n      'headers' => [\n        'Content-Type' => 'application\u002Fpdf'\n      ]\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'example_pdf-with-ocr-text_out'\n    ]\n  ]\n];\n\u003C\u002Fpre>\n\n\u003Cp>This section sets up the multipart form data for the OCR request. It includes the PDF file to be uploaded and a name for the output. Make sure to replace '\u002Fpath\u002Fto\u002Ffile.pdf' with the actual path to your PDF file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$pdfToOCRRequest = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-ocr-text', $headers);\n\u003C\u002Fpre>\n\n\u003Cp>A new POST request is created for the OCR endpoint using the specified headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$pdfToOCRResponse = $client->sendAsync($pdfToOCRRequest, $pdfToOCROptions)->wait();\n\u003C\u002Fpre>\n\n\u003Cp>The request is sent asynchronously, and the response is awaited. The status code of the response is then printed.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$ocrPDFID = json_decode($pdfToOCRResponse->getBody())->outputId;\n\u003C\u002Fpre>\n\n\u003Cp>The output ID from the OCR response is extracted and printed. This ID will be used in the next request to extract text.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$extractTextOptions = [\n  'multipart' => [\n    [\n      'name' => 'id',\n      'contents' => $ocrPDFID\n    ]\n  ]\n];\n\n$extractTextRequest = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fextracted-text', $headers);\n\u003C\u002Fpre>\n\n\u003Cp>This section sets up the multipart form data for the text extraction request. It includes the output ID obtained from the previous OCR request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$extractTextResponse = $client->sendAsync($extractTextRequest, $extractTextOptions)->wait();\n\u003C\u002Fpre>\n\n\u003Cp>The request is sent asynchronously, and the response is awaited. The status code of the response is then printed.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$fullText = json_decode($extractTextResponse->getBody())->fullText;\necho $fullText . \"\\n\";\n\u003C\u002Fpre>\n\n\u003Cp>The full text extracted from the OCR'd PDF is obtained from the response and printed.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use the pdfRest OCR PDF and Extract Text API Tools with PHP to convert a scanned document into a searchable PDF and extract the text. This process can be incredibly useful for digitizing and processing large volumes of scanned documents.\u003C\u002Fp>\n\n\u003Cp>To explore more functionalities offered by pdfRest, you can demo all the API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on all available endpoints and parameters, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-08-01T14:13:43.000+00:00","2026-09-02T18:29:45.000+00:00","Learn how to use pdfRest OCR PDF and Extract Text API Tools with PHP to extract all text from a PDF","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-php\u002F#article\",\n      \"headline\": \"How to Use OCR to Extract Text from PDF Images with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-php\u002F\",\n      \"datePublished\": \"2024-08-01T14:13:43.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:27.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest OCR PDF and Extract Text API Tools with PHP to extract all text from a PDF\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Extract Text API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fextracted-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-text\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"OCR PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Focr-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-ocr-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Focr-pdf\"\n        }\n      ],\n      \"keywords\": \"Data, Extract, Extract Text, OCR, OCR PDF, PHP, Text\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Use OCR to Extract Text from PDF Images with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11349,11350,11351,11352,11353,11354,11355,11356,11357],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1488,"name":1489,"slug":1490,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1492,"name":1493,"slug":1494,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1476,"name":1477,"slug":1478,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-php\u002F","How to Use OCR to Extract Text from PDF Images with PHP, Tutorial | pdfRest",{"id":11362,"uuid":11363,"title":11364,"slug":11365,"html":11366,"comment_id":11362,"feature_image":48,"featured":284,"visibility":1257,"created_at":11367,"updated_at":11368,"published_at":11367,"custom_excerpt":11369,"codeinjection_head":11370,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11371,"primary_tag":11381,"url":11382,"excerpt":11369,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11383,"meta_description":11369,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"66a7ec7c533c9f26b9437fe8","b146bc29-4a0d-40e9-92f7-4b975376b911","How to Use OCR to Extract Text from PDF Images with Python","how-to-use-ocr-to-extract-text-from-pdf-images-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Extract Text from Scanned PDFs with OCR and Python\u003C\u002Fh2>\n\n\u003Cp>A PDF can display readable words without containing machine-readable text. Scanned pages often store each page as an image, so a normal text-extraction request may return little or no useful content. The pdfRest \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Focr-pdf\u002F\">OCR PDF API Tool\u003C\u002Fa> recognizes characters in the page images and adds a searchable text layer to the PDF. The \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F\">Extract Text API Tool\u003C\u002Fa> can then return that recognized text to your Python application. Using both tools through the same API gives you a direct path from scanned pages to usable document data without installing and maintaining a separate OCR engine and PDF text parser.\u003C\u002Fp>\n\n\u003Cp>This tutorial combines the two operations in one resource-based workflow:\u003C\u002Fp>\n\n\u003Cp>For example, a records-intake application may receive scanned enrollment forms that cannot be searched or indexed because each page contains only an image. The application can use OCR PDF to recognize the characters, pass the resulting resource ID to Extract Text, and store the returned text so staff can locate forms by name or account number without manually retyping their contents.\u003C\u002Fp>\n\n\u003Col>\n\u003Cli>Upload the scanned PDF to \u003Ccode>\u002Fpdf-with-ocr-text\u003C\u002Fcode>.\u003C\u002Fli>\n\u003Cli>Read the OCR-processed PDF's \u003Ccode>outputId\u003C\u002Fcode> from the response.\u003C\u002Fli>\n\u003Cli>Send that ID to \u003Ccode>\u002Fextracted-text\u003C\u002Fcode>.\u003C\u002Fli>\n\u003Cli>Read the extracted content from the second response.\u003C\u002Fli>\n\u003C\u002Fol>\n\n\u003Cp>Passing the resource ID between calls avoids downloading and re-uploading the intermediate OCR PDF. This resource-based chaining is built into pdfRest, so the same pattern can connect OCR and extraction to other document operations without moving an intermediate file through your application after every step.\u003C\u002Fp>\n\n\u003Ch2>Python OCR and Text Extraction Example\u003C\u002Fh2>\n\n\u003Cp>The sample requires Python, the \u003Ccode>requests\u003C\u002Fcode> and \u003Ccode>requests-toolbelt\u003C\u002Fcode> packages, a pdfRest API key, and a scanned or image-based PDF. Replace the API-key and file-path placeholders before running it.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\n\n\n# In this sample, we will show how to convert a scanned document into a PDF with\n# searchable and extractable text using Optical Character Recognition (OCR), and then\n# extract that text from the newly created document.\n#\n# First, we will upload a scanned PDF to the \u002Fpdf-with-ocr-text route and capture the\n# output ID. Then, we will send the output ID to the \u002Fextracted-text route, which will\n# return the newly added text.\n\n# By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\n\napi_key = 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n\nocr_endpoint_url = api_url+'\u002Fpdf-with-ocr-text'\nmp_encoder_pdf = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile.pdf', 'rb'), 'application\u002Fpdf'),\n        'output': 'example_pdf-with-ocr-text_out',\n    }\n)\n\nimage_headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdf.content_type,\n    'Api-Key': api_key\n}\n\nprint(\"Sending POST request to OCR endpoint...\")\nresponse = requests.post(ocr_endpoint_url, data=mp_encoder_pdf, headers=image_headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    ocr_pdf_id = response_json[\"outputId\"]\n    print(\"Got the output ID: \" + ocr_pdf_id)\n\n    extract_endpoint_url = api_url+'\u002Fextracted-text'\n\n    mp_encoder_extract_text = MultipartEncoder(\n        fields={\n            'id': ocr_pdf_id\n        }\n    )\n\n    extract_text_headers = {\n        'Accept': 'application\u002Fjson',\n        'Content-Type': mp_encoder_extract_text.content_type,\n        'Api-Key': api_key\n    }\n\n    print(\"Sending POST request to extract text endpoint...\")\n    extract_response = requests.post(extract_endpoint_url, data=mp_encoder_extract_text, headers=extract_text_headers)\n\n    print(\"Response status code: \" + str(extract_response.status_code))\n\n    if extract_response.ok:\n        extract_json = extract_response.json()\n        print(extract_json[\"fullText\"])\n\n    else:\n        print(extract_response.text)\n\n\nelse:\n    print(response.text)\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FComplex%20Flow%20Examples\u002Focr-with-extract-text.py\">pdfRest OCR and Extract Text Python sample on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Cp>If the scanned PDF already exists on the pdfRest processing service, both steps can use JSON payloads with resource IDs instead of uploading the file as multipart data. See the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-ocr-text.py\">OCR PDF JSON-payload sample\u003C\u002Fa> and the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fextracted-text.py\">Extract Text JSON-payload sample\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>How the Two API Calls Work Together\u003C\u002Fh2>\n\n\u003Cp>The first multipart request uploads the source file to \u003Ccode>\u002Fpdf-with-ocr-text\u003C\u002Fcode>. A successful response contains an \u003Ccode>outputId\u003C\u002Fcode> for the new PDF with its recognized text layer. The script stores that value as \u003Ccode>ocr_pdf_id\u003C\u002Fcode> and supplies it as the \u003Ccode>id\u003C\u002Fcode> field in the second multipart request.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>\u002Fextracted-text\u003C\u002Fcode> endpoint works from that server-side resource and returns the recognized content in JSON. The sample prints \u003Ccode>fullText\u003C\u002Fcode>, which is useful when the application needs a document-level string for search indexing, data analysis, or another text-processing step.\u003C\u002Fp>\n\n\u003Cp>The Extract Text tool also supports more detailed output. Depending on the application, you can request full text by page or document, preserve line breaks, include coordinates for each word, and include font or color information. This lets one API support simple full-text indexing as well as layout-aware extraction without forcing every application into the same response shape. Coordinate and style data are useful when layout matters; plain full text is usually simpler for search, classification, or language-processing workflows.\u003C\u002Fp>\n\n\u003Ch2>Choose OCR Languages and Inputs Carefully\u003C\u002Fh2>\n\n\u003Cp>OCR defaults to English when no language is supplied. For documents in other languages, use the optional \u003Ccode>languages\u003C\u002Fcode> parameter and follow the current \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Focr-pdf\">OCR PDF API reference\u003C\u002Fa> for supported ISO 639-2 Alpha-3 language codes. Limiting recognition to the languages actually present can improve the balance between accuracy and processing time, especially for multilingual or CJK documents.\u003C\u002Fp>\n\n\u003Cp>OCR is most valuable for scanned and image-only content. Born-digital PDFs may already contain extractable text, while mixed PDFs can contain both existing text and page images. Query PDF can identify image-only files so the application routes each document through the appropriate extraction path automatically.\u003C\u002Fp>\n\n\u003Ch2>Build OCR into a Reliable Extraction Workflow\u003C\u002Fh2>\n\n\u003Cp>OCR gives image-based documents a searchable text layer that the application can route directly into Extract Text, search, classification, or data-entry workflows. Recognition quality reflects the characteristics of the scanned page, including resolution, rotation, contrast, language, font, and page condition.\u003C\u002Fp>\n\n\u003Cp>For workflows that act on names, amounts, identifiers, or other decisive values, design field-level business rules around the extracted result. The API response provides the processing status and expected output fields; application logic can use those fields to route a clean result forward or flag an exception for the process that owns the underlying data. This turns OCR from a manual recovery step into a useful part of a repeatable document-intake workflow.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-07-29T19:24:44.000+00:00","2026-09-22T19:02:54.000+00:00","Learn how to use pdfRest OCR PDF and Extract Text API Tools with Python to extract all text from a PDF","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-python\u002F#article\",\n      \"headline\": \"How to Use OCR to Extract Text from PDF Images with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-python\u002F\",\n      \"datePublished\": \"2024-07-29T19:24:44.000Z\",\n      \"dateModified\": \"2026-09-22T00:00:00.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest OCR PDF and Extract Text API Tools with Python to extract all text from a PDF\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Extract Text API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fextract-text\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fextracted-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fextract-text\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"OCR PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Focr-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-ocr-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Focr-pdf\"\n        }\n      ],\n      \"keywords\": \"Data, Extract, Extract Text, OCR, OCR PDF, Python, Text\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Use OCR to Extract Text from PDF Images with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11372,11373,11374,11375,11376,11377,11378,11379,11380],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1488,"name":1489,"slug":1490,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1492,"name":1493,"slug":1494,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1476,"name":1477,"slug":1478,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1472,"name":1473,"slug":1474,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1484,"name":1485,"slug":1486,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-use-ocr-to-extract-text-from-pdf-images-with-python\u002F","How to Use OCR to Extract Text from PDF Images with Python, Tutorial | pdfRest",{"id":11385,"uuid":11386,"title":11387,"slug":11388,"html":11389,"comment_id":11385,"feature_image":48,"featured":284,"visibility":1257,"created_at":11390,"updated_at":11391,"published_at":11390,"custom_excerpt":11392,"codeinjection_head":11393,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11394,"primary_tag":11402,"url":11403,"excerpt":11392,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11404,"meta_description":11392,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"66a145d3533c9f26b9437f16","fc54a66c-66ea-4cc6-8659-17b4011aae58","How to Use OCR to Make PDF Image Text Searchable in .NET with C#","how-to-use-ocr-to-make-pdf-image-text-searchable-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use OCR to make Searchable PDF with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest OCR PDF API Tool is a powerful resource for converting scanned documents and images into searchable PDF files. This tutorial will show you how to send an API call to OCR PDF with C#, allowing you to integrate this functionality into your applications seamlessly.\u003C\u002Fp>\n\n\u003Cp>Imagine you have a large archive of scanned documents that you need to make searchable for easy retrieval. Using OCR (Optical Character Recognition), you can convert these scanned documents into searchable PDFs. This is invaluable for businesses and organizations that need to manage large volumes of documents efficiently.\u003C\u002Fp>\n\n\u003Ch2>OCR PDF with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf-with-ocr-text\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"converted\"));\n        multipartContent.Add(byteArrayOption, \"output\");\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-ocr-text.cs\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>Let's break down the provided code to understand how it works:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>This line initializes an \u003Ccode>HttpClient\u003C\u002Fcode> object with the base address set to the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf-with-ocr-text\"))\n\u003C\u002Fpre>\n\n\u003Cp>Here, an \u003Ccode>HttpRequestMessage\u003C\u002Fcode> is created with the HTTP method set to POST and the endpoint specified as \"pdf-with-ocr-text\".\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\nrequest.Headers.Accept.Add(new(\"application\u002Fjson\"));\n\u003C\u002Fpre>\n\n\u003Cp>These lines add the API key to the request headers and set the Accept header to \"application\u002Fjson\". The API key is essential for authenticating the request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n\u003C\u002Fpre>\n\n\u003Cp>A \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> object is created to hold the file and other form data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\u003C\u002Fpre>\n\n\u003Cp>This snippet reads the file into a byte array and adds it to the multipart content. The content type is set to \"application\u002Fpdf\".\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"converted\"));\nmultipartContent.Add(byteArrayOption, \"output\");\n\u003C\u002Fpre>\n\n\u003Cp>Here, the output option is added to the multipart content, specifying that the output should be \"converted\".\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Content = multipartContent;\nvar response = await httpClient.SendAsync(request);\n\u003C\u002Fpre>\n\n\u003Cp>The multipart content is assigned to the request, and the request is sent asynchronously. The response is then awaited.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiResult = await response.Content.ReadAsStringAsync();\nConsole.WriteLine(\"API response received.\");\nConsole.WriteLine(apiResult);\n\u003C\u002Fpre>\n\n\u003Cp>The response content is read as a string and printed to the console.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to make an API call to the pdfRest OCR PDF endpoint using C#. This allows you to convert scanned documents into searchable PDFs programmatically.\u003C\u002Fp>\n\n\u003Cp>To explore more features and tools offered by pdfRest, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on the API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example demonstrates a multipart API call. For code samples using JSON payloads, visit the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-ocr-text.cs\">GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-07-24T18:20:03.000+00:00","2026-09-02T18:29:46.000+00:00","Learn how to use pdfRest OCR PDF API Tool with C# to make Searchable PDF Files","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Use OCR to Make PDF Image Text Searchable in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-07-24T18:20:03.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:27.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest OCR PDF API Tool with C# to make Searchable PDF Files\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"OCR PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Focr-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-ocr-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Focr-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Accessibility, OCR, OCR PDF, Text\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Use OCR to Make PDF Image Text Searchable in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11395,11396,11397,11398,11399,11400,11401],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1488,"name":1489,"slug":1490,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1492,"name":1493,"slug":1494,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1923,"name":1924,"slug":1925,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-in-net-with-c\u002F","How to Use OCR to Make PDF Image Text Searchable in .NET with C#, Tutorial | pdfRest",{"id":11406,"uuid":11407,"title":11408,"slug":11409,"html":11410,"comment_id":11406,"feature_image":48,"featured":284,"visibility":1257,"created_at":11411,"updated_at":11391,"published_at":11411,"custom_excerpt":11412,"codeinjection_head":11413,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11414,"primary_tag":11422,"url":11423,"excerpt":11412,"reading_time":5,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11424,"meta_description":11412,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"66a147c8533c9f26b9437f2a","31664e3b-c2af-4b1f-9754-bf2669f3f698","How to Use OCR to Make PDF Image Text Searchable with cURL","how-to-use-ocr-to-make-pdf-image-text-searchable-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use OCR to make Searchable PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest OCR PDF API Tool is a powerful resource for converting scanned documents and images into searchable and extractable text in PDF files. This tutorial will show you how to send an API call to OCR PDF with cURL, a command-line tool for transferring data using various network protocols.\u003C\u002Fp>\n\n\u003Cp>Imagine you have a large number of scanned documents that you need to make searchable for easy retrieval. Using the OCR PDF API, you can automate this process, making it efficient and less prone to errors compared to manual data entry. This can be particularly useful for businesses dealing with large volumes of paperwork, such as legal firms or medical offices.\u003C\u002Fp>\n\n\u003Ch2>OCR PDF with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-ocr-text\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-ocr-text.sh\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>Let's break down the provided cURL command to understand how it works:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-ocr-text\"\n\u003C\u002Fpre>\n\n\u003Cp>This line initiates a POST request to the \u002Fpdf-with-ocr-text endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\n\u003C\u002Fpre>\n\n\u003Cp>This header tells the server that the client expects the response to be in JSON format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\n\u003C\u002Fpre>\n\n\u003Cp>This header specifies that the content type of the request is multipart\u002Fform-data, which is necessary for file uploads.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>This header includes the API key, which is required for authentication. Replace \u003Ccode>xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\u003C\u002Fcode> with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\n\u003C\u002Fpre>\n\n\u003Cp>This line specifies the file to be uploaded. Replace \u003Ccode>\u002Fpath\u002Fto\u002Ffile\u003C\u002Fcode> with the actual path to the file you want to upload.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>This line specifies the output file name. In this case, the output will be named \u003Ccode>example_out\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to make an API call to the pdfRest OCR PDF endpoint using cURL. This allows you to convert scanned documents into searchable PDFs efficiently.\u003C\u002Fp>\n\n\u003Cp>To explore more functionalities, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-ocr-text.sh\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-07-24T18:28:24.000+00:00","Learn how to make PDF files searchable with pdfRest OCR PDF API Tool using cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-curl\u002F#article\",\n      \"headline\": \"How to Use OCR to Make PDF Image Text Searchable with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-curl\u002F\",\n      \"datePublished\": \"2024-07-24T18:28:24.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:27.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to make PDF files searchable with pdfRest OCR PDF API Tool using cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"OCR PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Focr-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-ocr-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Focr-pdf\"\n        }\n      ],\n      \"keywords\": \"Accessibility, OCR, OCR PDF, Text, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Use OCR to Make PDF Image Text Searchable with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11415,11416,11417,11418,11419,11420,11421],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1488,"name":1489,"slug":1490,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1492,"name":1493,"slug":1494,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1923,"name":1924,"slug":1925,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-curl\u002F","How to Use OCR to Make PDF Image Text Searchable with cURL, Tutorial | pdfRest",{"id":11426,"uuid":11427,"title":11428,"slug":11429,"html":11430,"comment_id":11426,"feature_image":48,"featured":284,"visibility":1257,"created_at":11431,"updated_at":11432,"published_at":11088,"custom_excerpt":11433,"codeinjection_head":11434,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11435,"primary_tag":11443,"url":11444,"excerpt":11433,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11445,"meta_description":11433,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c62533c9f26b943b5ce","0efc1fdd-9f3c-4e30-8fb9-b54d47b91c1a","How to Use OCR to Make PDF Image Text Searchable with Java","how-to-use-ocr-to-make-pdf-image-text-searchable-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This step-by-step tutorial explains how a Java application can use OCR to make PDF image text searchable through the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Focr-pdf\u002F\">OCR PDF API Tool\u003C\u002Fa>. The Java request submits an image-based PDF to \u003Ccode>\u002Fpdf-with-ocr-text\u003C\u002Fcode> and receives a searchable PDF resource for later search and text selection. After reviewing the example, you'll be ready to use OCR to make PDF image text searchable with your own input.\u003C\u002Fp>\n\n\u003Ch2>Why Use OCR to Make PDF Image Text Searchable with Java?\u003C\u002Fh2>\n\n\u003Cp>A records portal may display scanned pages correctly while users still cannot search or select their text. OCR adds recognized text without requiring the application to recreate the document.\u003C\u002Fp>\n\n\u003Cp>The Java sample sends the PDF to \u003Ccode>\u002Fpdf-with-ocr-text\u003C\u002Fcode>. OCR language and related options should match the source material for the best recognition results.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONObject;\n\npublic class PDFWithOCRText {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_pdf-with-ocr-text\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf-with-ocr-text\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPDFWithOCRText.java\">Java sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The sample relies on OkHttp to send the call, dotenv to resolve credentials, and \u003Ccode>org.json\u003C\u002Fcode> to inspect or format JSON.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>The configuration block shows where the input comes from and keeps the credential outside the request-building logic.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"output\", \"pdfrest_pdf-with-ocr-text\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf-with-ocr-text\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The Java sample sends the PDF to \u003Ccode>\u002Fpdf-with-ocr-text\u003C\u002Fcode>. OCR language and related options should match the source material for the best recognition results. The form-data setup sets \u003Ccode>MultipartBody.FORM\u003C\u002Fcode>, allowing OkHttp to generate the matching boundary automatically.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf-with-ocr-text\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\u003C\u002Fpre>\n\n\u003Cp>The client request joins authentication, routing, and payload in one place while leaving regional service selection in the API URL constant.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>The response check makes success and failure information available to the caller, including any temporary resources that must be saved or reused before expiration.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>The completed example gives you a practical Java starting point for learning how to use OCR to make PDF image text searchable. With that foundation, searchable OCR PDFs improve retrieval, review, copy-and-paste, and downstream text-processing workflows.\u003C\u002Fp>\n\n\u003Cp>As you apply the pattern to real documents, choose OCR language settings that match the source and review low-quality scans for recognition errors. A searchable text layer improves discovery and selection, but it does not by itself establish accessibility conformance or correct the logical reading structure of the PDF.\u003C\u002Fp>\n\n\u003Cp>Before integrating this workflow, test representative documents with the Use OCR to Make PDF Image Text Searchable operation in \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. Then use the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Focr-pdf\u002F\">OCR PDF API Tool documentation\u003C\u002Fa> to review every available parameter and response field.\u003C\u002Fp>\n\n\u003Cp>Note: The Use OCR to Make PDF Image Text Searchable example above uses multipart form data; to reuse a resource ID, see the request shape in the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPDFWithOCRText.java\">JSON payload example\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T17:33:22.000+00:00","2026-09-02T18:29:47.000+00:00","Add a searchable OCR text layer to image-based PDF documents with Java.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-java\u002F#article\",\n      \"headline\": \"How to Use OCR to Make PDF Image Text Searchable with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:41.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:41.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Add a searchable OCR text layer to image-based PDF documents with Java.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"OCR PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Focr-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-ocr-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Focr-pdf\"\n        }\n      ],\n      \"keywords\": \"Accessibility, Java, OCR, OCR PDF, Text\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Use OCR to Make PDF Image Text Searchable with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11436,11437,11438,11439,11440,11441,11442],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1488,"name":1489,"slug":1490,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1492,"name":1493,"slug":1494,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1923,"name":1924,"slug":1925,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-java\u002F","Use OCR to Make PDF Image Text Searchable with Java | pdfRest",{"id":11447,"uuid":11448,"title":11449,"slug":11450,"html":11451,"comment_id":11447,"feature_image":48,"featured":284,"visibility":1257,"created_at":11452,"updated_at":11432,"published_at":11452,"custom_excerpt":11453,"codeinjection_head":11454,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11455,"primary_tag":11463,"url":11464,"excerpt":11453,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11465,"meta_description":11453,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"66a14781533c9f26b9437f20","0641292c-8fa5-4ea6-9159-d850c660643c","How to Use OCR to Make PDF Image Text Searchable with JavaScript in NodeJS","how-to-use-ocr-to-make-pdf-image-text-searchable-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use OCR to make Searchable PDF with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest OCR PDF API Tool allows developers to convert scanned PDF documents into searchable text by applying Optical Character Recognition (OCR). This tutorial will show how to send an API call to OCR PDF with JavaScript, making it possible to automate the process of converting image-based text into machine-readable text within PDF documents.\u003C\u002Fp>\n\n\u003Cp>Imagine you work in an office where you frequently receive scanned documents. These documents are essentially images, making it difficult to search for specific text within them. By using the OCR PDF API, you can convert these scanned documents into searchable PDFs, significantly improving your workflow and productivity.\u003C\u002Fp>\n\n\u003Ch2>OCR PDF with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to apply OCR to a PDF document and insert text behind images of text.\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('output', 'pdfrest_pdf-with-ocr-text');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-ocr-text', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-ocr-text.js\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>Let's break down the code to understand how it works:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\u003C\u002Fpre>\n\n\u003Cp>This snippet imports the required modules: \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests, \u003Ccode>FormData\u003C\u002Fcode> for handling form data, and \u003Ccode>fs\u003C\u002Fcode> for file system operations.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('output', 'pdfrest_pdf-with-ocr-text');\n\u003C\u002Fpre>\n\n\u003Cp>Here, a new instance of \u003Ccode>FormData\u003C\u002Fcode> is created, and the PDF file is appended to it using \u003Ccode>fs.createReadStream\u003C\u002Fcode>. The \u003Ccode>output\u003C\u002Fcode> parameter specifies the type of output we want, in this case, a PDF with OCR text.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity, \n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-ocr-text', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders() \n  },\n  data : data \n};\n\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>config\u003C\u002Fcode> object is defined to configure the Axios request. It specifies the HTTP method as \u003Ccode>post\u003C\u002Fcode>, sets the maximum body length to infinity, and provides the URL of the API endpoint. The \u003Ccode>headers\u003C\u002Fcode> include the API key (which you should replace with your own) and the headers generated by the \u003Ccode>FormData\u003C\u002Fcode> instance. The \u003Ccode>data\u003C\u002Fcode> field contains the form data to be sent with the request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\u003C\u002Fpre>\n\n\u003Cp>This part of the code sends the HTTP request using Axios and handles the response or any errors that occur. The response is logged to the console in JSON format.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we have demonstrated how to use JavaScript to send an API call to the pdfRest OCR PDF API Tool, converting a scanned PDF document into a searchable text PDF. This is just one of the many functionalities offered by pdfRest.\u003C\u002Fp>\n\n\u003Cp>We encourage you to explore all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example demonstrates a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-ocr-text.js\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-07-24T18:27:13.000+00:00","Learn how to use pdfRest OCR PDF API Tool with JavaScript to make PDF image text searchable","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Use OCR to Make PDF Image Text Searchable with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-07-24T18:27:13.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:27.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest OCR PDF API Tool with JavaScript to make PDF image text searchable\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"OCR PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Focr-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-ocr-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Focr-pdf\"\n        }\n      ],\n      \"keywords\": \"Accessibility, JavaScript, OCR, OCR PDF, Text\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Use OCR to Make PDF Image Text Searchable with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11456,11457,11458,11459,11460,11461,11462],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1488,"name":1489,"slug":1490,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1492,"name":1493,"slug":1494,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1923,"name":1924,"slug":1925,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-javascript-in-nodejs\u002F","How to Use OCR to Make PDF Image Text Searchable with JavaScript in NodeJS, Tutorial | pdfRest",{"id":11467,"uuid":11468,"title":11469,"slug":11470,"html":11471,"comment_id":11467,"feature_image":48,"featured":284,"visibility":1257,"created_at":11472,"updated_at":11432,"published_at":11472,"custom_excerpt":11473,"codeinjection_head":11474,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11475,"primary_tag":11483,"url":11484,"excerpt":11473,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11485,"meta_description":11473,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"66a138e3533c9f26b9437efe","7bd1bacb-e61f-4f03-804e-b7368a4ba8b7","How to Use OCR to Make PDF Image Text Searchable with PHP","how-to-use-ocr-to-make-pdf-image-text-searchable-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use OCR to make Searchable PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest OCR PDF API Tool is a powerful resource that allows developers to integrate Optical Character Recognition (OCR) functionality into their applications. This tutorial will demonstrate how to send an API call to OCR a PDF using PHP, making it easier to search and find text from scanned documents or images within a PDF file.\u003C\u002Fp>\n\n\u003Cp>Imagine you have a large collection of scanned documents, such as invoices or historical records, and you need to make the text within these documents searchable and extractable. By using the OCR PDF API, you can automate the process of converting these scanned images into text, saving time and effort while improving data accessibility and usability.\u003C\u002Fp>\n\n\u003Ch2>OCR PDF with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">\nrequire 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\nuse GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\n$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\n$headers = [\n  'Api-Key' =--> 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile', \u002F\u002F Set the filename for the file to be processed, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'output', \u002F\u002F Specify the field name for the output option.\n      'contents' => 'pdfrest_pdf-with-ocr-text' \u002F\u002F Set the value for the output option (in this case, 'pdfrest_pdf-with-ocr-text').\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-ocr-text', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\n$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\necho $res->getBody(); \u002F\u002F Output the response body, which contains the document with text from OCR added.\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-ocr-text.php\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided code demonstrates how to use the Guzzle HTTP client to send a multipart API request to the pdfRest OCR PDF endpoint. Here’s a detailed breakdown:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">require 'vendor\u002Fautoload.php'; \u002F\u002F Require the autoload file to load Guzzle HTTP client.\n\u003C\u002Fpre>\n\n\u003Cp>This line includes the autoload file generated by Composer, which loads all necessary dependencies, including Guzzle.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">use GuzzleHttp\\Client; \u002F\u002F Import the Guzzle HTTP client namespace.\nuse GuzzleHttp\\Psr7\\Request; \u002F\u002F Import the PSR-7 Request class.\nuse GuzzleHttp\\Psr7\\Utils; \u002F\u002F Import the PSR-7 Utils class for working with streams.\n\u003C\u002Fpre>\n\n\u003Cp>These lines import the necessary classes from the Guzzle HTTP client library and PSR-7, which are used to create and send HTTP requests.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$client = new Client(); \u002F\u002F Create a new instance of the Guzzle HTTP client.\n\u003C\u002Fpre>\n\n\u003Cp>This line creates a new instance of the Guzzle HTTP client, which will be used to send the API request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \u002F\u002F Set the API key in the headers for authentication.\n];\n\u003C\u002Fpre>\n\n\u003Cp>Here, the API key is set in the headers array for authentication purposes. Replace \u003Ccode>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\u003C\u002Fcode> with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$options = [\n  'multipart' => [\n    [\n      'name' => 'file', \u002F\u002F Specify the field name for the file.\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'), \u002F\u002F Open the file specified by the '\u002Fpath\u002Fto\u002Ffile' for reading.\n      'filename' => '\u002Fpath\u002Fto\u002Ffile', \u002F\u002F Set the filename for the file to be processed, in this case, '\u002Fpath\u002Fto\u002Ffile'.\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">' \u002F\u002F Set the Content-Type header for the file.\n      ]\n    ],\n    [\n      'name' => 'output', \u002F\u002F Specify the field name for the output option.\n      'contents' => 'pdfrest_pdf-with-ocr-text' \u002F\u002F Set the value for the output option (in this case, 'pdfrest_pdf-with-ocr-text').\n    ]\n  ]\n];\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>$options\u003C\u002Fcode> array is configured with multipart form data. The first part includes the file to be processed, specifying its name, contents, filename, and content type. The second part specifies the output format for the OCR result.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-ocr-text', $headers); \u002F\u002F Create a new HTTP POST request with the API endpoint and headers.\n\u003C\u002Fpre>\n\n\u003Cp>This line creates a new HTTP POST request to the pdfRest OCR PDF endpoint, including the headers for authentication.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">$res = $client->sendAsync($request, $options)->wait(); \u002F\u002F Send the asynchronous request and wait for the response.\n\u003C\u002Fpre>\n\n\u003Cp>The asynchronous request is sent using the \u003Ccode>sendAsync\u003C\u002Fcode> method, and the script waits for the response.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">echo $res->getBody(); \u002F\u002F Output the response body, which contains the document with text from OCR added.\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the response body, which contains the OCR-processed document, is outputted.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to send a multipart API request to the pdfRest OCR PDF endpoint using PHP. This process allows you to convert scanned documents into searchable and editable text efficiently.\u003C\u002Fp>\n\n\u003Cp>To further explore the capabilities of pdfRest API tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for detailed documentation.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-ocr-text.php\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-07-24T17:24:51.000+00:00","Learn how to make PDF image text searchable using pdfRest OCR PDF API Tool with PHP","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-php\u002F#article\",\n      \"headline\": \"How to Use OCR to Make PDF Image Text Searchable with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-php\u002F\",\n      \"datePublished\": \"2024-07-24T17:24:51.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:27.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to make PDF image text searchable using pdfRest OCR PDF API Tool with PHP\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"OCR PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Focr-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-ocr-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Focr-pdf\"\n        }\n      ],\n      \"keywords\": \"Accessibility, OCR, OCR PDF, PHP, Text\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Use OCR to Make PDF Image Text Searchable with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11476,11477,11478,11479,11480,11481,11482],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1488,"name":1489,"slug":1490,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1492,"name":1493,"slug":1494,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1923,"name":1924,"slug":1925,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-php\u002F","How to Use OCR to Make PDF Image Text Searchable with PHP, Tutorial | pdfRest",{"id":11487,"uuid":11488,"title":11489,"slug":11490,"html":11491,"comment_id":11487,"feature_image":48,"featured":284,"visibility":1257,"created_at":11492,"updated_at":11493,"published_at":11492,"custom_excerpt":11494,"codeinjection_head":11495,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11496,"primary_tag":11504,"url":11505,"excerpt":11494,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11506,"meta_description":11494,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"66a1389f533c9f26b9437ef2","d6b01843-6d65-4897-b3b3-bacd390d7da7","How to Use OCR to Make PDF Image Text Searchable with Python","how-to-use-ocr-to-make-pdf-image-text-searchable-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use OCR to make Searchable PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest OCR PDF API Tool is a powerful utility that allows developers to convert scanned documents and images into searchable and extractable PDFs using Optical Character Recognition (OCR). This tutorial will guide you through the process of sending an API call to the OCR PDF endpoint using Python, enabling you to automate the conversion of image-based text into machine-readable text.\u003C\u002Fp>\n\n\u003Cp>Imagine you work in a law firm that frequently receives scanned legal documents. By using OCR, you can convert these scanned documents into searchable PDFs, making it easier to find and reference specific information. This can save time and improve efficiency, especially when dealing with large volumes of documents.\u003C\u002Fp>\n\n\u003Ch2>OCR PDF with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\npdf_with_ocr_text_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-ocr-text'\n\n# The \u002Fpdf-with-ocr-text endpoint can take a single PDF file or id as input.\n# This sample demonstrates a request to add text to a document by using OCR on images of text.\nmp_encoder_pdf_with_ocr_text = MultipartEncoder(\n    fields={\n        'file': ('file_name', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_pdf-with-ocr-text_out',\n    }\n)\n\n# Let's set the headers that the pdf-with-ocr-text endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdf_with_ocr_text.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to pdf-with-ocr-text endpoint...\")\nresponse = requests.post(pdf_with_ocr_text_endpoint_url, data=mp_encoder_pdf_with_ocr_text, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-with-ocr-text.py\">GitHub Repository\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>Let's break down the code to understand how it works:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\u003C\u002Fpre>\n\n\u003Cp>This section imports the necessary libraries. \u003Ccode>requests_toolbelt\u003C\u002Fcode> is used to handle multipart form data, \u003Ccode>requests\u003C\u002Fcode> is used to make HTTP requests, and \u003Ccode>json\u003C\u002Fcode> is used to handle JSON responses.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">pdf_with_ocr_text_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-with-ocr-text'\n\u003C\u002Fpre>\n\n\u003Cp>This line sets the endpoint URL for the OCR PDF API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_pdf_with_ocr_text = MultipartEncoder(\n    fields={\n        'file': ('file_name', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'output' : 'example_pdf-with-ocr-text_out',\n    }\n)\n\u003C\u002Fpre>\n\n\u003Cp>Here, we create a \u003Ccode>MultipartEncoder\u003C\u002Fcode> object to handle the multipart form data. The \u003Ccode>fields\u003C\u002Fcode> dictionary includes:\u003C\u002Fp>\n\n\u003Cul>\n    \u003Cli>\u003Ccode>file\u003C\u002Fcode>: The PDF file to be processed. Replace \u003Ccode>\u002Fpath\u002Fto\u002Ffile\u003C\u002Fcode> with the actual file path.\u003C\u002Fli>\n    \u003Cli>\u003Ccode>output\u003C\u002Fcode>: The name of the output file.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdf_with_ocr_text.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\u003C\u002Fpre>\n\n\u003Cp>This section sets the headers for the API request. The \u003Ccode>Content-Type\u003C\u002Fcode> is automatically set to \u003Ccode>multipart\u002Fform-data\u003C\u002Fcode> by the \u003Ccode>MultipartEncoder\u003C\u002Fcode>. Replace \u003Ccode>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\u003C\u002Fcode> with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(pdf_with_ocr_text_endpoint_url, data=mp_encoder_pdf_with_ocr_text, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>This line sends a POST request to the OCR PDF endpoint with the specified data and headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Finally, this block checks if the request was successful. If so, it prints the JSON response. Otherwise, it prints the error message.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we demonstrated how to use Python to send an API call to the pdfRest OCR PDF endpoint. By following the steps outlined above, you can convert scanned documents into searchable PDFs using OCR.\u003C\u002Fp>\n\n\u003Cp>We encourage you to explore all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-with-ocr-text.py\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-07-24T17:23:43.000+00:00","2026-09-02T18:29:48.000+00:00","Learn how to use pdfRest OCR PDF API Tool with Python to make PDF image text searchable","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-python\u002F#article\",\n      \"headline\": \"How to Use OCR to Make PDF Image Text Searchable with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-python\u002F\",\n      \"datePublished\": \"2024-07-24T17:23:43.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:28.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest OCR PDF API Tool with Python to make PDF image text searchable\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"OCR PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Focr-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-with-ocr-text API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Focr-pdf\"\n        }\n      ],\n      \"keywords\": \"Accessibility, OCR, OCR PDF, Python, Text\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Use OCR to Make PDF Image Text Searchable with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11497,11498,11499,11500,11501,11502,11503],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1488,"name":1489,"slug":1490,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1492,"name":1493,"slug":1494,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1480,"name":1481,"slug":1482,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1923,"name":1924,"slug":1925,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-use-ocr-to-make-pdf-image-text-searchable-with-python\u002F","How to Use OCR to Make PDF Image Text Searchable with Python, Tutorial | pdfRest",{"id":11508,"uuid":11509,"title":11510,"slug":11511,"html":11512,"comment_id":11508,"feature_image":48,"featured":284,"visibility":1257,"created_at":11513,"updated_at":11514,"published_at":11514,"custom_excerpt":11515,"codeinjection_head":11516,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11517,"primary_tag":48,"url":11525,"excerpt":11515,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11526,"meta_description":11515,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6aad55b2d1b70dd2e2978f66","4f06cd91-2608-4273-900e-34371bc6aeeb","How to Validate a ZUGFeRD PDF in .NET with C#","how-to-validate-a-zugferd-pdf-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This tutorial shows how to validate an existing ZUGFeRD or Factur-X hybrid invoice with .NET with C#. It uses the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-zugferd-pdf\u002F\">pdfRest Create ZUGFeRD PDF API Tool\u003C\u002Fa> to submit the invoice PDF to its validation endpoint and print the response without modifying the document.\u003C\u002Fp>\n\n\u003Ch2>Why Validate a ZUGFeRD PDF in .NET with C#?\u003C\u002Fh2>\n\n\u003Cp>Receiving an invoice PDF is not the same as knowing that it is a usable hybrid electronic invoice. A validation step checks the ZUGFeRD or Factur-X package and its PDF\u002FA conformance before a receiving, records, or accounts-payable workflow treats the file as an accepted result.\u003C\u002Fp>\n\n\u003Cp>For example, a .NET with C# intake service can validate supplier invoices as they arrive, retain the response with the processing record, and route an unsuccessful result for follow-up before the invoice enters an automated approval path. This gives operational teams a clear decision point rather than discovering a problem later in the workflow.\u003C\u002Fp>\n\n\u003Cp>Validation does not repair or replace the submitted PDF. It reports on the existing hybrid invoice, allowing the calling application to preserve the original, request a corrected version, or route the document to a separate creation or remediation process when appropriate.\u003C\u002Fp>\n\n\u003Ch2>What the Request Does\u003C\u002Fh2>\n\n\u003Cp>The multipart request contains one PDF in the \u003Ccode>file\u003C\u002Fcode> field. The endpoint analyzes that existing document and returns validation information; it does not generate a replacement invoice or modify the supplied PDF.\u003C\u002Fp>\n\n\u003Cp>The C# samples use framework \u003Ccode>HttpClient\u003C\u002Fcode> APIs and disposable request content. The API key is read from \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode>, keeping the credential out of the source file.\u003C\u002Fp>\n\n\u003Ch2>How to Validate a ZUGFeRD PDF in .NET with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">\u002F*\n * What this sample does:\n * - Validates a hybrid ZUGFeRD \u002F Factur-X PDF without modifying it.\n *\n * Setup (environment):\n * - Copy .env.example to .env and set PDFREST_API_KEY=your_api_key_here.\n * - Optional: set PDFREST_URL to override the API region. For EU\u002FGDPR compliance and proximity, use:\n *     PDFREST_URL=https:\u002F\u002Feu-api.pdfrest.com\n *   For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\n * Usage:\n *   dotnet run -- validated-zugferd-multipart \u002Fpath\u002Fto\u002Fzugferd-invoice.pdf\n *\n * Output:\n * - Prints the validation JSON response and returns a nonzero exit code when the request fails.\n *\u002F\nusing System.Net.Http.Headers;\n\nnamespace Samples.EndpointExamples.MultipartPayload;\n\npublic static class ValidatedZugferd\n{\n    public static async Task Execute(string[] args)\n    {\n        var zugferdPdf = args.Length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fzugferd-invoice.pdf\";\n        if (!File.Exists(zugferdPdf)) throw new FileNotFoundException(\"ZUGFeRD PDF not found.\", zugferdPdf);\n        var apiKey = Environment.GetEnvironmentVariable(\"PDFREST_API_KEY\") ?? throw new InvalidOperationException(\"Missing PDFREST_API_KEY\");\n        var baseUrl = Environment.GetEnvironmentVariable(\"PDFREST_URL\") ?? \"https:\u002F\u002Fapi.pdfrest.com\";\n        using var client = new HttpClient { BaseAddress = new Uri(baseUrl) };\n        client.DefaultRequestHeaders.TryAddWithoutValidation(\"Api-Key\", apiKey);\n        using var form = new MultipartFormDataContent();\n        var pdf = new ByteArrayContent(await File.ReadAllBytesAsync(zugferdPdf));\n        pdf.Headers.ContentType = new MediaTypeHeaderValue(\"application\u002Fpdf\");\n        form.Add(pdf, \"file\", Path.GetFileName(zugferdPdf));\n        var response = await client.PostAsync(\"validated-zugferd\", form);\n        Console.WriteLine(await response.Content.ReadAsStringAsync());\n        if (!response.IsSuccessStatusCode) Environment.ExitCode = 1;\n    }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics-erics\u002Fpdf-rest-api-samples\u002Fblob\u002Fcodex\u002Fzugferd-api-samples\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fvalidated-zugferd.cs\">View the multipart sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The request is compact, but each field has a distinct role in the hybrid-invoice workflow.\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Cstrong>Submit the finished hybrid invoice.\u003C\u002Fstrong> Validation accepts one existing ZUGFeRD or Factur-X PDF through the \u003Ccode>file\u003C\u002Fcode> field. The code sends it as \u003Ccode>application\u002Fpdf\u003C\u002Fcode> and does not include XML, \u003Ccode>pdf_file\u003C\u002Fcode>, \u003Ccode>regenerate_pdf\u003C\u002Fcode>, or \u003Ccode>render_options\u003C\u002Fcode>.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Build the multipart request.\u003C\u002Fstrong> \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> owns the fields and generates the multipart boundary. Each \u003Ccode>StreamContent\u003C\u002Fcode> value is disposed with the form after \u003Ccode>HttpClient\u003C\u002Fcode> sends it.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Configure the request safely.\u003C\u002Fstrong> The sample gets \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode> and an optional \u003Ccode>PDFREST_URL\u003C\u002Fcode> from environment variables, keeping both regional selection and credentials outside the code.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Call the validation endpoint.\u003C\u002Fstrong> The request goes to \u003Ccode>\u002Fvalidated-zugferd\u003C\u002Fcode>, which is the validation endpoint within the Create ZUGFeRD PDF API Tool. It analyzes the submitted document without replacing or modifying it.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Use the result as a workflow decision.\u003C\u002Fstrong> The example prints \u003Ccode>response.Content\u003C\u002Fcode> and returns a nonzero process exit code for an unsuccessful HTTP status. Parse the JSON only after \u003Ccode>IsSuccessStatusCode\u003C\u002Fcode> is true. A receiving or accounts-payable service can continue an accepted path or send an unsuccessful result for review.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this .NET with C# tutorial, you submitted an existing hybrid invoice for validation and handled the returned result as application data. That pattern fits an intake gate, a supplier-invoice check, or a controlled audit record.\u003C\u002Fp>\n\n\u003Cp>For the complete request fields, accepted values, response contract, and service limits, review the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fvalidate-zugferd-pdf\u002F\">Create ZUGFeRD PDF API Tool documentation for the validation endpoint\u003C\u002Fa>. The same endpoint can be used with multipart uploads when the files are present in the current request or with resource IDs after a separate upload step.\u003C\u002Fp>\n\n\u003Cp>The repository also includes a \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics-erics\u002Fpdf-rest-api-samples\u002Fblob\u002Fcodex\u002Fzugferd-api-samples\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fvalidated-zugferd.cs\">JSON-payload Validate ZUGFeRD PDF sample for .NET with C#\u003C\u002Fa>. That version uploads the source files first and then sends their resource IDs to \u003Ccode>\u002Fvalidated-zugferd\u003C\u002Fcode>, which is useful when a service already stages input files for later operations.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-18T15:16:02.000+00:00","2026-09-18T20:27:40.000+00:00","Validate a ZUGFeRD or Factur-X hybrid invoice and its PDF\u002FA conformance with pdfRest using .NET with C#.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-a-zugferd-pdf-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Validate a ZUGFeRD PDF in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-a-zugferd-pdf-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-a-zugferd-pdf-in-net-with-c\u002F\",\n      \"datePublished\": \"2026-09-18T15:16:02.000Z\",\n      \"dateModified\": \"2026-09-18T20:12:30.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Validate a ZUGFeRD or Factur-X hybrid invoice and its PDF\u002FA conformance with pdfRest using .NET with C#.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Create ZUGFeRD PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-zugferd-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fvalidated-zugferd API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fvalidate-zugferd-pdf\u002F\"\n        }\n      ],\n      \"keywords\": \"Validate, ZUGFeRD, Factur-X, C#, .NET\",\n      \"dependencies\": \"C#, .NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Validate a ZUGFeRD PDF in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-a-zugferd-pdf-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11518,11519,11520,11521,11522,11523,11524],{"id":1356,"name":1357,"slug":1358,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1434,"name":1435,"slug":1436,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1438,"name":1439,"slug":1440,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1442,"name":1443,"slug":1444,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-validate-a-zugferd-pdf-in-net-with-c\u002F","How to Validate a ZUGFeRD PDF in .NET with C# | pdfRest",{"id":11528,"uuid":11529,"title":11530,"slug":11531,"html":11532,"comment_id":11528,"feature_image":48,"featured":284,"visibility":1257,"created_at":11533,"updated_at":7740,"published_at":7740,"custom_excerpt":11534,"codeinjection_head":11535,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11536,"primary_tag":48,"url":11544,"excerpt":11534,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11545,"meta_description":11534,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6aad55b1d1b70dd2e2978f4b","db067038-791a-4369-bc71-ceb8afaabf47","How to Validate a ZUGFeRD PDF with cURL","how-to-validate-a-zugferd-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This tutorial shows how to validate an existing ZUGFeRD or Factur-X hybrid invoice with cURL. It uses the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-zugferd-pdf\u002F\">pdfRest Create ZUGFeRD PDF API Tool\u003C\u002Fa> to submit the invoice PDF to its validation endpoint and print the response without modifying the document.\u003C\u002Fp>\n\n\u003Ch2>Why Validate a ZUGFeRD PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>Receiving an invoice PDF is not the same as knowing that it is a usable hybrid electronic invoice. A validation step checks the ZUGFeRD or Factur-X package and its PDF\u002FA conformance before a receiving, records, or accounts-payable workflow treats the file as an accepted result.\u003C\u002Fp>\n\n\u003Cp>For example, a cURL intake service can validate supplier invoices as they arrive, retain the response with the processing record, and route an unsuccessful result for follow-up before the invoice enters an automated approval path. This gives operational teams a clear decision point rather than discovering a problem later in the workflow.\u003C\u002Fp>\n\n\u003Cp>Validation does not repair or replace the submitted PDF. It reports on the existing hybrid invoice, allowing the calling application to preserve the original, request a corrected version, or route the document to a separate creation or remediation process when appropriate.\u003C\u002Fp>\n\n\u003Ch2>What the Request Does\u003C\u002Fh2>\n\n\u003Cp>The multipart request contains one PDF in the \u003Ccode>file\u003C\u002Fcode> field. The endpoint analyzes that existing document and returns validation information; it does not generate a replacement invoice or modify the supplied PDF.\u003C\u002Fp>\n\n\u003Cp>The shell sample uses cURL directly. Set the service URL, API key, and local input paths near the top of the script before running it.\u003C\u002Fp>\n\n\u003Ch2>How to Validate a ZUGFeRD PDF with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">#!\u002Fbin\u002Fsh\n\n# Validate a hybrid ZUGFeRD \u002F Factur-X PDF without modifying it.\n# By default, we use the US-based API service. This is the primary endpoint for global use.\nAPI_URL=\"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n# API_URL=\"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# Replace the API key and PDF path below with your own values.\nAPI_KEY=\"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" # Replace with your API key\nZUGFERD_PDF=\"\u002Fpath\u002Fto\u002Fzugferd-invoice.pdf\"\n\ncurl --location \"$API_URL\u002Fvalidated-zugferd\" \\\n  --header \"Accept: application\u002Fjson\" \\\n  --header \"Api-Key: $API_KEY\" \\\n  --form \"file=@$ZUGFERD_PDF;type=application\u002Fpdf\"\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics-erics\u002Fpdf-rest-api-samples\u002Fblob\u002Fcodex\u002Fzugferd-api-samples\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fvalidated-zugferd.sh\">View the multipart sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The request is compact, but each field has a distinct role in the hybrid-invoice workflow.\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Cstrong>Submit the finished hybrid invoice.\u003C\u002Fstrong> Validation accepts one existing ZUGFeRD or Factur-X PDF through the \u003Ccode>file\u003C\u002Fcode> field. The code sends it as \u003Ccode>application\u002Fpdf\u003C\u002Fcode> and does not include XML, \u003Ccode>pdf_file\u003C\u002Fcode>, \u003Ccode>regenerate_pdf\u003C\u002Fcode>, or \u003Ccode>render_options\u003C\u002Fcode>.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Build the multipart request.\u003C\u002Fstrong> \u003Ccode>curl --form\u003C\u002Fcode> builds the multipart body. The \u003Ccode>@\u003C\u002Fcode> prefix uploads a local file, and cURL supplies the multipart boundary automatically.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Configure the request safely.\u003C\u002Fstrong> Set \u003Ccode>API_URL\u003C\u002Fcode>, \u003Ccode>API_KEY\u003C\u002Fcode>, and the local input paths near the beginning of the script. The commented EU URL is an optional regional service setting.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Call the validation endpoint.\u003C\u002Fstrong> The request goes to \u003Ccode>\u002Fvalidated-zugferd\u003C\u002Fcode>, which is the validation endpoint within the Create ZUGFeRD PDF API Tool. It analyzes the submitted document without replacing or modifying it.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Use the result as a workflow decision.\u003C\u002Fstrong> The command prints the service response. In an application script, inspect the HTTP result and JSON before treating a returned resource ID or validation result as usable. A receiving or accounts-payable service can continue an accepted path or send an unsuccessful result for review.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this cURL tutorial, you submitted an existing hybrid invoice for validation and handled the returned result as application data. That pattern fits an intake gate, a supplier-invoice check, or a controlled audit record.\u003C\u002Fp>\n\n\u003Cp>For the complete request fields, accepted values, response contract, and service limits, review the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fvalidate-zugferd-pdf\u002F\">Create ZUGFeRD PDF API Tool documentation for the validation endpoint\u003C\u002Fa>. The same endpoint can be used with multipart uploads when the files are present in the current request or with resource IDs after a separate upload step.\u003C\u002Fp>\n\n\u003Cp>The repository also includes a \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics-erics\u002Fpdf-rest-api-samples\u002Fblob\u002Fcodex\u002Fzugferd-api-samples\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fvalidated-zugferd.sh\">JSON-payload Validate ZUGFeRD PDF sample for cURL\u003C\u002Fa>. That version uploads the source files first and then sends their resource IDs to \u003Ccode>\u002Fvalidated-zugferd\u003C\u002Fcode>, which is useful when a service already stages input files for later operations.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-18T15:16:01.000+00:00","Validate a ZUGFeRD or Factur-X hybrid invoice and its PDF\u002FA conformance with pdfRest using cURL.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-a-zugferd-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Validate a ZUGFeRD PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-a-zugferd-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-a-zugferd-pdf-with-curl\u002F\",\n      \"datePublished\": \"2026-09-18T15:16:01.000Z\",\n      \"dateModified\": \"2026-09-18T20:12:28.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Validate a ZUGFeRD or Factur-X hybrid invoice and its PDF\u002FA conformance with pdfRest using cURL.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Create ZUGFeRD PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-zugferd-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fvalidated-zugferd API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fvalidate-zugferd-pdf\u002F\"\n        }\n      ],\n      \"keywords\": \"Validate, ZUGFeRD, Factur-X, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Validate a ZUGFeRD PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-a-zugferd-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11537,11538,11539,11540,11541,11542,11543],{"id":1356,"name":1357,"slug":1358,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1434,"name":1435,"slug":1436,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1438,"name":1439,"slug":1440,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1442,"name":1443,"slug":1444,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-validate-a-zugferd-pdf-with-curl\u002F","How to Validate a ZUGFeRD PDF with cURL | pdfRest",{"id":11547,"uuid":11548,"title":11549,"slug":11550,"html":11551,"comment_id":11547,"feature_image":48,"featured":284,"visibility":1257,"created_at":11533,"updated_at":11514,"published_at":11514,"custom_excerpt":11552,"codeinjection_head":11553,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11554,"primary_tag":48,"url":11562,"excerpt":11552,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11563,"meta_description":11552,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6aad55b1d1b70dd2e2978f54","0a4eda4e-8a9a-4bc2-9e5f-f7c796d15816","How to Validate a ZUGFeRD PDF with Java","how-to-validate-a-zugferd-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This tutorial shows how to validate an existing ZUGFeRD or Factur-X hybrid invoice with Java. It uses the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-zugferd-pdf\u002F\">pdfRest Create ZUGFeRD PDF API Tool\u003C\u002Fa> to submit the invoice PDF to its validation endpoint and print the response without modifying the document.\u003C\u002Fp>\n\n\u003Ch2>Why Validate a ZUGFeRD PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>Receiving an invoice PDF is not the same as knowing that it is a usable hybrid electronic invoice. A validation step checks the ZUGFeRD or Factur-X package and its PDF\u002FA conformance before a receiving, records, or accounts-payable workflow treats the file as an accepted result.\u003C\u002Fp>\n\n\u003Cp>For example, a Java intake service can validate supplier invoices as they arrive, retain the response with the processing record, and route an unsuccessful result for follow-up before the invoice enters an automated approval path. This gives operational teams a clear decision point rather than discovering a problem later in the workflow.\u003C\u002Fp>\n\n\u003Cp>Validation does not repair or replace the submitted PDF. It reports on the existing hybrid invoice, allowing the calling application to preserve the original, request a corrected version, or route the document to a separate creation or remediation process when appropriate.\u003C\u002Fp>\n\n\u003Ch2>What the Request Does\u003C\u002Fh2>\n\n\u003Cp>The multipart request contains one PDF in the \u003Ccode>file\u003C\u002Fcode> field. The endpoint analyzes that existing document and returns validation information; it does not generate a replacement invoice or modify the supplied PDF.\u003C\u002Fp>\n\n\u003Cp>The Java samples use OkHttp for HTTP and the repository’s established project dependencies. Applications adopting the class should provide equivalent dependencies and obtain credentials from secure runtime configuration.\u003C\u002Fp>\n\n\u003Ch2>How to Validate a ZUGFeRD PDF with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.MediaType;\nimport okhttp3.MultipartBody;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.RequestBody;\nimport okhttp3.Response;\n\npublic class ValidatedZugferd {\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, use the EU-based service\n  \u002F\u002F instead.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n  private static final OkHttpClient CLIENT =\n      new OkHttpClient.Builder().readTimeout(60, TimeUnit.SECONDS).build();\n\n  public static void main(String[] args) throws IOException {\n    \u002F\u002F Specify the completed hybrid ZUGFeRD or Factur-X PDF path here, or as the first program\n    \u002F\u002F argument.\n    File zugferdPdf = new File(args.length > 0 ? args[0] : \"\u002Fpath\u002Fto\u002Fzugferd-invoice.pdf\");\n    String apiKey =\n        Dotenv.configure()\n            .ignoreIfMalformed()\n            .ignoreIfMissing()\n            .load()\n            .get(\"PDFREST_API_KEY\", DEFAULT_API_KEY);\n    \u002F\u002F Validate a hybrid ZUGFeRD \u002F Factur-X PDF without modifying it.\n    MultipartBody body =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\n                \"file\",\n                zugferdPdf.getName(),\n                RequestBody.create(zugferdPdf, MediaType.parse(\"application\u002Fpdf\")))\n            .build();\n    send(\n        new Request.Builder()\n            .url(API_URL + \"\u002Fvalidated-zugferd\")\n            .header(\"Api-Key\", apiKey)\n            .post(body)\n            .build());\n  }\n\n  private static void send(Request request) throws IOException {\n    try (Response response = CLIENT.newCall(request).execute()) {\n      String body = response.body() == null ? \"\" : response.body().string();\n      System.out.println(\"Result code \" + response.code());\n      System.out.println(body);\n      if (!response.isSuccessful()) {\n        System.exit(1);\n      }\n    }\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics-erics\u002Fpdf-rest-api-samples\u002Fblob\u002Fcodex\u002Fzugferd-api-samples\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FValidatedZugferd.java\">View the multipart sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The request is compact, but each field has a distinct role in the hybrid-invoice workflow.\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Cstrong>Submit the finished hybrid invoice.\u003C\u002Fstrong> Validation accepts one existing ZUGFeRD or Factur-X PDF through the \u003Ccode>file\u003C\u002Fcode> field. The code sends it as \u003Ccode>application\u002Fpdf\u003C\u002Fcode> and does not include XML, \u003Ccode>pdf_file\u003C\u002Fcode>, \u003Ccode>regenerate_pdf\u003C\u002Fcode>, or \u003Ccode>render_options\u003C\u002Fcode>.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Build the multipart request.\u003C\u002Fstrong> \u003Ccode>MultipartBody.Builder\u003C\u002Fcode> creates the form and its boundary. \u003Ccode>RequestBody.create\u003C\u002Fcode> assigns the XML and PDF media types before the request is sent with OkHttp.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Configure the request safely.\u003C\u002Fstrong> The sample loads \u003Ccode>PDFREST_API_KEY\u003C\u002Fcode> through dotenv, with a placeholder only as a fallback. Replace the placeholder and keep real credentials outside source control.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Call the validation endpoint.\u003C\u002Fstrong> The request goes to \u003Ccode>\u002Fvalidated-zugferd\u003C\u002Fcode>, which is the validation endpoint within the Create ZUGFeRD PDF API Tool. It analyzes the submitted document without replacing or modifying it.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Use the result as a workflow decision.\u003C\u002Fstrong> The \u003Ccode>send\u003C\u002Fcode> method reads and prints the JSON body, then exits nonzero when \u003Ccode>response.isSuccessful()\u003C\u002Fcode> is false. A production caller can parse a successful body after that check. A receiving or accounts-payable service can continue an accepted path or send an unsuccessful result for review.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this Java tutorial, you submitted an existing hybrid invoice for validation and handled the returned result as application data. That pattern fits an intake gate, a supplier-invoice check, or a controlled audit record.\u003C\u002Fp>\n\n\u003Cp>For the complete request fields, accepted values, response contract, and service limits, review the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fvalidate-zugferd-pdf\u002F\">Create ZUGFeRD PDF API Tool documentation for the validation endpoint\u003C\u002Fa>. The same endpoint can be used with multipart uploads when the files are present in the current request or with resource IDs after a separate upload step.\u003C\u002Fp>\n\n\u003Cp>The repository also includes a \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics-erics\u002Fpdf-rest-api-samples\u002Fblob\u002Fcodex\u002Fzugferd-api-samples\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FValidatedZugferd.java\">JSON-payload Validate ZUGFeRD PDF sample for Java\u003C\u002Fa>. That version uploads the source files first and then sends their resource IDs to \u003Ccode>\u002Fvalidated-zugferd\u003C\u002Fcode>, which is useful when a service already stages input files for later operations.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Validate a ZUGFeRD or Factur-X hybrid invoice and its PDF\u002FA conformance with pdfRest using Java.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-a-zugferd-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Validate a ZUGFeRD PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-a-zugferd-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-a-zugferd-pdf-with-java\u002F\",\n      \"datePublished\": \"2026-09-18T15:16:01.000Z\",\n      \"dateModified\": \"2026-09-18T20:12:29.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Validate a ZUGFeRD or Factur-X hybrid invoice and its PDF\u002FA conformance with pdfRest using Java.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Create ZUGFeRD PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-zugferd-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fvalidated-zugferd API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fvalidate-zugferd-pdf\u002F\"\n        }\n      ],\n      \"keywords\": \"Validate, ZUGFeRD, Factur-X, Java\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Validate a ZUGFeRD PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-a-zugferd-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11555,11556,11557,11558,11559,11560,11561],{"id":1356,"name":1357,"slug":1358,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1434,"name":1435,"slug":1436,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1438,"name":1439,"slug":1440,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1442,"name":1443,"slug":1444,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-validate-a-zugferd-pdf-with-java\u002F","How to Validate a ZUGFeRD PDF with Java | pdfRest",{"id":11565,"uuid":11566,"title":11567,"slug":11568,"html":11569,"comment_id":11565,"feature_image":48,"featured":284,"visibility":1257,"created_at":11533,"updated_at":11514,"published_at":11514,"custom_excerpt":11570,"codeinjection_head":11571,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11572,"primary_tag":48,"url":11580,"excerpt":11570,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11581,"meta_description":11570,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6aad55b1d1b70dd2e2978f5d","fddf3bc3-c019-44e7-88d1-51d00d529e43","How to Validate a ZUGFeRD PDF with JavaScript in NodeJS","how-to-validate-a-zugferd-pdf-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This tutorial shows how to validate an existing ZUGFeRD or Factur-X hybrid invoice with JavaScript in NodeJS. It uses the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-zugferd-pdf\u002F\">pdfRest Create ZUGFeRD PDF API Tool\u003C\u002Fa> to submit the invoice PDF to its validation endpoint and print the response without modifying the document.\u003C\u002Fp>\n\n\u003Ch2>Why Validate a ZUGFeRD PDF with JavaScript in NodeJS?\u003C\u002Fh2>\n\n\u003Cp>Receiving an invoice PDF is not the same as knowing that it is a usable hybrid electronic invoice. A validation step checks the ZUGFeRD or Factur-X package and its PDF\u002FA conformance before a receiving, records, or accounts-payable workflow treats the file as an accepted result.\u003C\u002Fp>\n\n\u003Cp>For example, a JavaScript in NodeJS intake service can validate supplier invoices as they arrive, retain the response with the processing record, and route an unsuccessful result for follow-up before the invoice enters an automated approval path. This gives operational teams a clear decision point rather than discovering a problem later in the workflow.\u003C\u002Fp>\n\n\u003Cp>Validation does not repair or replace the submitted PDF. It reports on the existing hybrid invoice, allowing the calling application to preserve the original, request a corrected version, or route the document to a separate creation or remediation process when appropriate.\u003C\u002Fp>\n\n\u003Ch2>What the Request Does\u003C\u002Fh2>\n\n\u003Cp>The multipart request contains one PDF in the \u003Ccode>file\u003C\u002Fcode> field. The endpoint analyzes that existing document and returns validation information; it does not generate a replacement invoice or modify the supplied PDF.\u003C\u002Fp>\n\n\u003Cp>The NodeJS samples use Axios for HTTP, FormData for multipart construction, and streams from the file system for local inputs. Keep the API key in protected runtime configuration rather than in application source.\u003C\u002Fp>\n\n\u003Ch2>How to Validate a ZUGFeRD PDF with JavaScript in NodeJS Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F Validate a hybrid ZUGFeRD \u002F Factur-X PDF without modifying it.\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\nvar apiUrl = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002Fvar apiUrl = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n\u002F\u002F Set this path to the completed hybrid ZUGFeRD or Factur-X PDF you want to validate.\nvar zugferdPdf = \"\u002Fpath\u002Fto\u002Fzugferd-invoice.pdf\";\nvar data = new FormData();\ndata.append('file', fs.createReadStream(zugferdPdf));\n\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: apiUrl + '\u002Fvalidated-zugferd',\n  headers: {\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders()\n  },\n  data: data\n};\n\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error);\n});\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics-erics\u002Fpdf-rest-api-samples\u002Fblob\u002Fcodex\u002Fzugferd-api-samples\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fvalidated-zugferd.js\">View the multipart sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The request is compact, but each field has a distinct role in the hybrid-invoice workflow.\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Cstrong>Submit the finished hybrid invoice.\u003C\u002Fstrong> Validation accepts one existing ZUGFeRD or Factur-X PDF through the \u003Ccode>file\u003C\u002Fcode> field. The code sends it as \u003Ccode>application\u002Fpdf\u003C\u002Fcode> and does not include XML, \u003Ccode>pdf_file\u003C\u002Fcode>, \u003Ccode>regenerate_pdf\u003C\u002Fcode>, or \u003Ccode>render_options\u003C\u002Fcode>.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Build the multipart request.\u003C\u002Fstrong> \u003Ccode>FormData\u003C\u002Fcode> receives NodeJS file streams and text fields. Passing \u003Ccode>form.getHeaders()\u003C\u002Fcode> to Axios is important because it carries the generated multipart boundary.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Configure the request safely.\u003C\u002Fstrong> The sample reads local paths and the API key from its configuration values. Keep the key in protected runtime configuration rather than committing it with the application.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Call the validation endpoint.\u003C\u002Fstrong> The request goes to \u003Ccode>\u002Fvalidated-zugferd\u003C\u002Fcode>, which is the validation endpoint within the Create ZUGFeRD PDF API Tool. It analyzes the submitted document without replacing or modifying it.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Use the result as a workflow decision.\u003C\u002Fstrong> Axios exposes successful JSON through \u003Ccode>response.data\u003C\u002Fcode>. Its error path prints the returned API detail when available, which separates a service response from a network or setup failure. A receiving or accounts-payable service can continue an accepted path or send an unsuccessful result for review.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this JavaScript in NodeJS tutorial, you submitted an existing hybrid invoice for validation and handled the returned result as application data. That pattern fits an intake gate, a supplier-invoice check, or a controlled audit record.\u003C\u002Fp>\n\n\u003Cp>For the complete request fields, accepted values, response contract, and service limits, review the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fvalidate-zugferd-pdf\u002F\">Create ZUGFeRD PDF API Tool documentation for the validation endpoint\u003C\u002Fa>. The same endpoint can be used with multipart uploads when the files are present in the current request or with resource IDs after a separate upload step.\u003C\u002Fp>\n\n\u003Cp>The repository also includes a \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics-erics\u002Fpdf-rest-api-samples\u002Fblob\u002Fcodex\u002Fzugferd-api-samples\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fvalidated-zugferd.js\">JSON-payload Validate ZUGFeRD PDF sample for JavaScript in NodeJS\u003C\u002Fa>. That version uploads the source files first and then sends their resource IDs to \u003Ccode>\u002Fvalidated-zugferd\u003C\u002Fcode>, which is useful when a service already stages input files for later operations.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","Validate a ZUGFeRD or Factur-X hybrid invoice and its PDF\u002FA conformance with pdfRest using JavaScript in NodeJS.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-a-zugferd-pdf-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Validate a ZUGFeRD PDF with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-a-zugferd-pdf-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-a-zugferd-pdf-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2026-09-18T15:16:01.000Z\",\n      \"dateModified\": \"2026-09-18T20:12:29.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Validate a ZUGFeRD or Factur-X hybrid invoice and its PDF\u002FA conformance with pdfRest using JavaScript in NodeJS.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Create ZUGFeRD PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-zugferd-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fvalidated-zugferd API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fvalidate-zugferd-pdf\u002F\"\n        }\n      ],\n      \"keywords\": \"Validate, ZUGFeRD, Factur-X, JavaScript, NodeJS\",\n      \"dependencies\": \"JavaScript, NodeJS, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Validate a ZUGFeRD PDF with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-a-zugferd-pdf-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11573,11574,11575,11576,11577,11578,11579],{"id":1356,"name":1357,"slug":1358,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1434,"name":1435,"slug":1436,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1438,"name":1439,"slug":1440,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1442,"name":1443,"slug":1444,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-validate-a-zugferd-pdf-with-javascript-in-nodejs\u002F","How to Validate a ZUGFeRD PDF with JavaScript in NodeJS | pdfRest",{"id":11583,"uuid":11584,"title":11585,"slug":11586,"html":11587,"comment_id":11583,"feature_image":48,"featured":284,"visibility":1257,"created_at":11513,"updated_at":11588,"published_at":11588,"custom_excerpt":11589,"codeinjection_head":11590,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11591,"primary_tag":48,"url":11599,"excerpt":11589,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11600,"meta_description":11589,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6aad55b2d1b70dd2e2978f6f","00b20564-90bf-48e1-87e5-9515a94efb4a","How to Validate a ZUGFeRD PDF with PHP","how-to-validate-a-zugferd-pdf-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This tutorial shows how to validate an existing ZUGFeRD or Factur-X hybrid invoice with PHP. It uses the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-zugferd-pdf\u002F\">pdfRest Create ZUGFeRD PDF API Tool\u003C\u002Fa> to submit the invoice PDF to its validation endpoint and print the response without modifying the document.\u003C\u002Fp>\n\n\u003Ch2>Why Validate a ZUGFeRD PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>Receiving an invoice PDF is not the same as knowing that it is a usable hybrid electronic invoice. A validation step checks the ZUGFeRD or Factur-X package and its PDF\u002FA conformance before a receiving, records, or accounts-payable workflow treats the file as an accepted result.\u003C\u002Fp>\n\n\u003Cp>For example, a PHP intake service can validate supplier invoices as they arrive, retain the response with the processing record, and route an unsuccessful result for follow-up before the invoice enters an automated approval path. This gives operational teams a clear decision point rather than discovering a problem later in the workflow.\u003C\u002Fp>\n\n\u003Cp>Validation does not repair or replace the submitted PDF. It reports on the existing hybrid invoice, allowing the calling application to preserve the original, request a corrected version, or route the document to a separate creation or remediation process when appropriate.\u003C\u002Fp>\n\n\u003Ch2>What the Request Does\u003C\u002Fh2>\n\n\u003Cp>The multipart request contains one PDF in the \u003Ccode>file\u003C\u002Fcode> field. The endpoint analyzes that existing document and returns validation information; it does not generate a replacement invoice or modify the supplied PDF.\u003C\u002Fp>\n\n\u003Cp>The PHP samples use Guzzle and PSR-7 stream utilities. Install Guzzle with Composer when moving the code outside the repository and supply the API key through protected configuration.\u003C\u002Fp>\n\n\u003Ch2>How to Validate a ZUGFeRD PDF with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n\u002F\u002F Validate a hybrid ZUGFeRD \u002F Factur-X PDF without modifying it.\n\u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n$apiUrl = 'https:\u002F\u002Fapi.pdfrest.com';\n\n\u002F* For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n * For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n *\u002F\n\u002F\u002F$apiUrl = 'https:\u002F\u002Feu-api.pdfrest.com';\n\n\u002F\u002F Set this path to the completed hybrid ZUGFeRD or Factur-X PDF you want to validate.\n$apiKey = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';\n$zugferdPdf = '\u002Fpath\u002Fto\u002Fzugferd-invoice.pdf';\n\n$client = new Client();\n$headers = ['Accept' => 'application\u002Fjson', 'Api-Key' => $apiKey];\n$options = [\n    'multipart' => [['name' => 'file', 'contents' => Utils::tryFopen($zugferdPdf, 'r'), 'filename' => basename($zugferdPdf), 'headers' => ['Content-Type' => 'application\u002Fpdf']]],\n];\n$request = new Request('POST', $apiUrl . '\u002Fvalidated-zugferd', $headers);\n$response = $client->sendAsync($request, $options)->wait();\necho $response->getBody();\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics-erics\u002Fpdf-rest-api-samples\u002Fblob\u002Fcodex\u002Fzugferd-api-samples\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fvalidated-zugferd.php\">View the multipart sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The request is compact, but each field has a distinct role in the hybrid-invoice workflow.\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Cstrong>Submit the finished hybrid invoice.\u003C\u002Fstrong> Validation accepts one existing ZUGFeRD or Factur-X PDF through the \u003Ccode>file\u003C\u002Fcode> field. The code sends it as \u003Ccode>application\u002Fpdf\u003C\u002Fcode> and does not include XML, \u003Ccode>pdf_file\u003C\u002Fcode>, \u003Ccode>regenerate_pdf\u003C\u002Fcode>, or \u003Ccode>render_options\u003C\u002Fcode>.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Build the multipart request.\u003C\u002Fstrong> Guzzle receives the multipart body as an array. File entries provide an opened stream, filename, and content type; text entries carry the ordinary API options.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Configure the request safely.\u003C\u002Fstrong> Configure the endpoint, key, and input paths before running the sample. Use Composer-managed Guzzle dependencies and keep the credential in protected application configuration.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Call the validation endpoint.\u003C\u002Fstrong> The request goes to \u003Ccode>\u002Fvalidated-zugferd\u003C\u002Fcode>, which is the validation endpoint within the Create ZUGFeRD PDF API Tool. It analyzes the submitted document without replacing or modifying it.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Use the result as a workflow decision.\u003C\u002Fstrong> The response body is printed as JSON. Check the HTTP status before accepting the result so an error document is not confused with a successful output or validation response. A receiving or accounts-payable service can continue an accepted path or send an unsuccessful result for review.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this PHP tutorial, you submitted an existing hybrid invoice for validation and handled the returned result as application data. That pattern fits an intake gate, a supplier-invoice check, or a controlled audit record.\u003C\u002Fp>\n\n\u003Cp>For the complete request fields, accepted values, response contract, and service limits, review the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fvalidate-zugferd-pdf\u002F\">Create ZUGFeRD PDF API Tool documentation for the validation endpoint\u003C\u002Fa>. The same endpoint can be used with multipart uploads when the files are present in the current request or with resource IDs after a separate upload step.\u003C\u002Fp>\n\n\u003Cp>The repository also includes a \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics-erics\u002Fpdf-rest-api-samples\u002Fblob\u002Fcodex\u002Fzugferd-api-samples\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fvalidated-zugferd.php\">JSON-payload Validate ZUGFeRD PDF sample for PHP\u003C\u002Fa>. That version uploads the source files first and then sends their resource IDs to \u003Ccode>\u002Fvalidated-zugferd\u003C\u002Fcode>, which is useful when a service already stages input files for later operations.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-18T20:27:41.000+00:00","Validate a ZUGFeRD or Factur-X hybrid invoice and its PDF\u002FA conformance with pdfRest using PHP.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-a-zugferd-pdf-with-php\u002F#article\",\n      \"headline\": \"How to Validate a ZUGFeRD PDF with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-a-zugferd-pdf-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-a-zugferd-pdf-with-php\u002F\",\n      \"datePublished\": \"2026-09-18T15:16:02.000Z\",\n      \"dateModified\": \"2026-09-18T20:12:30.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Validate a ZUGFeRD or Factur-X hybrid invoice and its PDF\u002FA conformance with pdfRest using PHP.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Create ZUGFeRD PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-zugferd-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fvalidated-zugferd API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fvalidate-zugferd-pdf\u002F\"\n        }\n      ],\n      \"keywords\": \"Validate, ZUGFeRD, Factur-X, PHP\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Validate a ZUGFeRD PDF with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-a-zugferd-pdf-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11592,11593,11594,11595,11596,11597,11598],{"id":1356,"name":1357,"slug":1358,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1434,"name":1435,"slug":1436,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1438,"name":1439,"slug":1440,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1442,"name":1443,"slug":1444,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-validate-a-zugferd-pdf-with-php\u002F","How to Validate a ZUGFeRD PDF with PHP | pdfRest",{"id":11602,"uuid":11603,"title":11604,"slug":11605,"html":11606,"comment_id":11602,"feature_image":48,"featured":284,"visibility":1257,"created_at":11513,"updated_at":11607,"published_at":11608,"custom_excerpt":11609,"codeinjection_head":11610,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11611,"primary_tag":48,"url":11619,"excerpt":11609,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11620,"meta_description":11609,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6aad55b2d1b70dd2e2978f78","271e315d-fb27-48fe-b3a4-179c749cc93c","How to Validate a ZUGFeRD PDF with Python","how-to-validate-a-zugferd-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Cp>This tutorial shows how to validate an existing ZUGFeRD or Factur-X hybrid invoice with Python. It uses the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-zugferd-pdf\u002F\">pdfRest Create ZUGFeRD PDF API Tool\u003C\u002Fa> to submit the invoice PDF to its validation endpoint and print the response without modifying the document.\u003C\u002Fp>\n\n\u003Ch2>Why Validate a ZUGFeRD PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>Receiving an invoice PDF is not the same as knowing that it is a usable hybrid electronic invoice. A validation step checks the ZUGFeRD or Factur-X package and its PDF\u002FA conformance before a receiving, records, or accounts-payable workflow treats the file as an accepted result.\u003C\u002Fp>\n\n\u003Cp>For example, a Python intake service can validate supplier invoices as they arrive, retain the response with the processing record, and route an unsuccessful result for follow-up before the invoice enters an automated approval path. This gives operational teams a clear decision point rather than discovering a problem later in the workflow.\u003C\u002Fp>\n\n\u003Cp>Validation does not repair or replace the submitted PDF. It reports on the existing hybrid invoice, allowing the calling application to preserve the original, request a corrected version, or route the document to a separate creation or remediation process when appropriate.\u003C\u002Fp>\n\n\u003Ch2>What the Request Does\u003C\u002Fh2>\n\n\u003Cp>The multipart request contains one PDF in the \u003Ccode>file\u003C\u002Fcode> field. The endpoint analyzes that existing document and returns validation information; it does not generate a replacement invoice or modify the supplied PDF.\u003C\u002Fp>\n\n\u003Cp>The Python samples use \u003Ccode>requests\u003C\u002Fcode> and \u003Ccode>requests-toolbelt\u003C\u002Fcode>. Install those packages in the application environment and keep the API key in an environment variable or other secure configuration store.\u003C\u002Fp>\n\n\u003Ch2>How to Validate a ZUGFeRD PDF with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">import json\nimport os\nimport requests\nfrom requests_toolbelt import MultipartEncoder\n\n# Validate a hybrid ZUGFeRD \u002F Factur-X PDF without modifying it.\n# By default, we use the US-based API service. This is the primary endpoint for global use.\napi_url = \"https:\u002F\u002Fapi.pdfrest.com\"\n\n# For GDPR compliance and enhanced performance for European users, you can switch to the EU-based service by uncommenting the URL below.\n# For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n#api_url = \"https:\u002F\u002Feu-api.pdfrest.com\"\n\n# Set this path to the completed hybrid ZUGFeRD or Factur-X PDF you want to validate.\napi_key = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\nzugferd_pdf = \"\u002Fpath\u002Fto\u002Fzugferd-invoice.pdf\"\n\nmp_encoder_zugferd = MultipartEncoder(\n    fields={'file': ('zugferd-invoice.pdf', open(zugferd_pdf, 'rb'), 'application\u002Fpdf')}\n)\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_zugferd.content_type,\n    'Api-Key': api_key\n}\n\nprint(\"Sending POST request to validated-zugferd endpoint...\")\nresponse = requests.post(api_url + '\u002Fvalidated-zugferd', data=mp_encoder_zugferd, headers=headers)\nprint(\"Response status code: \" + str(response.status_code))\nif response.ok:\n    print(json.dumps(response.json(), indent=2))\nelse:\n    print(response.text)\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics-erics\u002Fpdf-rest-api-samples\u002Fblob\u002Fcodex\u002Fzugferd-api-samples\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fvalidated-zugferd.py\">View the multipart sample on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The request is compact, but each field has a distinct role in the hybrid-invoice workflow.\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Cstrong>Submit the finished hybrid invoice.\u003C\u002Fstrong> Validation accepts one existing ZUGFeRD or Factur-X PDF through the \u003Ccode>file\u003C\u002Fcode> field. The code sends it as \u003Ccode>application\u002Fpdf\u003C\u002Fcode> and does not include XML, \u003Ccode>pdf_file\u003C\u002Fcode>, \u003Ccode>regenerate_pdf\u003C\u002Fcode>, or \u003Ccode>render_options\u003C\u002Fcode>.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Build the multipart request.\u003C\u002Fstrong> \u003Ccode>MultipartEncoder\u003C\u002Fcode> combines file tuples with text fields. Its \u003Ccode>content_type\u003C\u002Fcode> includes the multipart boundary, so the request headers reuse that value.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Configure the request safely.\u003C\u002Fstrong> Set the service URL, API key, and source paths before running the script. The sample uses \u003Ccode>requests\u003C\u002Fcode> and \u003Ccode>requests-toolbelt\u003C\u002Fcode> for the HTTP and multipart work.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Call the validation endpoint.\u003C\u002Fstrong> The request goes to \u003Ccode>\u002Fvalidated-zugferd\u003C\u002Fcode>, which is the validation endpoint within the Create ZUGFeRD PDF API Tool. It analyzes the submitted document without replacing or modifying it.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Use the result as a workflow decision.\u003C\u002Fstrong> The \u003Ccode>response.ok\u003C\u002Fcode> branch prints formatted JSON; the other branch prints the error response. Treat output identifiers or validation values as application data only from the successful branch. A receiving or accounts-payable service can continue an accepted path or send an unsuccessful result for review.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this Python tutorial, you submitted an existing hybrid invoice for validation and handled the returned result as application data. That pattern fits an intake gate, a supplier-invoice check, or a controlled audit record.\u003C\u002Fp>\n\n\u003Cp>For the complete request fields, accepted values, response contract, and service limits, review the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fvalidate-zugferd-pdf\u002F\">Create ZUGFeRD PDF API Tool documentation for the validation endpoint\u003C\u002Fa>. The same endpoint can be used with multipart uploads when the files are present in the current request or with resource IDs after a separate upload step.\u003C\u002Fp>\n\n\u003Cp>The repository also includes a \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fdatalogics-erics\u002Fpdf-rest-api-samples\u002Fblob\u002Fcodex\u002Fzugferd-api-samples\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fvalidated-zugferd.py\">JSON-payload Validate ZUGFeRD PDF sample for Python\u003C\u002Fa>. That version uploads the source files first and then sends their resource IDs to \u003Ccode>\u002Fvalidated-zugferd\u003C\u002Fcode>, which is useful when a service already stages input files for later operations.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-18T20:22:06.000+00:00","2026-09-18T20:15:50.000+00:00","Validate a ZUGFeRD or Factur-X hybrid invoice and its PDF\u002FA conformance with pdfRest using Python.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-a-zugferd-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Validate a ZUGFeRD PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-a-zugferd-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-a-zugferd-pdf-with-python\u002F\",\n      \"datePublished\": \"2026-09-18T15:16:02.000Z\",\n      \"dateModified\": \"2026-09-18T20:12:30.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Validate a ZUGFeRD or Factur-X hybrid invoice and its PDF\u002FA conformance with pdfRest using Python.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Create ZUGFeRD PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fcreate-zugferd-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fvalidated-zugferd API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fvalidate-zugferd-pdf\u002F\"\n        }\n      ],\n      \"keywords\": \"Validate, ZUGFeRD, Factur-X, Python\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Validate a ZUGFeRD PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-a-zugferd-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11612,11613,11614,11615,11616,11617,11618],{"id":1356,"name":1357,"slug":1358,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1434,"name":1435,"slug":1436,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1438,"name":1439,"slug":1440,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1442,"name":1443,"slug":1444,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-validate-a-zugferd-pdf-with-python\u002F","How to Validate a ZUGFeRD PDF with Python | pdfRest",{"id":11622,"uuid":11623,"title":11624,"slug":11625,"html":11626,"comment_id":11622,"feature_image":48,"featured":284,"visibility":1257,"created_at":11627,"updated_at":11493,"published_at":11628,"custom_excerpt":11629,"codeinjection_head":11630,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11631,"primary_tag":11637,"url":11638,"excerpt":11629,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11639,"meta_description":11629,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"664637e7533c9f26b9437992","0276ac12-45b1-476e-961a-c66a7cef7559","How to Validate PDF\u002FA Conformance in .NET with C#","how-to-validate-pdf-a-conformance-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Validate PDF\u002FA with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest Query PDF API Tool is a powerful resource for developers looking to extract information from PDF files programmatically. By leveraging this API, you can quickly obtain metadata and other details about your PDF documents without the need for manual inspection or complex parsing logic. This tutorial will guide you through the process of making an API call to the Query PDF endpoint using C#, a popular programming language for enterprise and desktop applications.\u003C\u002Fp>\n\n\u003Cp>In the real world, a user might use the Query PDF API to automate the process of cataloging a large number of PDF documents, extracting key information such as titles, page counts, languages, and authorship. For instance, a digital library service could use this API to enhance their search functionality by indexing additional metadata from their PDF collection, or a legal firm might need to quickly assess the properties of numerous case files without opening each one individually.\u003C\u002Fp>\n\n\u003Ch2>Validate PDF\u002FA with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"pdf-info\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"pdfa\"));\n        multipartContent.Add(byteArrayOption, \"queries\");\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Reference to the code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-info.cs\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided code block demonstrates how to create an HTTP client, configure a multipart\u002Fform-data request, and send it to the pdfRest API to obtain information about a PDF file. Here's a breakdown of the key components:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>This line initializes a new instance of the HttpClient class, setting the base address for the API calls to the pdfRest API endpoint.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>This line adds your API key to the request headers for authentication with the pdfRest API service. Replace the placeholder with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n\u003C\u002Fpre>\n\n\u003Cp>A new instance of MultipartFormDataContent is created to hold the file and queries as separate parts of the multipart request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name\");\n\u003C\u002Fpre>\n\n\u003Cp>These lines read the PDF file as a byte array, wrap it in a ByteArrayContent object, and add it to the multipart request with the name \"file\". Replace \"\u002Fpath\u002Fto\u002Ffile\" with the actual file path.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"pdfa\"));\nmultipartContent.Add(byteArrayOption, \"queries\");\n\u003C\u002Fpre>\n\n\u003Cp>This snippet creates another ByteArrayContent object containing the queries for the desired PDF information and adds it to the multipart request. In this case, we are only querying \"pdfa\", which triggers a PDF\u002FA validation check.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\nvar apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>These lines send the request to the pdfRest API and read the response as a string, which contains the requested PDF information in JSON format.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>Through this tutorial, you've learned how to construct and send a multipart\u002Fform-data request to the pdfRest API using C#. The response from the API provides valuable information about the PDF file, which can be used for a variety of purposes depending on your application's needs.\u003C\u002Fp>\n\n\u003Cp>To explore more capabilities and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For comprehensive documentation and additional details on how to use the API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-info.cs\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-05-16T16:44:23.000+00:00","2024-05-16T16:44:24.000+00:00","Learn how to use pdfRest Query PDF API Tool with C# to validate PDF\u002FA conformance","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Validate PDF\u002FA Conformance in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-05-16T16:44:24.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:30.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Query PDF API Tool with C# to validate PDF\u002FA conformance\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Query PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-info API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fquery-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Archival, Query PDF\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Validate PDF\u002FA Conformance in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11632,11633,11634,11635,11636],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1352,"name":1353,"slug":1354,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1702,"name":1703,"slug":1704,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-validate-pdf-a-conformance-in-net-with-c\u002F","How to Validate PDF\u002FA Conformance in .NET with C#, Tutorial | pdfRest",{"id":11641,"uuid":11642,"title":11643,"slug":11644,"html":11645,"comment_id":11641,"feature_image":48,"featured":284,"visibility":1257,"created_at":11646,"updated_at":11647,"published_at":11646,"custom_excerpt":11648,"codeinjection_head":11649,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11650,"primary_tag":11655,"url":11656,"excerpt":11648,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11657,"meta_description":11648,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"664638fb533c9f26b94379a6","6ab67ab1-101d-4617-aa22-bba70d14b140","How to Validate PDF\u002FA Conformance with cURL","how-to-validate-pdf-a-conformance-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Validate PDF\u002FA with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F'>Query PDF API Tool\u003C\u002Fa> provides a convenient way to extract specific information from PDF files programmatically. With this tool, you can retrieve metadata such as the title, page count, document language, and author of a PDF. This tutorial will show how to send an API call to Query PDF using cURL, a powerful and versatile command-line tool used for transferring data with URLs. It's a popular choice for interacting with web APIs due to its ubiquity and flexibility.\u003C\u002Fp>\n\n\u003Cp>PDF\u002FA conformance validation offers a powerful solution for seamless collaboration.  By validating your PDFs as PDF\u002FA, you're creating universally compatible documents that can be reliably opened, viewed, and processed by any recipient, regardless of their software or operating system.  This eliminates compatibility issues that can hinder workflows and communication.  Additionally, PDF\u002FA validation ensures the integrity of the document's content and embedded metadata, fostering trust and data accuracy during collaboration.  For businesses that rely on external partners or share documents frequently, PDF\u002FA validation streamlines document exchange and fosters smooth collaboration across teams.\u003C\u002Fp>\n\n\u003Ch2>Validate PDF\u002FA with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-info\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"queries=pdfa\"\n\u003C\u002Fpre>\n\n\u003Cp>The provided code is sourced from the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-info.sh\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The cURL command provided is used to make a POST request to the pdfRest API endpoint for querying PDF information. Let's break down the command:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-X POST\n\u003C\u002Fpre>\n\n\u003Cp>This specifies the HTTP method for the request, which is POST in this case, indicating that data will be sent to the server.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">\"https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-info\"\n\u003C\u002Fpre>\n\n\u003Cp>This is the URL of the API endpoint that will process the request to retrieve information from a PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\n\u003C\u002Fpre>\n\n\u003Cp>This header tells the server that the client expects a response in JSON format.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\n\u003C\u002Fpre>\n\n\u003Cp>This header indicates that the data being sent in the request is in multipart\u002Fform-data format, which is commonly used for file uploads.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>This header provides the API key required for authentication with the pdfRest service. The 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' should be replaced with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\n\u003C\u002Fpre>\n\n\u003Cp>The -F flag is used to specify each field that will be sent as part of the multipart\u002Fform-data request. Here, it indicates the file to be uploaded, with '@\u002Fpath\u002Fto\u002Ffile' being the local path to the PDF file you want to query.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"queries=pdfa\"\n\u003C\u002Fpre>\n\n\u003Cp>This field specifies the pieces of information you want to query from the PDF file. The API will return the results of a PDF\u002FA validation check with a simple true or false response.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we learned how to use cURL to make a multipart\u002Fform-data POST request to the pdfRest API to query information from a PDF file. By sending this request, we can programmatically validate whether a PDF\u002FA is conformant, allowing for conditional processing based on the result.\u003C\u002Fp>\n\n\u003Cp>To explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information on the API and its capabilities, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-info.sh\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-05-16T16:48:59.000+00:00","2026-09-02T18:29:49.000+00:00","Learn how to use Query PDF API Tool by pdfRest with cURL to validate PDF\u002FA conformance","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-curl\u002F#article\",\n      \"headline\": \"How to Validate PDF\u002FA Conformance with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-curl\u002F\",\n      \"datePublished\": \"2024-05-16T16:48:59.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:30.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use Query PDF API Tool by pdfRest with cURL to validate PDF\u002FA conformance\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Query PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-info API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fquery-pdf\"\n        }\n      ],\n      \"keywords\": \"Query PDF, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Validate PDF\u002FA Conformance with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11651,11652,11653,11654],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1352,"name":1353,"slug":1354,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-validate-pdf-a-conformance-with-curl\u002F","How to Validate PDF\u002FA Conformance with cURL, Tutorial | pdfRest",{"id":11659,"uuid":11660,"title":11661,"slug":11662,"html":11663,"comment_id":11659,"feature_image":48,"featured":284,"visibility":1257,"created_at":11431,"updated_at":11647,"published_at":11664,"custom_excerpt":11665,"codeinjection_head":11666,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11667,"primary_tag":11672,"url":11673,"excerpt":11665,"reading_time":345,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11674,"meta_description":11665,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"6a970c62533c9f26b943b5da","ee781235-4ad4-4941-8e6e-659b9755c1ad","How to Validate PDF\u002FA Conformance with Java","how-to-validate-pdf-a-conformance-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Cp>By the end of this tutorial, you'll know how to validate PDF\u002FA conformance with Java and the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F\">Query PDF API Tool\u003C\u002Fa>. The sample asks Query PDF for the \u003Ccode>pdfa\u003C\u002Fcode> property and interprets the result without changing the source document. We'll explain the important request pieces so you can use the sample as the foundation for an integration that can validate PDF\u002FA conformance.\u003C\u002Fp>\n\n\u003Ch2>Why Validate PDF\u002FA Conformance with Java?\u003C\u002Fh2>\n\n\u003Cp>An archive intake service should verify a claimed archival file instead of trusting its filename or producer metadata. Query PDF can report whether the document satisfies a PDF\u002FA standard before acceptance.\u003C\u002Fp>\n\n\u003Cp>The adapted Java request sends \u003Ccode>pdfa\u003C\u002Fcode> in the \u003Ccode>queries\u003C\u002Fcode> field for \u003Ccode>\u002Fpdf-info\u003C\u002Fcode>. The result describes detected conformance; it does not convert a nonconforming file.\u003C\u002Fp>\n\n\u003Ch2>Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class ValidatePDFA {\n\n  \u002F\u002F By default, we use the US-based API service. This is the primary endpoint for global use.\n  private static final String API_URL = \"https:\u002F\u002Fapi.pdfrest.com\";\n\n  \u002F\u002F For GDPR compliance and enhanced performance for European users, you can switch to the EU-based\n  \u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"queries\", \"pdfa\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf-info\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FPDFInfo.java\">Java sample on GitHub\u003C\u002Fa>. The linked source provides the common request pattern; the code shown here applies it to Validate PDF\u002FA Conformance.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Ch3>Load the Java HTTP and JSON dependencies\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\u003C\u002Fpre>\n\n\u003Cp>The supporting code brings together the HTTP client, environment-based API key loading, and JSON utilities used later in the example.\u003C\u002Fp>\n\n\u003Ch3>Choose the input and load credentials\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">\u002F\u002F service by commenting out the URL above and uncommenting the URL below.\n  \u002F\u002F For more information visit https:\u002F\u002Fpdfrest.com\u002Fpricing#how-do-eu-gdpr-api-calls-work\n  \u002F\u002F private static final String API_URL = \"https:\u002F\u002Feu-api.pdfrest.com\";\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\u003C\u002Fpre>\n\n\u003Cp>This setup keeps a visible default path, accepts an override from the command line, and reads the API key through dotenv.\u003C\u002Fp>\n\n\u003Ch3>Build the multipart request body\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"queries\", \"pdfa\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf-info\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>The adapted Java request sends \u003Ccode>pdfa\u003C\u002Fcode> in the \u003Ccode>queries\u003C\u002Fcode> field for \u003Ccode>\u002Fpdf-info\u003C\u002Fcode>. The result describes detected conformance; it does not convert a nonconforming file. The body construction packages fields and files together without hard-coding a \u003Ccode>Content-Type\u003C\u002Fcode> boundary.\u003C\u002Fp>\n\n\u003Ch3>Send the request to pdfRest\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">.build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(API_URL + \"\u002Fpdf-info\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\u003C\u002Fpre>\n\n\u003Cp>This builder chain reads the credential through dotenv and targets the endpoint shown in the source, with the EU hostname documented beside the default US value.\u003C\u002Fp>\n\n\u003Ch3>Read the API response\u003C\u002Fh3>\n\n\u003Cpre class=\"language-java\">OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\u003C\u002Fpre>\n\n\u003Cp>The query result reports detected PDF\u002FA conformance rather than creating a new file, allowing the application to accept, reject, or route the original PDF for conversion.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By working through this example, you now have a Java pattern you can use to validate PDF\u002FA conformance. With that foundation, you can use this check to route failures to PDF\u002FA conversion, flag supplier issues, or enforce records-ingestion policy.\u003C\u002Fp>\n\n\u003Cp>When this becomes part of an application, keep in mind that this query reports detected conformance; it does not repair or convert a failing document. Use the result to accept compliant files or route others to Convert PDF to PDF\u002FA, and keep the required profile level in application policy rather than inferring it from a filename.\u003C\u002Fp>\n\n\u003Cp>\u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> lets you try the Validate PDF\u002FA Conformance operation without first building an application. When you are ready to implement it, see the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fquery-pdf\u002F\">Query PDF API Tool documentation\u003C\u002Fa> for the complete API contract.\u003C\u002Fp>\n\n\u003Cp>Note: The Validate PDF\u002FA Conformance example above uses multipart form data; for callers that have already uploaded the source, follow the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FPDFInfo.java\">JSON payload example\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2026-09-01T21:57:42.000+00:00","Check whether a PDF conforms to a PDF\u002FA profile using Java.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-java\u002F#article\",\n      \"headline\": \"How to Validate PDF\u002FA Conformance with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-java\u002F\",\n      \"datePublished\": \"2026-09-01T21:57:42.000Z\",\n      \"dateModified\": \"2026-09-01T21:57:42.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Check whether a PDF conforms to a PDF\u002FA profile using Java.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Query PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-info API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fquery-pdf\"\n        }\n      ],\n      \"keywords\": \"Java, Query PDF\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Validate PDF\u002FA Conformance with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11668,11669,11670,11671],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1352,"name":1353,"slug":1354,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-validate-pdf-a-conformance-with-java\u002F","Validate PDF\u002FA Conformance with Java | pdfRest",{"id":11676,"uuid":11677,"title":11678,"slug":11679,"html":11680,"comment_id":11676,"feature_image":48,"featured":284,"visibility":1257,"created_at":11681,"updated_at":11647,"published_at":11681,"custom_excerpt":11682,"codeinjection_head":11683,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11684,"primary_tag":11690,"url":11691,"excerpt":11682,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11692,"meta_description":11682,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"664638ad533c9f26b943799c","2451cf30-2339-4632-8bf8-5f96fe7cdfdd","How to Validate PDF\u002FA Conformance with JavaScript in NodeJS","how-to-validate-pdf-a-conformance-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Validate PDF\u002FA with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>\nThe pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F'>Query PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to extract detailed information from PDF documents programmatically. This API provides a means to retrieve metadata, structure, and content details, which can be essential for document management systems, content analysis, and automated workflows. This tutorial will guide you through the process of sending an API call to Query PDF using JavaScript to perform a PDF\u002FA validation check.\n\u003C\u002Fp>\n\n\u003Cp>\nMany businesses operate within legal and regulatory frameworks that mandate specific document retention standards.  PDF\u002FA conformance validation plays a vital role in ensuring your digital documents meet these requirements.  By validating your PDFs as PDF\u002FA, you're creating tamper-proof archives that comply with industry regulations and legal mandates.  This helps organizations avoid potential penalties and legal risks associated with non-compliant document storage.  Furthermore, PDF\u002FA validation guarantees the long-term accessibility and searchability of electronic documents, facilitating efficient information retrieval for audits or legal proceedings.  In today's compliance-driven environment, PDF\u002FA validation offers a reliable and secure solution for managing your critical business documents.\n\u003C\u002Fp>\n\n\u003Ch2>Validate PDF\u002FA with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F\u002F This request demonstrates how to get detailed information about a PDF document and its contents to assess the current state of the file and drive conditional processing.\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('queries', 'pdfa');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-info', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>\nThe code above is sourced from the GitHub repository at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-info.js\">pdf-rest-api-samples\u003C\u002Fa>.\n\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>\nThe code sample provided demonstrates how to use the pdfRest API to query information about a PDF file. Here's a breakdown of the key parts of the code:\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\u003C\u002Fpre>\n\n\u003Cp>\nThese lines import the necessary modules: \u003Ccode>axios\u003C\u002Fcode> for making HTTP requests, \u003Ccode>FormData\u003C\u002Fcode> for constructing form data payloads, and \u003Ccode>fs\u003C\u002Fcode> for file system operations.\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\n\u003C\u002Fpre>\n\n\u003Cp>\nHere, a new \u003Ccode>FormData\u003C\u002Fcode> object is instantiated, and the PDF file is appended to it as a readable stream. The file path should be replaced with the actual path to your PDF file.\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">data.append('queries', 'pdfa');\n\u003C\u002Fpre>\n\n\u003Cp>\nThis line appends queries that specify the information you want to retrieve about the PDF file. Each query corresponds to a specific attribute or feature of the PDF, such as whether it's tagged, contains images only, and so on. In this case, we are only including \"pdfa\" to run a PDF\u002FA validation check.\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  ...\n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\n\u003C\u002Fpre>\n\n\u003Cp>\nThe \u003Ccode>config\u003C\u002Fcode> object contains the configuration for the axios request, including the HTTP method, the API endpoint URL, headers (including the API key which should be replaced with your own), and the data payload.\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\u003C\u002Fpre>\n\n\u003Cp>\nFinally, the axios request is sent, and the response is handled. If successful, the response data is logged to the console. If there is an error, it is logged as well.\n\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>\nIn this tutorial, we've learned how to use JavaScript to make a multipart API call to the pdfRest Query PDF endpoint. This enables us to programmatically retrieve a wealth of information about a PDF document, such as confirming whether or not it is a valid PDF\u002FA document. Such capabilities are invaluable for automating document processing and analysis tasks.\n\u003C\u002Fp>\n\n\u003Cp>\nTo explore more possibilities and to demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For a deeper understanding of the API and its capabilities, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\n\u003C\u002Fp>\n\n\u003Cp>\nNote: This is an example of a multipart API call. Code samples using JSON payloads can be found at the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-info.js\">pdf-rest-api-samples repository\u003C\u002Fa>.\n\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-05-16T16:47:41.000+00:00","Learn how to validate PDF\u002FA conformance with pdfRest Query PDF API Tool using JavaScript","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Validate PDF\u002FA Conformance with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-05-16T16:47:41.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:30.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to validate PDF\u002FA conformance with pdfRest Query PDF API Tool using JavaScript\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Query PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-info API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fquery-pdf\"\n        }\n      ],\n      \"keywords\": \"Archival, JavaScript, Query PDF\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Validate PDF\u002FA Conformance with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11685,11686,11687,11688,11689],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1352,"name":1353,"slug":1354,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1702,"name":1703,"slug":1704,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-validate-pdf-a-conformance-with-javascript-in-nodejs\u002F","How to Validate PDF\u002FA Conformance with JavaScript in NodeJS, Tutorial | pdfRest",{"id":11694,"uuid":11695,"title":11696,"slug":11697,"html":11698,"comment_id":11694,"feature_image":48,"featured":284,"visibility":1257,"created_at":11699,"updated_at":11700,"published_at":11699,"custom_excerpt":11701,"codeinjection_head":11702,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11703,"primary_tag":11709,"url":11710,"excerpt":11701,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11711,"meta_description":11701,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"66461a6a533c9f26b94377e8","6aef70fe-8503-4d7f-9813-5c0cd5d49de7","How to Validate PDF\u002FA Conformance with PHP","how-to-validate-pdf-a-conformance-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Validate PDF\u002FA with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F'>Query PDF API Tool\u003C\u002Fa> is a powerful resource that allows developers to extract a wide range of information from PDF files. By using this tool, you can programmatically query properties such as metadata, page count, presence of annotations, and much more. This tutorial will guide you through the process of sending an API call to Query PDF using PHP to validate PDF\u002FA conformance.\u003C\u002Fp>\n\n\u003Cp>Businesses of all sizes can leverage PDF\u002FA conformance validation to ensure the long-term accessibility and usability of their digital documents. This is especially important for organizations that rely on electronic archives, such as healthcare providers managing patient records or government agencies storing historical documents. Validating PDFs as PDF\u002FA guarantees consistent rendering regardless of the software used to create them, eliminates compatibility issues when sharing documents externally, and allows for reliable search based on embedded metadata. By automating PDF\u002FA validation, businesses can streamline document management workflows, minimize errors, and ensure their critical information remains accessible for years to come.\u003C\u002Fp>\n\n\u003Ch2>Validate PDF\u002FA with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">\nrequire 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'queries',\n      'contents' => 'pdfa'\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-info', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\n\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>This code is sourced from the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-info.php\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided PHP script uses the Guzzle HTTP client to make an API request. The \u003Ccode>require 'vendor\u002Fautoload.php';\u003C\u002Fcode> line includes the necessary files for Guzzle to work. The \u003Ccode>Client\u003C\u002Fcode> class is instantiated to create a new HTTP client. Headers are set with the required API key for authentication.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>$options\u003C\u002Fcode> array defines the multipart request payload. The 'file' part includes the PDF file to be queried, with its contents, filename, and content type. The 'queries' part specifies the information to retrieve from the PDF. This can be a comma-separated list that represents different properties of the PDF to be queried, but in this case we are only running the \"pdfa\" check for PDF\u002FA validation.\u003C\u002Fp>\n\n\u003Cp>A new \u003Ccode>Request\u003C\u002Fcode> object is created with the 'POST' method, the API endpoint URL, and the headers. The request is sent asynchronously using \u003Ccode>$client->sendAsync()\u003C\u002Fcode>, and the script waits for the response with \u003Ccode>->wait()\u003C\u002Fcode>. Finally, the response body is echoed out, which contains the queried information from the PDF.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps in this tutorial, you've learned how to set up and execute a multipart API call to pdfRest's Query PDF API endpoint using PHP. This allows you to programmatically access detailed information about PDF files, which can be crucial for various document processing tasks.\u003C\u002Fp>\n\n\u003Cp>Feel free to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for more details on how to use the pdfRest Cloud API.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-info.php\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-05-16T14:38:34.000+00:00","2026-09-02T18:29:50.000+00:00","Learn how to validate PDF\u002FA conformance with pdfRest Query PDF API Tool using PHP","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-php\u002F#article\",\n      \"headline\": \"How to Validate PDF\u002FA Conformance with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-php\u002F\",\n      \"datePublished\": \"2024-05-16T14:38:34.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:31.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to validate PDF\u002FA conformance with pdfRest Query PDF API Tool using PHP\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Query PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-info API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fquery-pdf\"\n        }\n      ],\n      \"keywords\": \"Archival, PHP, Query PDF\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Validate PDF\u002FA Conformance with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11704,11705,11706,11707,11708],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1352,"name":1353,"slug":1354,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1702,"name":1703,"slug":1704,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-validate-pdf-a-conformance-with-php\u002F","How to Validate PDF\u002FA Conformance with PHP, Tutorial | pdfRest",{"id":11713,"uuid":11714,"title":11715,"slug":11716,"html":11717,"comment_id":11713,"feature_image":48,"featured":284,"visibility":1257,"created_at":11718,"updated_at":11700,"published_at":11718,"custom_excerpt":11719,"codeinjection_head":11720,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11721,"primary_tag":11727,"url":11728,"excerpt":11719,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11729,"meta_description":11719,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"664619a6533c9f26b94377de","7d575472-ec76-4164-b97f-4448627b93ab","How to Validate PDF\u002FA Conformance with Python","how-to-validate-pdf-a-conformance-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Validate PDF\u002FA with Python?\u003C\u002Fh2>\n\n\u003Cp>pdfRest's \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F'>Query PDF API Tool\u003C\u002Fa> is an essential utility for developers and businesses looking to extract specific information from PDF documents programmatically. Included in its many features is the ability to validate conformance for PDF\u002FA documents. This tutorial will demonstrate how to send a PDF\u002FA validation API call to the Query PDF endpoint using Python, which is a popular language for scripting and automation due to its readability and extensive library support.\u003C\u002Fp>\n\n\n\u003Cp>Businesses across industries can benefit from PDF\u002FA conformance validation for several reasons. Imagine a large legal firm managing a vast digital archive of case documents. Validating these PDFs as PDF\u002FA ensures they'll be accessible and usable far into the future, regardless of the software used to create them. This allows for reliable document retrieval, accurate search based on embedded metadata, and eliminates potential compatibility issues when sharing documents with external parties. By automating PDF\u002FA validation, legal firms (and any business with long-term document storage needs) save time, reduce errors, and guarantee the integrity and accessibility of their critical information.\u003C\u002Fp>\n\n\u003Ch2>Validate PDF\u002FA with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\npdf_info_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fpdf-info'\n\n# The \u002Fpdf-info endpoint can take a single PDF file or id as input.\n# This sample demonstrates querying the pdfa check, which validates conformance and returns true or false\nmp_encoder_pdfInfo = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'queries': 'pdfa',\n    }\n)\n\n# Let's set the headers that the pdf-info endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_pdfInfo.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to pdf-info endpoint...\")\nresponse = requests.post(pdf_info_endpoint_url, data=mp_encoder_pdfInfo, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>Reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fpdf-info.py\">pdf-rest-api-samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided Python code demonstrates how to make a POST request to the \u003Ccode>pdf-info\u003C\u002Fcode> endpoint of the pdfRest API. The code uses the \u003Ccode>requests_toolbelt\u003C\u002Fcode> and \u003Ccode>requests\u003C\u002Fcode> libraries to send a multipart\u002Fform-data request, which is suitable for file uploads.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>MultipartEncoder\u003C\u002Fcode> object is created with a dictionary specifying the fields to be included in the request. The 'file' field contains a tuple with the file name, file object, and MIME type. The 'queries' field is a string listing the information to be retrieved from the PDF - in this case, only \"pdfa\" to perform a PDF\u002FA validation check.\u003C\u002Fp>\n\n\u003Cp>Headers are set to accept JSON responses and to include the content type generated by \u003Ccode>MultipartEncoder\u003C\u002Fcode>. An 'Api-Key' header is also included, which should be replaced with an actual API key provided by pdfRest.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>requests.post\u003C\u002Fcode> function sends the request to the specified URL with the encoded data and headers. The response is checked for success, and if successful, the JSON response is printed, formatted for readability.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps in this tutorial, you've learned how to send a multipart API request to the pdfRest API to validate conformance of a PDF\u002FA file using Python. This is particularly useful for triggering conditional processing based on the validation results.\u003C\u002Fp>\n\n\u003Cp>Feel free to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for further details and capabilities of the pdfRest API.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fpdf-info.py\">pdf-rest-api-samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-05-16T14:35:18.000+00:00","Learn how to use Query PDF API Tool by pdfRest with Python to validate whether a file conforms to PDF\u002FA specifications","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-python\u002F#article\",\n      \"headline\": \"How to Validate PDF\u002FA Conformance with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-python\u002F\",\n      \"datePublished\": \"2024-05-16T14:35:18.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:31.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use Query PDF API Tool by pdfRest with Python to validate whether a file conforms to PDF\u002FA specifications\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Query PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fquery-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fpdf-info API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fquery-pdf\"\n        }\n      ],\n      \"keywords\": \"Archival, Python, Query PDF\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Validate PDF\u002FA Conformance with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-validate-pdf-a-conformance-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11722,11723,11724,11725,11726],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1352,"name":1353,"slug":1354,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1702,"name":1703,"slug":1704,"description":1283,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":1283,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-validate-pdf-a-conformance-with-python\u002F","How to Validate PDF\u002FA Conformance with Python, Tutorial | pdfRest",{"id":11731,"uuid":11732,"title":11733,"slug":11734,"html":11735,"comment_id":11736,"feature_image":48,"featured":284,"visibility":1257,"created_at":11737,"updated_at":11738,"published_at":11737,"custom_excerpt":11739,"codeinjection_head":11740,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11741,"primary_tag":11746,"url":11747,"excerpt":11739,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11748,"meta_description":11739,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b136e","7781a723-37c5-427a-8c9d-b578c2ece78b","How to Watermark PDF in .NET with C#","how-to-watermark-pdf-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Watermark PDF with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fwatermark-pdf\u002F'>Watermark PDF API Tool\u003C\u002Fa> allows developers to easily add watermarks to PDF documents programmatically. This tutorial will demonstrate how to send an API call to the Watermark PDF endpoint using C#.\u003C\u002Fp>\n\n\u003Cp>Watermarking PDFs can be crucial in various scenarios, such as adding a company logo to business documents, marking drafts with \"CONFIDENTIAL\" text, or simply personalizing documents for branding purposes.\u003C\u002Fp>\n\n\u003Ch2>Watermark PDF with C# Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"watermarked-pdf\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"Watermarked\"));\n        multipartContent.Add(byteArrayOption, \"watermark_text\");\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source code reference: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fwatermarked-pdf.cs\">pdfRest API Samples on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the C# Code\u003C\u002Fh2>\n\n\u003Cp>The provided code snippet is a C# example of how to make a multipart\u002Fform-data POST request to the Watermark PDF endpoint of the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n\u003C\u002Fpre>\n\n\u003Cp>This initializes an instance of \u003Ccode>HttpClient\u003C\u002Fcode> with the base address set to the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>The API key is added to the request headers for authentication. Replace the placeholder with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n\u003C\u002Fpre>\n\n\u003Cp>Here, the PDF file is read into a byte array, which is then added to the multipart content with the name \"file\" and a placeholder file name.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes(\"Watermarked\"));\nmultipartContent.Add(byteArrayOption, \"watermark_text\");\n\u003C\u002Fpre>\n\n\u003Cp>The watermark text \"Watermarked\" is encoded into a byte array and added to the multipart content with the name \"watermark_text\".\u003C\u002Fp>\n\n\u003Cp>The request is then sent, and the response is read as a string. The response contains the result of the watermark operation.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following this tutorial, you've learned how to make a multipart\u002Fform-data POST request to the Watermark PDF endpoint of the pdfRest API using C#. You can now integrate this functionality into your applications to watermark PDF documents programmatically.\u003C\u002Fp>\n\n\u003Cp>Feel free to explore and demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more details on the API and its capabilities, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fwatermarked-pdf.cs\">pdfRest API Samples on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","658f2e272d4014c9499b3c7a","2023-12-29T20:37:59.000+00:00","2026-09-02T18:29:51.000+00:00","Learn how to apply a watermark image to a PDF using C# to call the Watermark PDF API Tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Watermark PDF in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-in-net-with-c\u002F\",\n      \"datePublished\": \"2023-12-29T20:37:59.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:55.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to apply a watermark image to a PDF using C# to call the Watermark PDF API Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Watermark PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fwatermark-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fwatermarked-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fwatermark-pdf\"\n        }\n      ],\n      \"keywords\": \".NET, Watermark PDF\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Watermark PDF in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11742,11743,11744,11745],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1993,"name":1994,"slug":1995,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-watermark-pdf-in-net-with-c\u002F","How to Watermark PDF in .NET with C#, Tutorial | pdfRest",{"id":11750,"uuid":11751,"title":11752,"slug":11753,"html":11754,"comment_id":11750,"feature_image":48,"featured":284,"visibility":1257,"created_at":11755,"updated_at":11738,"published_at":11755,"custom_excerpt":11756,"codeinjection_head":11757,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11758,"primary_tag":11764,"url":11765,"excerpt":11756,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11766,"meta_description":11756,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65eb8a73533c9f26b943690c","faaca1c9-a893-4ec8-b5c1-0e2b035bf591","How to Watermark PDF with cURL","how-to-watermark-pdf-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Watermark PDF with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fwatermark-pdf\u002F'>Watermark PDF API Tool\u003C\u002Fa> is a powerful utility for adding watermarks to PDF documents programmatically. This tutorial will guide you through the process of making an API call to the Watermark PDF endpoint using cURL, a versatile command-line tool used for transferring data with URLs. By mastering this technique, you can automate the process of watermarking PDFs, which is essential for protecting intellectual property or branding documents without the need for manual intervention.\u003C\u002Fp>\n\n\u003Cp>You might need to use the Watermark PDF API to batch process a collection of PDF documents by adding a company logo or confidential stamp before distributing them to clients or team members. This ensures that the documents are properly marked for their intended use or audience, which is particularly useful for legal documents, marketing materials, or any sensitive information that requires clear labeling.\u003C\u002Fp>\n\n\u003Ch2>Watermark PDF with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fwatermarked-pdf\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"watermark_text=watermark\" \\\n  -F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>Refer to the original code at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fwatermarked-pdf.sh\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>This code snippet makes a POST request to the Watermark PDF endpoint:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fwatermarked-pdf\"\u003C\u002Fpre>\n\n\u003Cp>The \u003Ccode>-X POST\u003C\u002Fcode> flag specifies that cURL should use the POST method, which is required to send data to the server.\u003C\u002Fp>\n\n\u003Cp>Headers are set to accept JSON responses and to indicate the content type:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\" \\\n-H \"Content-Type: multipart\u002Fform-data\"\n\u003C\u002Fpre>\n\n\u003Cp>The API key is sent as a header for authentication:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\u003C\u002Fpre>\n\n\u003Cp>Replace \u003Ccode>xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\u003C\u002Fcode> with your actual API key.\u003C\u002Fp>\n\n\u003Cp>The file to be watermarked is included using the \u003Ccode>-F\u003C\u002Fcode> flag, which denotes form data:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\u003C\u002Fpre>\n\n\u003Cp>Replace \u003Ccode>\u002Fpath\u002Fto\u002Ffile\u003C\u002Fcode> with the path to your PDF file.\u003C\u002Fp>\n\n\u003Cp>The watermark text is specified with another \u003Ccode>-F\u003C\u002Fcode> flag:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"watermark_text=watermark\"\u003C\u002Fpre>\n\n\u003Cp>This will add the text \"watermark\" to the PDF. Change \u003Ccode>watermark\u003C\u002Fcode> to your desired text.\u003C\u002Fp>\n\n\u003Cp>Lastly, the output parameter is used to specify the name of the resulting watermarked PDF:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\u003C\u002Fpre>\n\n\u003Cp>The resulting file will be named \u003Ccode>example_out.pdf\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following this tutorial, you've learned how to use cURL to make a multipart API call to the pdfRest Watermark PDF endpoint. This skill enables you to automate the process of adding watermarks to PDF documents, which can be a significant time-saver in many business workflows. To further explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information on the API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fwatermarked-pdf.sh\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-08T22:00:19.000+00:00","Learn how to use pdfRest Watermark PDF API Tool with cURL to apply text or image watermarks to PDFs","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-curl\u002F#article\",\n      \"headline\": \"How to Watermark PDF with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-curl\u002F\",\n      \"datePublished\": \"2024-03-08T22:00:19.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:41.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Watermark PDF API Tool with cURL to apply text or image watermarks to PDFs\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Watermark PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fwatermark-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fwatermarked-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fwatermark-pdf\"\n        }\n      ],\n      \"keywords\": \"Security, Watermark PDF, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Watermark PDF with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11759,11760,11761,11762,11763],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1993,"name":1994,"slug":1995,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-watermark-pdf-with-curl\u002F","How to Watermark PDF with cURL, Tutorial | pdfRest",{"id":11768,"uuid":11769,"title":11770,"slug":11771,"html":11772,"comment_id":11768,"feature_image":48,"featured":284,"visibility":1257,"created_at":11773,"updated_at":11774,"published_at":11773,"custom_excerpt":11775,"codeinjection_head":11776,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11777,"primary_tag":11783,"url":11784,"excerpt":11775,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11785,"meta_description":11775,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65eb8b09533c9f26b9436924","616b2b76-84de-402f-a9e3-ec98cebdf0c0","How to Watermark PDF with Java","how-to-watermark-pdf-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Watermark PDF with Java?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fwatermark-pdf\u002F'>Watermark PDF API Tool\u003C\u002Fa> is a powerful resource for developers looking to add watermarks to PDF documents programmatically. This tutorial will demonstrate how to make an API call to the Watermark PDF endpoint using Java, a popular programming language known for its robustness and portability. By integrating this API, Java developers can easily automate the process of watermarking PDFs within their applications or workflows.\u003C\u002Fp>\n\n\u003Cp>Imagine a scenario where a company needs to distribute confidential documents to its employees or partners. To protect the information and assert ownership, the company decides to add a watermark before sending out the documents. Using the Watermark PDF API, the company can quickly apply custom watermarks to all their PDFs, ensuring that each document is marked appropriately and consistently, without the need for manual editing.\u003C\u002Fp>\n\n\u003Ch2>Watermark PDF with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class WatermarkedPDF {\n\n  \u002F\u002F Specify the path to your file here, or as the first argument when running the program.\n  private static final String DEFAULT_FILE_PATH = \"\u002Fpath\u002Fto\u002Ffile.pdf\";\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    File inputFile;\n    if (args.length > 0) {\n      inputFile = new File(args[0]);\n    } else {\n      inputFile = new File(DEFAULT_FILE_PATH);\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    final RequestBody inputFileRequestBody =\n        RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n    RequestBody requestBody =\n        new MultipartBody.Builder()\n            .setType(MultipartBody.FORM)\n            .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n            .addFormDataPart(\"watermark_text\", \"WATERMARK\")\n            .addFormDataPart(\"output\", \"pdfrest_watermarked\")\n            .build();\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fwatermarked-pdf\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client =\n          new OkHttpClient().newBuilder().readTimeout(60, TimeUnit.SECONDS).build();\n\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source of the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FWatermarkedPDF.java\">WatermarkedPDF.java on GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code provided is a Java program that makes an API call to the pdfRest Watermark PDF endpoint. Let's break down the key components of this code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\u003C\u002Fpre>\n\n\u003Cp>This snippet initializes the \u003Ccode>Dotenv\u003C\u002Fcode> library, which is used to load environment variables from a \u003Ccode>.env\u003C\u002Fcode> file. This is useful for keeping sensitive information, like API keys, out of the source code.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n\u003C\u002Fpre>\n\n\u003Cp>This line creates a request body for the file that will be watermarked. The media type is set to \u003Ccode>application\u002Fpdf\u003C\u002Fcode>, indicating that the file is a PDF.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">new MultipartBody.Builder()\n    .setType(MultipartBody.FORM)\n    .addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody)\n    .addFormDataPart(\"watermark_text\", \"WATERMARK\")\n    .addFormDataPart(\"output\", \"pdfrest_watermarked\")\n    .build();\n\u003C\u002Fpre>\n\n\u003Cp>This snippet constructs a multipart request body with three parts: the PDF file to be watermarked, the watermark text, and the desired output filename. The \u003Ccode>watermark_text\u003C\u002Fcode> is the text that will appear as a watermark on the PDF, and \u003Ccode>output\u003C\u002Fcode> specifies the name of the watermarked PDF file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">new Request.Builder()\n    .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n    .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fwatermarked-pdf\")\n    .post(requestBody)\n    .build();\n\u003C\u002Fpre>\n\n\u003Cp>This code creates an HTTP POST request with the API key set in the header. The URL points to the Watermark PDF endpoint. The request body contains the multipart data prepared earlier.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">Response response = client.newCall(request).execute();\n\u003C\u002Fpre>\n\n\u003Cp>This line sends the request to the server and waits for the response. The \u003Ccode>OkHttpClient\u003C\u002Fcode> is configured with a 60-second read timeout.\u003C\u002Fp>\n\n\u003Cpre class=\"language-java\">System.out.println(prettyJson(response.body().string()));\n\u003C\u002Fpre>\n\n\u003Cp>The response body is printed to the console in a pretty-printed JSON format, making it easier to read.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following this tutorial, you've learned how to make a multipart API call to the pdfRest Watermark PDF endpoint using Java. This allows you to programmatically add watermarks to PDF documents, which can be particularly useful for branding, securing, or labeling documents in automated processes.\u003C\u002Fp>\n\n\u003Cp>Explore and demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information about the API and its capabilities, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. For code samples using JSON payloads, you can find them at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FWatermarkedPDF.java\">JSON Payload WatermarkedPDF.java on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-08T22:02:49.000+00:00","2026-09-02T18:29:52.000+00:00","Learn how to apply text or image watermarks to PDFs with the Watermark PDF API Tool by pdfRest using Java","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-java\u002F#article\",\n      \"headline\": \"How to Watermark PDF with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-java\u002F\",\n      \"datePublished\": \"2024-03-08T22:02:49.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:41.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to apply text or image watermarks to PDFs with the Watermark PDF API Tool by pdfRest using Java\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Watermark PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fwatermark-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fwatermarked-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fwatermark-pdf\"\n        }\n      ],\n      \"keywords\": \"Java, Security, Watermark PDF\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Watermark PDF with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11778,11779,11780,11781,11782],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1993,"name":1994,"slug":1995,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":1989,"name":1990,"slug":1991,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-watermark-pdf-with-java\u002F","How to Watermark PDF with Java, Tutorial | pdfRest",{"id":11787,"uuid":11788,"title":11789,"slug":11790,"html":11791,"comment_id":11792,"feature_image":48,"featured":284,"visibility":1257,"created_at":11793,"updated_at":11774,"published_at":11793,"custom_excerpt":11794,"codeinjection_head":11795,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11796,"primary_tag":11801,"url":11802,"excerpt":11794,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11803,"meta_description":11794,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b136f","4d6fbf95-5786-44e6-9723-be539dfea77d","How to Watermark PDF with JavaScript in NodeJS","how-to-watermark-pdf-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Watermark PDF with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fwatermark-pdf\u002F'>Watermark PDF API Tool\u003C\u002Fa> is a powerful resource for adding watermarks to PDF documents programmatically. This tutorial will guide you through the process of sending an API call to Watermark PDF using JavaScript.\u003C\u002Fp>\n\n\u003Cp>A common use case for watermarking PDFs is to protect intellectual property or to mark documents as confidential, draft, or for review. For instance, a company might watermark a business proposal with the word \"DRAFT\" before it's finalized, or a photographer might watermark their portfolio to prevent unauthorized use of their images.\u003C\u002Fp>\n\n\u003Ch2>Watermark PDF with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F**\n * This request demonstrates how to apply a text watermark to a PDF.\n * Horizontal and vertical offsets of the watermark are measured in PDF units. (1 inch = 72 PDF units)\n *\u002F\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the PDF file and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('watermark_text', 'Hello, watermarked world!');\ndata.append('font', 'Arial');\ndata.append('text_size', '72');\ndata.append('text_color_rgb', '255,0,0');\ndata.append('opacity', '0.5');\ndata.append('x', '0');\ndata.append('y', '0');\ndata.append('rotation', '0');\ndata.append('output', 'pdfrest_watermarked_pdf');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\n  maxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fwatermarked-pdf', \n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fwatermarked-pdf.js\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the JavaScript Code\u003C\u002Fh2>\n\n\u003Cp>The provided code block uses the Axios library to perform an HTTP POST request, sending a multipart form-data payload to the pdfRest API to watermark a PDF. Here's a breakdown of the key parts:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\u003C\u002Fpre>\n\n\u003Cp>This initializes the required modules: Axios for making HTTP requests, FormData to construct the multipart form-data payload, and fs to interact with the file system.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\n\u003C\u002Fpre>\n\n\u003Cp>A new FormData instance is created, and the PDF file is appended as a stream. Replace '\u002Fpath\u002Fto\u002Ffile' with the actual file path.\u003C\u002Fp>\n\n\u003Cp>The other \u003Ccode>data.append\u003C\u002Fcode> lines add parameters for the watermark, such as the text, font, size, color, opacity, position, rotation, and output filename. Each parameter customizes the watermark according to your needs.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fwatermarked-pdf',\n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\n\u003C\u002Fpre>\n\n\u003Cp>The configuration object for Axios includes the request method, URL, headers (including the API key), and the data payload. Replace 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error); \n});\n\u003C\u002Fpre>\n\n\u003Cp>The Axios library sends the request and handles the response or error. The response data is logged to the console.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've demonstrated how to watermark a PDF using JavaScript and the pdfRest Watermark PDF API Tool. By following the steps outlined, you can apply a custom watermark to your PDF documents programmatically. To explore more features and capabilities, you can demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fwatermarked-pdf.js\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","658f2eaf2d4014c9499b3c84","2023-12-29T20:40:15.000+00:00","Learn how to apply an watermarked image in a PDF using JavaScript to call the Watermark PDF API Tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Watermark PDF with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2023-12-29T20:40:15.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:55.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to apply an watermarked image in a PDF using JavaScript to call the Watermark PDF API Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Watermark PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fwatermark-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fwatermarked-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fwatermark-pdf\"\n        }\n      ],\n      \"keywords\": \"JavaScript, Watermark PDF\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Watermark PDF with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11797,11798,11799,11800],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1993,"name":1994,"slug":1995,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-watermark-pdf-with-javascript-in-nodejs\u002F","How to Watermark a PDF with JavaScript in NodeJS, Tutorial | pdfRest",{"id":11805,"uuid":11806,"title":11807,"slug":11808,"html":11809,"comment_id":11810,"feature_image":48,"featured":284,"visibility":1257,"created_at":11811,"updated_at":11774,"published_at":11811,"custom_excerpt":11812,"codeinjection_head":11813,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11814,"primary_tag":11819,"url":11820,"excerpt":11812,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11821,"meta_description":11812,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b136d","1bae5837-f223-4385-adb8-ae8a79caf19a","How to Watermark PDF with PHP","how-to-watermark-pdf-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Watermark PDF with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fwatermark-pdf\u002F'>Watermark PDF API Tool\u003C\u002Fa> allows developers to easily add watermarks to PDF documents programmatically. This tutorial will guide you through making an API call to the Watermark PDF endpoint using PHP.\u003C\u002Fp> \n\n\u003Cp>Watermarking PDFs can be crucial for branding, protecting copyright, or indicating the status of a document. For instance, a legal firm might watermark drafts as \"Confidential\" before sharing them with clients.\u003C\u002Fp>\n\n\u003Ch2>Watermark PDF with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">\nrequire 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile',\n      'headers' => [\n        'Content-Type' => '\u003CContent-type header>'\n      ]\n    ],\n    [\n      'name' => 'watermark_text',\n      'contents' => 'TEXT'\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_watermarked_pdf'\n    ]\n  ]\n];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fwatermarked-pdf', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\u003C\u002Fpre>\n\n\u003Cp>Source of the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fwatermarked-pdf.php\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the PHP Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by loading required dependencies using Composer's autoload feature. It then imports the necessary classes from the GuzzleHttp library.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">require 'vendor\u002Fautoload.php';\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\u003C\u002Fpre>\n\n\u003Cp>An instance of the Guzzle HTTP client is created, and the API key is set in the headers for authentication.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$client = new Client();\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n\u003C\u002Fpre>\n\n\u003Cp>The options array is constructed with the 'multipart' key containing the file, watermark text, and output options.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$options = [\n  'multipart' => [\n    \u002F\u002F ... file and watermark_text details ...\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_watermarked_pdf'\n    ]\n  ]\n];\n\u003C\u002Fpre>\n\n\u003Cp>Each field in the multipart form data is detailed, with 'name' being the field name, 'contents' being the value or file stream, and 'headers' for any additional headers needed for the file part.\u003C\u002Fp>\n\n\u003Cp>A POST request is then created with the specified endpoint and headers, and the request is sent asynchronously. The response is waited on and the body of the response, which should be the watermarked PDF, is echoed out.\u003C\u002Fp>\n\n\u003Cpre class=\"language-php\">$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fwatermarked-pdf', $headers);\n$res = $client->sendAsync($request, $options)->wait();\necho $res->getBody();\n\u003C\u002Fpre>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial demonstrated how to call the pdfRest Watermark PDF API using PHP to watermark a PDF document. The code example provided shows how to construct and send a multipart\u002Fform-data request using the Guzzle HTTP client.\u003C\u002Fp>\n\n\u003Cp>To further explore the capabilities of pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information about the API endpoints and available options, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fwatermarked-pdf.php\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","658f2dca2d4014c9499b3c70","2023-12-29T20:36:26.000+00:00","Learn how to apply a watermark image to a PDF using PHP to call the Watermark PDF API Tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-php\u002F#article\",\n      \"headline\": \"How to Watermark PDF with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-php\u002F\",\n      \"datePublished\": \"2023-12-29T20:36:26.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:55.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to apply a watermark image to a PDF using PHP to call the Watermark PDF API Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Watermark PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fwatermark-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fwatermarked-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fwatermark-pdf\"\n        }\n      ],\n      \"keywords\": \"PHP, Watermark PDF\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Watermark PDF with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11815,11816,11817,11818],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1993,"name":1994,"slug":1995,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-watermark-pdf-with-php\u002F","How to Watermark a PDF with PHP, Tutorial | pdfRest",{"id":11823,"uuid":11824,"title":11825,"slug":11826,"html":11827,"comment_id":11828,"feature_image":48,"featured":284,"visibility":1257,"created_at":11829,"updated_at":11830,"published_at":11829,"custom_excerpt":11831,"codeinjection_head":11832,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11833,"primary_tag":11838,"url":11839,"excerpt":11831,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11840,"meta_description":11831,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65ae9a86656af204db4b1357","dcba2b4a-731b-4855-8c70-b8a08ae8541e","How to Watermark PDF with Python","how-to-watermark-pdf-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Watermark PDF with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fwatermark-pdf\u002F'>Watermark PDF API Tool\u003C\u002Fa> is a powerful resource that allows users to add watermarks to PDF documents programmatically. This tutorial will guide you through the process of making an API call to the Watermark PDF endpoint using Python.\u003C\u002Fp>\n\u003Cp>This functionality is particularly useful for businesses or individuals who need to protect their documents or brand them with a company logo or text before distribution.\u003C\u002Fp>\n\n\u003Ch2>Watermark PDF with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nwatermarked_pdf_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fwatermarked-pdf'\n\nmp_encoder_watermarkedPDF = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'watermark_text': 'watermark',\n        'output' : 'example_out'\n    }\n)\n\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_watermarkedPDF.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to watermarked-pdf endpoint...\")\nresponse = requests.post(watermarked_pdf_endpoint_url, data=mp_encoder_watermarkedPDF, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\u003C\u002Fpre>\n\n\u003Cp>This code is sourced from the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fwatermarked-pdf.py\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided Python code performs the following steps to call the pdfRest Watermark PDF API:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\u003C\u002Fpre>\n\n\u003Cp>This section imports the necessary libraries. \u003Ccode>requests_toolbelt\u003C\u002Fcode> is used for creating a multipart encoder object, \u003Ccode>requests\u003C\u002Fcode> for making HTTP requests, and \u003Ccode>json\u003C\u002Fcode> for handling JSON data.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_watermarkedPDF = MultipartEncoder(\n    fields={\n        'file': ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n        'watermark_text': 'watermark',\n        'output' : 'example_out'\n    }\n)\u003C\u002Fpre>\n\n\u003Cp>Here, a \u003Ccode>MultipartEncoder\u003C\u002Fcode> object is created with the PDF file to be watermarked, the text of the watermark, and the desired output filename.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_watermarkedPDF.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n}\u003C\u002Fpre>\n\n\u003Cp>The headers for the API request are set, including the API key which you need to replace with your own.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(watermarked_pdf_endpoint_url, data=mp_encoder_watermarkedPDF, headers=headers)\u003C\u002Fpre>\n\n\u003Cp>An HTTP POST request is sent to the pdfRest API endpoint with the multipart data and headers.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">if response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\u003C\u002Fpre>\n\n\u003Cp>The response is checked for success (status code 200). If successful, the response is printed in a JSON formatted string; otherwise, the error text is printed.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps outlined in this tutorial, you have learned how to use Python to send an API call to the pdfRest Watermark PDF endpoint. This allows you to add watermarks to your PDF documents with ease. You are encouraged to demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference documentation \u003C\u002Fa> for more details.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fwatermarked-pdf.py\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","658216f12d4014c9499b3a16","2023-12-19T22:19:29.000+00:00","2026-09-02T18:29:53.000+00:00","Learn how to apply image watermarks to a PDF using Python to call the Watermark PDF API Tool from pdfRest.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-python\u002F#article\",\n      \"headline\": \"How to Watermark PDF with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-python\u002F\",\n      \"datePublished\": \"2023-12-19T22:19:29.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:59.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to apply image watermarks to a PDF using Python to call the Watermark PDF API Tool from pdfRest.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Watermark PDF API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fwatermark-pdf\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fwatermarked-pdf API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fwatermark-pdf\"\n        }\n      ],\n      \"keywords\": \"Python, Watermark PDF\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Watermark PDF with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-watermark-pdf-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11834,11835,11836,11837],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1993,"name":1994,"slug":1995,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-watermark-pdf-with-python\u002F","How to Watermark PDF with Python, Tutorial | pdfRest",{"id":11842,"uuid":11843,"title":11844,"slug":11845,"html":11846,"comment_id":11842,"feature_image":48,"featured":284,"visibility":1257,"created_at":11847,"updated_at":11830,"published_at":11847,"custom_excerpt":11848,"codeinjection_head":11849,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11850,"primary_tag":11855,"url":11856,"excerpt":11848,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11857,"meta_description":11848,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65f7b777533c9f26b9436b0c","2324a5a4-6e38-4be7-8e3d-44c2764be252","How to Zip Files in .NET with C#","how-to-zip-files-in-net-with-c","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Zip Files with C#?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fzip-files\u002F'>Zip Files API Tool\u003C\u002Fa> offers a convenient way to programmatically zip multiple files together. This tutorial will demonstrate how to send an API call to the Zip Files endpoint using C# to leverage this functionality.\u003C\u002Fp> \n  \n\u003Cp>The ability to zip files through an API call is particularly useful when dealing with multiple documents that need to be compressed into a single package, making them easier to manage, store, or transmit.\u003C\u002Fp>\n\n\u003Cp>In the real world, a user might need to zip files to reduce the overall file size for storage efficiency or to ensure faster transmission over the internet. For instance, a business could use this functionality to bundle various reports and documents into a single, compressed file before sending it to a client, thus saving bandwidth and improving the client's experience by simplifying the number of downloads they must manage.\u003C\u002Fp>\n\n\u003Ch2>Zip Files with C# Code Example\u003C\u002Fh2>\n\n\u003Cp>The following code is a complete example of making an API call to the Zip Files endpoint using C#. The code is sourced from the pdfRest API samples available on GitHub: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fzip.cs\">pdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">using System.Text;\n\nusing (var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") })\n{\n    using (var request = new HttpRequestMessage(HttpMethod.Post, \"zip\"))\n    {\n        request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n        request.Headers.Accept.Add(new(\"application\u002Fjson\"));\n        var multipartContent = new MultipartFormDataContent();\n\n        var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\n        var byteAryContent = new ByteArrayContent(byteArray);\n        multipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\n        byteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        var byteArray2 = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\n        var byteAryContent2 = new ByteArrayContent(byteArray2);\n        multipartContent.Add(byteAryContent2, \"file\", \"file_name.pdf\");\n        byteAryContent2.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\n        request.Content = multipartContent;\n        var response = await httpClient.SendAsync(request);\n\n        var apiResult = await response.Content.ReadAsStringAsync();\n\n        Console.WriteLine(\"API response received.\");\n        Console.WriteLine(apiResult);\n    }\n}\n\u003C\u002Fpre>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code above illustrates how to create a multipart\u002Fform-data request to zip files using the pdfRest API. Let's break down the key components:\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var httpClient = new HttpClient { BaseAddress = new Uri(\"https:\u002F\u002Fapi.pdfrest.com\") }\n\u003C\u002Fpre>\n\n\u003Cp>This line initializes a new \u003Ccode>HttpClient\u003C\u002Fcode> instance with the base address set to the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">request.Headers.TryAddWithoutValidation(\"Api-Key\", \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\");\n\u003C\u002Fpre>\n\n\u003Cp>This line adds your API key to the request headers. Replace \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" with your actual pdfRest API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var multipartContent = new MultipartFormDataContent();\n\u003C\u002Fpre>\n\n\u003Cp>A \u003Ccode>MultipartFormDataContent\u003C\u002Fcode> object is created to hold the files that will be zipped together.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var byteArray = File.ReadAllBytes(\"\u002Fpath\u002Fto\u002Ffile.pdf\");\nvar byteAryContent = new ByteArrayContent(byteArray);\nmultipartContent.Add(byteAryContent, \"file\", \"file_name.pdf\");\nbyteAryContent.Headers.TryAddWithoutValidation(\"Content-Type\", \"application\u002Fpdf\");\n\u003C\u002Fpre>\n\n\u003Cp>These lines read the contents of a file into a byte array, wrap it in a \u003Ccode>ByteArrayContent\u003C\u002Fcode> object, and add it to the multipart content. The \"file_name\" should be replaced with the actual name of the file. The \u003Ccode>Content-Type\u003C\u002Fcode> header is set to \"application\u002Fpdf\" as this example assumes PDF files are being zipped.\n\nRepeat this code for each file that you wish to add to the Zip file.\n\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var response = await httpClient.SendAsync(request);\n\u003C\u002Fpre>\n\n\u003Cp>This line sends the multipart request asynchronously and waits for the response.\u003C\u002Fp>\n\n\u003Cpre class=\"language-csharp\">var apiResult = await response.Content.ReadAsStringAsync();\n\u003C\u002Fpre>\n\n\u003Cp>Finally, the response content is read as a string, which contains the API result.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following this tutorial, you've learned how to make a multipart API call to the pdfRest Zip Files endpoint using C#. This allows you to programmatically compress multiple files into a single zip archive. You're encouraged to explore and demo all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa> and refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa> for further details on other API functionalities.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads for other endpoints can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FDotNET\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fzip.cs\">pdf-rest-api-samples\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-18T03:39:35.000+00:00","Learn how to use pdfRest Zip Files API Tool with .NET to zip processed files for easy downloads.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-in-net-with-c\u002F#article\",\n      \"headline\": \"How to Zip Files in .NET with C#\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-in-net-with-c\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-in-net-with-c\u002F\",\n      \"datePublished\": \"2024-03-18T03:39:35.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:38.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Zip Files API Tool with .NET to zip processed files for easy downloads.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Zip Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fzip-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fzip API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fzip-files\"\n        }\n      ],\n      \"keywords\": \".NET, Zip Files\",\n      \"dependencies\": \".NET, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Zip Files in .NET with C#\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-in-net-with-c\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11851,11852,11853,11854],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1915,"name":1916,"slug":1917,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2231,"name":2232,"slug":2233,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-zip-files-in-net-with-c\u002F","How to Zip Files in .NET with C#, Tutorial | pdfRest",{"id":11859,"uuid":11860,"title":11861,"slug":11862,"html":11863,"comment_id":11859,"feature_image":48,"featured":284,"visibility":1257,"created_at":11864,"updated_at":11865,"published_at":11864,"custom_excerpt":11866,"codeinjection_head":11867,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11868,"primary_tag":11873,"url":11874,"excerpt":11866,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11875,"meta_description":11866,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"673ecf88533c9f26b943904f","fa9bf451-a290-4bb6-a89f-acc59c86b5ec","How to Zip Files with cURL","how-to-zip-files-with-curl","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Zip Files with cURL?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fzip-files\u002F'>Zip Files API Tool\u003C\u002Fa> provides a convenient way to compress multiple files into a single ZIP archive using a simple API call. This tutorial will guide you through the process of sending an API call to zip files using cURL, a command-line tool for transferring data with URLs. By leveraging this tool, you can automate the process of zipping files directly from your applications or scripts, saving time and effort.\u003C\u002Fp>\n\n\u003Cp>In a real-world scenario, a user might need to zip files to facilitate easier sharing or storage. For instance, a company might want to compress multiple reports or documents into a single ZIP file to send to a client or archive for future reference. Using the pdfRest Zip Files API Tool simplifies this task by handling the compression on the server side, allowing the user to focus on other tasks.\u003C\u002Fp>\n\n\u003Ch2>Zip Files with cURL Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-bash\">curl -X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fzip\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  -H \"Content-Type: multipart\u002Fform-data\" \\\n  -H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"file=@\u002Fpath\u002Fto\u002Ffile\" \\\n  -F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fzip.sh\">GitHub - pdf-rest-api-samples\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code snippet above demonstrates how to use cURL to make a POST request to the pdfRest Zip Files API endpoint. Let's break down each component of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-X POST \"https:\u002F\u002Fapi.pdfrest.com\u002Fzip\"\n\u003C\u002Fpre>\n\n\u003Cp>This line specifies the HTTP method (POST) and the URL of the API endpoint you are targeting. Here, it is the zip endpoint of the pdfRest API.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Accept: application\u002Fjson\"\n\u003C\u002Fpre>\n\n\u003Cp>This header tells the server that the client expects a JSON response. JSON is a lightweight data interchange format that is easy to read and write for humans and machines alike.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Content-Type: multipart\u002Fform-data\"\n\u003C\u002Fpre>\n\n\u003Cp>The Content-Type header specifies that the request body is in the form of multipart\u002Fform-data. This is necessary when uploading files, as it allows multiple files to be included in the request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-H \"Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n\u003C\u002Fpre>\n\n\u003Cp>This line includes the API key required to authenticate the request. Replace the placeholder with your actual API key. The API key ensures that the request is authorized to use the pdfRest services.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"file=@\u002Fpath\u002Fto\u002Ffile\"\n\u003C\u002Fpre>\n\n\u003Cp>The -F flag is used to specify form data. In this case, it is used to upload files to the server. You can include multiple -F flags to upload multiple files, as shown in the example.\u003C\u002Fp>\n\n\u003Cpre class=\"language-bash\">-F \"output=example_out\"\n\u003C\u002Fpre>\n\n\u003Cp>This specifies the desired name for the output ZIP file. The server will return a ZIP file named according to the value provided here.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, you learned how to use cURL to send a request to the pdfRest Zip Files API endpoint to compress multiple files into a single ZIP archive. This process can be particularly useful for streamlining file management tasks in various applications.\u003C\u002Fp>\n\n\u003Cp>To explore more capabilities of the pdfRest API, you can demo all the available tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information on all the endpoints and their parameters, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This example demonstrates a multipart API call. For code samples using JSON payloads, visit the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FcURL\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fzip.sh\">GitHub repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-21T06:13:28.000+00:00","2026-09-02T18:29:54.000+00:00","Learn how to use the pdfRest Zip Files API Tool to compress files into a Zip archive with cURL","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-curl\u002F#article\",\n      \"headline\": \"How to Zip Files with cURL\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-curl\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-curl\u002F\",\n      \"datePublished\": \"2024-11-21T06:13:28.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:20.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use the pdfRest Zip Files API Tool to compress files into a Zip archive with cURL\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Zip Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fzip-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fzip API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fzip-files\"\n        }\n      ],\n      \"keywords\": \"Zip Files, cURL\",\n      \"dependencies\": \"cURL, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Zip Files with cURL\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-curl\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11869,11870,11871,11872],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1915,"name":1916,"slug":1917,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2239,"name":2240,"slug":2241,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-zip-files-with-curl\u002F","How to Zip Files with cURL, Tutorial | pdfRest",{"id":11877,"uuid":11878,"title":11879,"slug":11880,"html":11881,"comment_id":11877,"feature_image":48,"featured":284,"visibility":1257,"created_at":11882,"updated_at":11865,"published_at":11882,"custom_excerpt":11883,"codeinjection_head":11884,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11885,"primary_tag":11890,"url":11891,"excerpt":11883,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11892,"meta_description":11883,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"673ecebc533c9f26b9439041","d312d162-037d-4d46-b18a-49ca2460b7ed","How to Zip Files with Java","how-to-zip-files-with-java","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Zip Files with Java?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fzip-files\u002F'>Zip Files API Tool\u003C\u002Fa> provides a convenient and efficient way to compress multiple files into a single ZIP archive using Java. This tutorial will guide you through the process of sending an API call to zip files using Java, leveraging the capabilities of the pdfRest API to streamline file management tasks.\u003C\u002Fp>\n\n\u003Cp>In real-world scenarios, users might need to compress multiple documents into a single ZIP file for easier storage or sharing. For instance, a business might need to send a collection of PDF reports to a client. By zipping these files, the business can reduce the file size and simplify the transfer process, ensuring that all necessary documents are delivered together.\u003C\u002Fp>\n\n\u003Ch2>Zip Files with Java Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-java\">import io.github.cdimascio.dotenv.Dotenv;\nimport java.io.File;\nimport java.io.IOException;\nimport okhttp3.*;\nimport org.json.JSONObject;\n\npublic class Zip {\n\n  \u002F\u002F Specify the paths to your file here, or as the arguments when running the program.\n  private static final String[] DEFAULT_FILE_PATHS =\n      new String[] {\"\u002Fpath\u002Fto\u002Ffile1.pdf\", \"\u002Fpath\u002Fto\u002Ffile2.pdf\"};\n\n  \u002F\u002F Specify your API key here, or in the environment variable PDFREST_API_KEY.\n  \u002F\u002F You can also put the environment variable in a .env file.\n  private static final String DEFAULT_API_KEY = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\n  public static void main(String[] args) {\n    String[] inputFilePaths;\n    if (args.length > 0) {\n      inputFilePaths = args;\n    } else {\n      inputFilePaths = DEFAULT_FILE_PATHS;\n    }\n\n    final Dotenv dotenv = Dotenv.configure().ignoreIfMalformed().ignoreIfMissing().load();\n\n    MultipartBody.Builder bodyBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM);\n\n    for (String inputFilePath : inputFilePaths) {\n      final File inputFile = new File(inputFilePath);\n      final RequestBody inputFileRequestBody =\n          RequestBody.create(inputFile, MediaType.parse(\"application\u002Fpdf\"));\n      bodyBuilder.addFormDataPart(\"file\", inputFile.getName(), inputFileRequestBody);\n    }\n\n    RequestBody requestBody = bodyBuilder.addFormDataPart(\"output\", \"pdfrest_zip\").build();\n\n    Request request =\n        new Request.Builder()\n            .header(\"Api-Key\", dotenv.get(\"PDFREST_API_KEY\", DEFAULT_API_KEY))\n            .url(\"https:\u002F\u002Fapi.pdfrest.com\u002Fzip\")\n            .post(requestBody)\n            .build();\n    try {\n      OkHttpClient client = new OkHttpClient().newBuilder().build();\n      Response response = client.newCall(request).execute();\n      System.out.println(\"Result code \" + response.code());\n      if (response.body() != null) {\n        System.out.println(prettyJson(response.body().string()));\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  private static String prettyJson(String json) {\n    \u002F\u002F https:\u002F\u002Fstackoverflow.com\u002Fa\u002F9583835\u002F11996393\n    return new JSONObject(json).toString(4);\n  }\n}\n\u003C\u002Fpre>\n\n\u003Cp>Source: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002FZip.java\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code begins by importing necessary libraries, including OkHttp for HTTP requests and Dotenv for environment variable management. The \u003Ccode>DEFAULT_FILE_PATHS\u003C\u002Fcode> array specifies the file paths to be zipped, and \u003Ccode>DEFAULT_API_KEY\u003C\u002Fcode> holds the API key, which can also be set via environment variables.\u003C\u002Fp>\n\n\u003Cp>The \u003Ccode>main\u003C\u002Fcode> method checks if file paths are provided as arguments; otherwise, it uses the default paths. It then loads environment variables using Dotenv. A \u003Ccode>MultipartBody.Builder\u003C\u002Fcode> is initialized to construct the request body, specifying the type as \u003Ccode>MultipartBody.FORM\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cp>For each file path, a \u003Ccode>File\u003C\u002Fcode> object is created, and a \u003Ccode>RequestBody\u003C\u002Fcode> is built with the file's content type set to \u003Ccode>application\u002Fpdf\u003C\u002Fcode>. These are added to the form data part of the request body using \u003Ccode>addFormDataPart\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cp>The request body is completed by adding an \u003Ccode>output\u003C\u002Fcode> form data part with the value \u003Ccode>pdfrest_zip\u003C\u002Fcode>. A \u003Ccode>Request\u003C\u002Fcode> object is then created, setting the \u003Ccode>Api-Key\u003C\u002Fcode> header and specifying the URL \u003Ccode>https:\u002F\u002Fapi.pdfrest.com\u002Fzip\u003C\u002Fcode> for the POST request.\u003C\u002Fp>\n\n\u003Cp>An \u003Ccode>OkHttpClient\u003C\u002Fcode> executes the request, and the response is printed. The \u003Ccode>prettyJson\u003C\u002Fcode> method formats the JSON response for readability.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial demonstrated how to use Java to send an API call to compress files using the pdfRest Zip Files API Tool. By following these steps, you can efficiently manage and share multiple files in a compressed format.\u003C\u002Fp>\n\n\u003Cp>To explore more functionalities, try out all the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For detailed information, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads can be found \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJava\u002FEndpoint%20Examples\u002FJSON%20Payload\u002FZip.java\">here\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-11-21T06:10:04.000+00:00","Learn how to compress files into a Zip archive using the pdfRest Zip Files API Tool with Java","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-java\u002F#article\",\n      \"headline\": \"How to Zip Files with Java\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-java\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-java\u002F\",\n      \"datePublished\": \"2024-11-21T06:10:04.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:20.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to compress files into a Zip archive using the pdfRest Zip Files API Tool with Java\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Zip Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fzip-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fzip API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fzip-files\"\n        }\n      ],\n      \"keywords\": \"Java, Zip Files\",\n      \"dependencies\": \"Java, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Zip Files with Java\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-java\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11886,11887,11888,11889],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1915,"name":1916,"slug":1917,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2235,"name":2236,"slug":2237,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-zip-files-with-java\u002F","How to Zip Files with Java, Tutorial | pdfRest",{"id":11894,"uuid":11895,"title":11896,"slug":11897,"html":11898,"comment_id":11894,"feature_image":48,"featured":284,"visibility":1257,"created_at":11899,"updated_at":11865,"published_at":11899,"custom_excerpt":11900,"codeinjection_head":11901,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11902,"primary_tag":11907,"url":11908,"excerpt":11900,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11909,"meta_description":11900,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65f7b80a533c9f26b9436b18","3d8b7f23-4e97-478a-a2b2-7ca02347d925","How to Zip Files with JavaScript in NodeJS","how-to-zip-files-with-javascript-in-nodejs","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Zip Files with JavaScript?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fzip-files\u002F'>Zip Files API Tool\u003C\u002Fa> is a powerful resource for developers looking to compress multiple files into a single ZIP archive through an API call.\u003C\u002Fp> \n  \n\u003Cp>This tutorial will demonstrate how to use JavaScript to send an API call to the Zip Files endpoint provided by pdfRest, specifically targeting the use case of compressing files programmatically.\u003C\u002Fp>\n\n\u003Cp>In the real world, a user might need to zip files to reduce the overall file size for storage or to simplify the process of downloading multiple files by consolidating them into a single download. For instance, a web application could allow users to select multiple documents and download them as one ZIP file, or a server-side script might automatically archive a batch of reports at the end of each day.\u003C\u002Fp>\n\n\u003Ch2>Zip Files with JavaScript Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-javascript\">\u002F**\n * This request demonstrates how to compress files into one ZIP file.\n * To accommodate additional files, add additional file and\u002For id[] form-data body parameters.\n *\u002F\nvar axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\n\u002F\u002F Create a new form data instance and append the files and parameters to it\nvar data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('output', 'pdfrest_zip');\n\n\u002F\u002F define configuration options for axios request\nvar config = {\n  method: 'post',\nmaxBodyLength: Infinity, \u002F\u002F set maximum length of the request body\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fzip',\n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', \u002F\u002F Replace with your API key\n    ...data.getHeaders() \u002F\u002F set headers for the request\n  },\n  data : data \u002F\u002F set the data to be sent with the request\n};\n\n\u002F\u002F send request and handle response or error\naxios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error);\n});\n\n\u002F\u002F If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample.\n\u003C\u002Fpre>\n\n\u003Cp>This code is sourced from the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fzip.js\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code uses the Axios library to send HTTP requests and the FormData library to construct multipart\u002Fform-data payloads. Here's a breakdown of the key parts:\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var axios = require('axios');\nvar FormData = require('form-data');\nvar fs = require('fs');\n\u003C\u002Fpre>\n\n\u003Cp>This initializes the required modules: Axios for making the HTTP call, FormData to build the form data, and fs (File System) to read files from the system.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var data = new FormData();\ndata.append('file', fs.createReadStream('\u002Fpath\u002Fto\u002Ffile'));\ndata.append('output', 'pdfrest_zip');\n\u003C\u002Fpre>\n\n\u003Cp>Here, a new FormData instance is created, and files are appended to it. The 'file' fields are the files to be zipped, and 'output' is the desired name of the resulting ZIP file.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">var config = {\n  method: 'post',\n  maxBodyLength: Infinity,\n  url: 'https:\u002F\u002Fapi.pdfrest.com\u002Fzip',\n  headers: { \n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n    ...data.getHeaders()\n  },\n  data : data\n};\n\u003C\u002Fpre>\n\n\u003Cp>The config object contains the Axios request configuration. The 'Api-Key' header should be replaced with your actual API key. The 'maxBodyLength' property is set to Infinity to allow for large file sizes.\u003C\u002Fp>\n\n\u003Cpre class=\"language-javascript\">axios(config)\n.then(function (response) {\n  console.log(JSON.stringify(response.data));\n})\n.catch(function (error) {\n  console.log(error);\n});\n\u003C\u002Fpre>\n\n\u003Cp>The Axios instance is called with the config object, and the promise handlers log the response or error to the console.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>In this tutorial, we've learned how to use JavaScript to make an API call to the pdfRest Zip Files endpoint to compress files into a ZIP archive. This is particularly useful for applications that need to handle file compression on the fly.\u003C\u002Fp>\n\n\u003Cp>To explore more capabilities and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For further details on how to use the API, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note that this is an example of a multipart API call. Code samples using JSON payloads for other operations can be found at the \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FJavaScript\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fzip.js\">pdf-rest-api-samples repository on GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-18T03:42:02.000+00:00","Learn how to use pdfRest Zip Files API Tool with JavaScript in NodeJS to zip processed files for easy downloads.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-javascript-in-nodejs\u002F#article\",\n      \"headline\": \"How to Zip Files with JavaScript in NodeJS\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-javascript-in-nodejs\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-javascript-in-nodejs\u002F\",\n      \"datePublished\": \"2024-03-18T03:42:02.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:38.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Zip Files API Tool with JavaScript in NodeJS to zip processed files for easy downloads.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Zip Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fzip-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fzip API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fzip-files\"\n        }\n      ],\n      \"keywords\": \"JavaScript, Zip Files\",\n      \"dependencies\": \"JavaScript, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Zip Files with JavaScript in NodeJS\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-javascript-in-nodejs\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11903,11904,11905,11906],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1915,"name":1916,"slug":1917,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2223,"name":2224,"slug":2225,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-zip-files-with-javascript-in-nodejs\u002F","How to Zip Files with JavaScript in NodeJS, Tutorial | pdfRest",{"id":11911,"uuid":11912,"title":11913,"slug":11914,"html":11915,"comment_id":11911,"feature_image":48,"featured":284,"visibility":1257,"created_at":11916,"updated_at":11917,"published_at":11916,"custom_excerpt":11918,"codeinjection_head":11919,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11920,"primary_tag":11925,"url":11926,"excerpt":11918,"reading_time":295,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11927,"meta_description":11918,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65f7b88b533c9f26b9436b22","cc606695-8fc1-42ff-97ed-43b736a8a6b4","How to Zip Files with PHP","how-to-zip-files-with-php","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Zip Files with PHP?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fzip-files\u002F'>Zip Files API Tool\u003C\u002Fa> provides a convenient way to programmatically zip multiple files together. This API is particularly useful when dealing with a collection of documents that need to be compressed into a single archive for easier distribution or storage. By using this API, developers can automate the process of zipping files directly from their PHP applications, saving time and reducing the potential for human error.\u003C\u002Fp>\n\n\u003Cp>In a real-world scenario, a user might need to zip a collection of financial reports, project documents, or a batch of images to send as a single attachment via email. The pdfRest Zip Files API allows users to do this directly from their web application, without the need for manual intervention or desktop zip utilities. This streamlines workflows, especially when dealing with large numbers of files or when this process needs to be repeated regularly.\u003C\u002Fp>\n\n\u003Ch2>Zip Files with PHP Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-php\">\nrequire 'vendor\u002Fautoload.php';\n\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Psr7\\Request;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$client = new Client();\n$headers = [\n  'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n];\n$options = [\n  'multipart' => [\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile1', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile1',\n      'headers'  => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'file',\n      'contents' => Utils::tryFopen('\u002Fpath\u002Fto\u002Ffile2', 'r'),\n      'filename' => '\u002Fpath\u002Fto\u002Ffile2',\n      'headers'  => [\n        'Content-Type' => '\u003Ccontent-type header=\"\">'\n      ]\n    ],\n    [\n      'name' => 'id[]',\n      'contents' => 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n    ],\n    [\n      'name' => 'output',\n      'contents' => 'pdfrest_zip'\n    ]\n]];\n\n$request = new Request('POST', 'https:\u002F\u002Fapi.pdfrest.com\u002Fzip', $headers);\n\n$res = $client->sendAsync($request, $options)->wait();\n\necho $res->getBody();\n\n\u003C\u002Fcontent-type>\u003C\u002Fcontent-type>\u003C\u002Fpre>\n\n\u003Cp>Reference to the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fzip.php\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The code provided is a PHP script that uses the Guzzle HTTP client to send a POST request to the pdfRest API to zip files together. The script includes the following components:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Cstrong>GuzzleHttp\\Client:\u003C\u002Fstrong> Initializes the HTTP client.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Headers:\u003C\u002Fstrong> Sets the 'Api-Key' required for authentication with the pdfRest API.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Options:\u003C\u002Fstrong> Defines the multipart payload, including the files to be zipped and additional parameters like 'output' to specify the format of the response.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Request:\u003C\u002Fstrong> Creates a new HTTP POST request with the API endpoint and headers.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Response:\u003C\u002Fstrong> Sends the asynchronous request and waits for the response, then outputs the response body.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>Each 'multipart' array element represents a part of the request payload:\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>The 'name' and 'contents' keys are used to specify the files to be included in the zip.\u003C\u002Fli>\n\u003Cli>The 'filename' key is used to provide the path to the file.\u003C\u002Fli>\n\u003Cli>The 'headers' key within each file part allows you to set the 'Content-Type' header for the file being uploaded.\u003C\u002Fli>\n\u003Cli>The 'id[]' key is used to include the ID of a file already stored on the pdfRest server.\u003C\u002Fli>\n\u003Cli>The 'output' key specifies the output format, in this case, 'pdfrest_zip' to indicate a zip file.\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>According to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fzip-files\u002F\">pdfRest Cloud API Reference Guide\u003C\u002Fa>, each parameter in the request is essential for the API to understand what files to include and how to format the response.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>This tutorial has demonstrated how to use PHP to call the pdfRest Zip Files API to compress multiple files into a single zip archive. By following the provided code example and understanding each part of the code, you can integrate this functionality into your PHP applications.\u003C\u002Fp>\n\n\u003Cp>To further explore and demo all of the pdfRest API Tools, visit the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For more detailed information on other endpoints and parameters, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads for the pdfRest API can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPHP\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fzip.php\">GitHub Repository\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-18T03:44:11.000+00:00","2026-09-02T18:29:55.000+00:00","Learn how to use pdfRest Zip Files API Tool with PHP to zip processed files for easy downloads.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-php\u002F#article\",\n      \"headline\": \"How to Zip Files with PHP\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-php\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-php\u002F\",\n      \"datePublished\": \"2024-03-18T03:44:11.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:37.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Zip Files API Tool with PHP to zip processed files for easy downloads.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Zip Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fzip-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fzip API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fzip-files\"\n        }\n      ],\n      \"keywords\": \"PHP, Zip Files\",\n      \"dependencies\": \"PHP, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Zip Files with PHP\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-php\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11921,11922,11923,11924],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1915,"name":1916,"slug":1917,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2227,"name":2228,"slug":2229,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-zip-files-with-php\u002F","How to Zip Files with PHP, Tutorial | pdfRest",{"id":11929,"uuid":11930,"title":11931,"slug":11932,"html":11933,"comment_id":11929,"feature_image":48,"featured":284,"visibility":1257,"created_at":11934,"updated_at":11917,"published_at":11934,"custom_excerpt":11935,"codeinjection_head":11936,"codeinjection_foot":48,"custom_template":48,"canonical_url":48,"tags":11937,"primary_tag":11942,"url":11943,"excerpt":11935,"reading_time":320,"access":124,"comments":284,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":11944,"meta_description":11935,"email_subject":48,"frontmatter":48,"feature_image_alt":48,"feature_image_caption":48},"65f7b8be533c9f26b9436b2c","18580b28-d4b6-4ac9-af62-5a512f0edb9d","How to Zip Files with Python","how-to-zip-files-with-python","\n\u003C!--kg-card-begin: html-->\n\u003Ch2>Why Use Zip Files with Python?\u003C\u002Fh2>\n\n\u003Cp>The pdfRest \u003Ca href='https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fzip-files\u002F'>Zip Files API Tool\u003C\u002Fa> provides a convenient way to compress multiple files into a single ZIP archive programmatically.\u003C\u002Fp> \n  \n\u003Cp>This tutorial will guide you through the process of sending an API call to the pdfRest Zip Files endpoint using Python. Zipping files can be particularly useful when dealing with a large number of documents or when you need to save space and bandwidth during file transfer.\u003C\u002Fp>\n\n\u003Cp>For instance, suppose you are working on a web application that allows users to download multiple PDF reports. Instead of downloading each report individually, you could use the pdfRest API to compress these reports into a ZIP file, making the download process more efficient and user-friendly. This not only saves time for the user but also reduces the load on your server and network.\u003C\u002Fp>\n\n\u003Ch2>Zip Files with Python Code Example\u003C\u002Fh2>\n\n\u003Cpre class=\"language-python\">from requests_toolbelt import MultipartEncoder\nimport requests\nimport json\n\nzip_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fzip'\n\n# The \u002Fzip endpoint can take one or more file or ids as input and compresses them into a .zip.\n# This sample takes 2 files and compresses them into a zip file.\nzip_request_data = []\n\n# Array of tuples that contains information about the 2 files that will be compressed into a .zip\n# The 'application\u002Fpdf' string below is known as a MIME type, which is a label used to identify the type of a file so that it is handled properly by software.\n# Please see https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FWeb\u002FHTTP\u002FBasics_of_HTTP\u002FMIME_types\u002FCommon_types for more information about MIME types.\nfiles = [\n    ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n    ('file_name.tif', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'image\u002Ftiff'),\n    ('file_name.bmp', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'image\u002Fbmp')\n]\n\n# Structure the data that will be sent to POST zip request as an array of tuples\nfor i in range(len(files)):\n    zip_request_data.append((\"file\", files[i]))\n\nzip_request_data.append(('output', 'example_zip_out'))\n\nmp_encoder_zip = MultipartEncoder(\n    fields=zip_request_data\n)\n\n# Let's set the headers that the zip endpoint expects.\n# Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart\u002Fform-data' via the content_type attribute below.\nheaders = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_zip.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\nprint(\"Sending POST request to zip endpoint...\")\nresponse = requests.post(zip_endpoint_url, data=mp_encoder_zip, headers=headers)\n\nprint(\"Response status code: \" + str(response.status_code))\n\nif response.ok:\n    response_json = response.json()\n    print(json.dumps(response_json, indent = 2))\nelse:\n    print(response.text)\n\n# If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.py' sample.\n\u003C\u002Fpre>\n\n\u003Cp>Source of the provided code: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FMultipart%20Payload\u002Fzip.py\">GitHub\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Ch2>Breaking Down the Code\u003C\u002Fh2>\n\n\u003Cp>The provided Python code demonstrates how to use the pdfRest API to compress multiple files into a ZIP archive. Let's break down the key components of the code:\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">zip_endpoint_url = 'https:\u002F\u002Fapi.pdfrest.com\u002Fzip'\n\u003C\u002Fpre>\n\n\u003Cp>This line sets the API endpoint URL to which the POST request will be sent.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">\nfiles = [\n    ('file_name.pdf', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'application\u002Fpdf'),\n    ('file_name.tif', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'image\u002Ftiff'),\n    ('file_name.bmp', open('\u002Fpath\u002Fto\u002Ffile', 'rb'), 'image\u002Fbmp')\n]\n\u003C\u002Fpre>\n\n\u003Cp>Here, 'files' is an array of tuples. Each tuple represents a file to be zipped, including the file name, a file object opened in binary read mode, and the file's MIME type.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">for i in range(len(files)):\n    zip_request_data.append((\"file\", files[i]))\n\u003C\u002Fpre>\n\n\u003Cp>This loop adds each file to the 'zip_request_data' list as part of the data to be sent in the API request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">mp_encoder_zip = MultipartEncoder(\n    fields=zip_request_data\n)\n\u003C\u002Fpre>\n\n\u003Cp>The 'MultipartEncoder' is used to encode the files and data for the multipart\u002Fform-data POST request.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">headers = {\n    'Accept': 'application\u002Fjson',\n    'Content-Type': mp_encoder_zip.content_type,\n    'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here\n}\n\u003C\u002Fpre>\n\n\u003Cp>The 'headers' dictionary includes the necessary headers for the request, such as 'Content-Type' and 'Accept'. Replace 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' with your actual API key.\u003C\u002Fp>\n\n\u003Cpre class=\"language-python\">response = requests.post(zip_endpoint_url, data=mp_encoder_zip, headers=headers)\n\u003C\u002Fpre>\n\n\u003Cp>A POST request is made to the zip endpoint with the encoded data and headers.\u003C\u002Fp>\n\n\u003Ch2>Beyond the Tutorial\u003C\u002Fh2>\n\n\u003Cp>By following the steps outlined in this tutorial, you've learned how to make an API call to the pdfRest Zip Files endpoint to compress multiple files into a ZIP archive using Python. This can be a powerful feature for applications that need to handle file compression and distribution efficiently.\u003C\u002Fp>\n\n\u003Cp>If you want to explore more capabilities of the pdfRest API, consider demoing all of the pdfRest API Tools in the \u003Ca href=\"https:\u002F\u002Fpdfrest.com\u002Fapilab\u002F\">API Lab\u003C\u002Fa>. For a comprehensive understanding of the available endpoints and their functionalities, refer to the \u003Ca href=\"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002F\">API Reference Guide\u003C\u002Fa>.\u003C\u002Fp>\n\n\u003Cp>Note: This is an example of a multipart API call. Code samples using JSON payloads for the pdfRest API can be found at \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpdfrest\u002Fpdfrest-api-samples\u002Fblob\u002Fmain\u002FPython\u002FEndpoint%20Examples\u002FJSON%20Payload\u002Fzip.py\">GitHub\u003C\u002Fa>.\u003C\u002Fp>\n\u003C!--kg-card-end: html-->\n","2024-03-18T03:45:02.000+00:00","Learn how to use pdfRest Zip Files API Tool with Python to zip processed files for easy downloads.","{\n  \"@context\": \"https:\u002F\u002Fschema.org\",\n  \"@graph\": [\n    {\n      \"@type\": \"TechArticle\",\n      \"@id\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-python\u002F#article\",\n      \"headline\": \"How to Zip Files with Python\",\n      \"url\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-python\u002F\",\n      \"mainEntityOfPage\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-python\u002F\",\n      \"datePublished\": \"2024-03-18T03:45:02.000Z\",\n      \"dateModified\": \"2026-09-01T14:23:37.000Z\",\n      \"author\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\"\n      },\n      \"publisher\": {\n        \"@type\": \"Organization\",\n        \"name\": \"pdfRest\",\n        \"url\": \"https:\u002F\u002Fpdfrest.com\u002F\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\u002F\u002Fcms.pdfrest.com\u002Fcontent\u002Fimages\u002F2026\u002F09\u002FpdfRest_submark_750_750.png\"\n        }\n      },\n      \"description\": \"Learn how to use pdfRest Zip Files API Tool with Python to zip processed files for easy downloads.\",\n      \"about\": [\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"Zip Files API Tool\",\n          \"url\": \"https:\u002F\u002Fpdfrest.com\u002Fapitools\u002Fzip-files\u002F\"\n        },\n        {\n          \"@type\": \"Thing\",\n          \"name\": \"POST \u002Fzip API endpoint\",\n          \"url\": \"https:\u002F\u002Fdocs.pdfrest.com\u002Fpdfrest-api-toolkit-cloud\u002Fapi-reference-guide\u002Ftool\u002Fzip-files\"\n        }\n      ],\n      \"keywords\": \"Python, Zip Files\",\n      \"dependencies\": \"Python, pdfRest API key\"\n    },\n    {\n      \"@type\": \"BreadcrumbList\",\n      \"itemListElement\": [\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 1,\n          \"name\": \"Learning\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 2,\n          \"name\": \"Tutorials\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002F\"\n        },\n        {\n          \"@type\": \"ListItem\",\n          \"position\": 3,\n          \"name\": \"How to Zip Files with Python\",\n          \"item\": \"https:\u002F\u002Fpdfrest.com\u002Flearning\u002Ftutorials\u002Fhow-to-zip-files-with-python\u002F\"\n        }\n      ]\n    }\n  ]\n}",[11938,11939,11940,11941],{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},{"id":2330,"name":2331,"slug":2331,"description":2332,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2333},{"id":1915,"name":1916,"slug":1917,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2219,"name":2220,"slug":2221,"description":48,"feature_image":48,"visibility":1282,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":1284},{"id":2978,"name":2979,"slug":2979,"description":48,"feature_image":48,"visibility":1257,"og_image":48,"og_title":48,"og_description":48,"twitter_image":48,"twitter_title":48,"twitter_description":48,"meta_title":48,"meta_description":48,"codeinjection_head":48,"codeinjection_foot":48,"canonical_url":48,"accent_color":48,"url":2980},"https:\u002F\u002Fcms.pdfrest.com\u002Fhow-to-zip-files-with-python\u002F","How to Zip Files with Python, Tutorial | pdfRest",{"pagination":11946},{"page":5,"limit":2962,"pages":5,"total":11947,"next":48,"prev":48},468,1790965737247]