PDF.co API for Word to PDF Conversion and Parsing

PDF.co API for Word to PDF Conversion and Parsing

Hello,

I am posting this topic here because the developer community has been so helpful in the past. We have been attempting to work with PDF.co to get an answer on some issues we're having, but there must be a time zone delay, and there's just been a lot of back and forth, rather than an actual resolution. Here is what we're attempting to do:
  1. Download a .docx file from a custom module's attachments
  2. Obtain a pre-signed URL from PDF.co (they're using AWS) to work with the file
    1. URL response - url to access uploaded file
    2. Presigned URL - used to upload local file
  3. Upload the .docx file to AWS with the pre-signed URL
  4. Convert the .docx file to a PDF using the PDF.co endpoint and the URL obtained from the pre-signed URL upload
  5. Parse the PDF and return as JSON to our deluge custom function
  6. We then iterate through it and do the things we need to do
A couple more notes before we get into the code:
  1. We tried to convert the .docx file to a PDF using the Zoho Writer API and found that cell borders disappeared causing issues with the parsing at PDF.co. BUT, everything else worked great, including uploading the PDF to the pre-signed URL.
  2. We attempted to upload the file to PDF.co's built in storage, rather than the pre-signed URL, but when we download the file, and then attempt to pass it as a parameter, we get an error saying the file parameter is missing. We believe this is because the upload endpoint wants the file path. We don't know how to get that or if we even can get that from Zoho. 
  3. The pre-signed URL endpoint worked for us when we uploaded the Zoho converted PDF file.
Okay, on to the code. Thanks in advance for your help and grace with this far from perfect code! I have omitted the parsing code since we're getting hung up before then.
  1. thisRec = zoho.crm.getRecordById("Meeting_Details",thisRecId);
  2. accountId = thisRec.get("Account").get("id");
  3. newList = List();
  4. //Get all attachments on meeting detail rec
  5. response = invokeurl
  6. [
  7. url :"https://www.zohoapis.com/crm/v6/Meeting_Details/" + thisRecId + "/Attachments?fields=id,Owner,File_Name,Created_Time,Parent_Id&sort_order=desc&sort_by=Created_Time"
  8. type :GET
  9. connection:"******"
  10. ];
  11. // info response;
  12. responseNull = response.isNull();
  13. info "Attachment Response Empty: " + responseNull;
  14. if(responseNull == true)
  15. {
  16. info "No Attachments to parse";
  17. return;
  18. }
  19. //Get last uploaded file
  20. fileRec = response.get("data").get(0);
  21. info "File Rec: " + fileRec;
  22. fileId = fileRec.get("id");
  23. info "File ID: " + fileId;
  24. fileName = fileRec.get("File_Name");
  25. info "File Name: " + fileName;
  26. createdTime = fileRec.get("Created_Time");
  27. info "Created Time: " + createdTime;
  28. //Download File from Meeting Detail Rec
  29. downloadResponse = invokeurl
  30. [
  31. url :"https://www.zohoapis.com/crm/v6/Meeting_Details/" + thisRecId + "/Attachments/" + fileId
  32. type :GET
  33. connection:"******"
  34. ];
  35. info downloadResponse;
  36. fileCheck = downloadResponse.isFile();
  37. info "File? " + fileCheck;
  38. //
  39. //PDF.co Headers
  40. apiKey = "*******************";
  41. headers = Map();
  42. headers = {"x-api-key":apiKey};
  43. // Upload Permission
  44. setupFileUpload = invokeurl
  45. [
  46. url :"https://api.pdf.co/v1/file/upload/get-presigned-url?name=" + fileName + "&encrypt=false"
  47. type :GET
  48. headers:headers
  49. detailed:true
  50. ];
  51. setupFileUpload = setupFileUpload.get("responseText");
  52. // info "File Upload Response: " + setupFileUpload;
  53. uploadUrl = setupFileUpload.get("presignedUrl");
  54. info "Upload URL: " + uploadUrl;
  55. workingFileUrl = setupFileUpload.get("url");
  56. info "Working URL: " + workingFileUrl;
  57. // Actual Upload
  58. uploadHeaders = Map();
  59. uploadHeaders.put("x-api-key",apiKey);
  60. uploadHeaders.put("Content-Type","application/octet-stream");
  61. uploadParams = Map();
  62. uploadParams.put("file",downloadResponse);
  63. uploadParams.put("expiration",20);
  64. uploadParams.put("async","true");
  65. actualUpload = invokeurl
  66. [
  67. url :uploadUrl
  68. type :PUT
  69. parameters:uploadParams
  70. headers:uploadHeaders
  71. detailed:true
  72. ];
  73. info "Actual Upload: " + actualUpload;
  74. //
  75. //Convert to PDF
  76. conversionURL = "https://api.pdf.co/v1/pdf/convert/from/doc";
  77. conversionHeader = Map();
  78. conversionHeader.put("x-api-key",apiKey);
  79. conversionHeader.put("Content-Type","application/json");
  80. conversionPayload = {"url":workingFileUrl,"async":false,"inline":"true","password":"","profiles":""};
  81. conversionResult = invokeurl
  82. [
  83. url :conversionURL
  84. type :POST
  85. parameters:conversionPayload
  86. headers:conversionHeader
  87. detailed:true
  88. ];
  89. info "Conversion Result: " + conversionResult;
  90. convertedDocURL = conversionResult.get("responseText").get("url");
  91. info "Converted Doc URL: " + convertedDocURL;
We believe the issue is happening on the upload to the pre-signed URL. Once we upload the file 66-74, we then use the workingFileURL to look at the document. We are able to download, but have to use Word's recovery tool as it's corrupted. The code continues and it converts the file to a PDF, but it is unintelligible. 

Thanks so much for your help!
    • Sticky Posts

    • Zoho CRM Functions 53: Automatically name your Deals during lead conversion.

      Welcome back everyone! Last week's function was about automatically updating the recent Event date in the Accounts module. This week, it's going to be about automatically giving a custom Deal name whenever a lead is converted. Business scenario Deals are the most important records in CRM. After successful prospecting, the sales cycle is followed by deal creation, follow-up, and its subsequent closure. Being a critical function of your sales cycle, it's good to follow certain best practices. One such
    • User Tips: Auto-Create Opportunity/Deal upon Quote Save (PART 1)

      Problem: We use quotes which convert to sales orders but Users / Sales Reps do not create opportunities / deals and go straight to creating a quote. This leads to poor reporting. Implementing this solution improves reporting and makes it easier for users.
    • Custom Function : Automatically send the Quote to the related contact

      Scenario: Automatically send the Quote to the related contact.  We create Quotes for customers regularly and when we want to send the quote to the customer, we have to send it manually. We can automate this, using Custom Functions. Based on a criteria, you can trigger a workflow rule and the custom function associated to the rule and automatically send the quote to customer through an email. Please note that the quote will be sent as an inline email content and not as a PDF attachment. Please follow
    • Function #50: Schedule Calls to records

      Welcome back everyone! Last week's function was about changing ownership of multiple records concurrently. This week, it's going to be about scheduling calls for records in various modules. Business scenario Calls are an integral part of most sales routines.. Sales, Management, Support, all the branches of the business structure would work in cohesion only through calls. You could say they are akin to engine oil, which is required by the engine to make all of it's components function perfectly. CRM
    • Function #37: Create a Purchase Order from a Quote

      Welcome back everyone! Last week, we learnt how to calculate the total number of activities for a lead and further take note of the activity count for particular dates. For instance, from the period of Demo to Negotiation. This week, let's look at a function that lets you create a Purchase Order instantly from a Quote. Business scenario: In any form of business, one of the most important things to do is to document the transactions. Naturally, negotiation, signing an agreement, placing an order,
    • Recent Topics

    • Zoho Assist not rendering NinjaTrader chart properly

      Hi everyone. Just installed and testing Zoho Assist. I want to display my laptop' screen (Windows 11) on a monitor connected to my Mac mini. The laptop is running a stock trading program called NinjaTrader. Basically, when running, this program displays
    • Dropshipping Address - Does Not Show on Invoice Correctly

      When a dropshipping address is used for a customer, the correct ship-to address does not seem to show on the Invoice. It shows correctly on the Sales Order, Shipment Order, and Package, just not the Invoice. This is a problem, because the company being
    • An Exclusive Session for Zoho Desk Users: AI in Zoho Desk

      A Zoho Community Learning Initiative Hello everyone! This is an announcement for Zoho Desk users and anyone exploring Zoho Desk. With every nook and corner buzzing, "AI's here, AI's there," it's the right time for us to take a closer look at how the AI
    • Best way to schedule bill payments to vendors

      I've integrated Forte so that I can convert POs to bills and make payments to my vendors all through Books. Is there a way to schedule the bill payments as some of my vendors are net 30, net 60 and even net 90 days. If I can't get this to work, I'll have
    • Link(s) between Notes

      Hello Everyone, It would be great if links could be created between notes. Let's say we have 5 Notes A, B, C , D, E. I would like to be able to link Note A to Note B but not in other way, so no link appears in Note B linking to Note A. An so on, linking
    • Regex in Zoho Mail custom filters is not supported - but it works!

      I recently asked Zoho for help using regex in Zoho Mail custom filters and was told it was NOT supported. This was surprising (and frustrating) as regex in Zoho Mail certainly works, although it does have some quirks* To encourage others, here are 3 regex
    • Need Easy Way to Update Item Prices in Bulk

      Hello Everyone, In Zoho Books, updating selling prices is taking too much time. Right now we have to either edit items one by one or do Excel export/import. It will be very useful if Zoho gives a simple option to: Select multiple items and update prices
    • Feature Request: Assign Documents to Already Entered Bills, Expenses, Invoices, etc.

      Hi Zoho Team, We are regular users of the Documents module in Zoho Books and appreciate its ability to keep financial records well-organized. However, we’ve noticed a limitation: There is no way to attach a document from the "Documents > Files" section
    • I don't see any WITHDRAWL transaction at all

      Hi I manually imported my bank statement to Zoho books today and I am a complete newbie. I have been reading the knowledgebase but unable to fix this. I only see "Uncategorized 91 DEPOSIT transactions". I don't see any WITHDRAWL transaction at all. Also,
    • Shared inbox unable to see replies

      Hi we are a small company me and someone else, we have a shared inbox for our sale@ and contact@ however we have this issue where by if i reply to an email or the other person reply to the email, it does not show it to them and therefore we end up replying
    • Sync desktop folders instantly with WorkDrive TrueSync (Beta)

      Keeping your important files backed up and accessible has never been easier! With WorkDrive desktop app (TrueSync), you can now automatically sync specific desktop folders to WorkDrive Web, ensuring seamless, real-time updates across devices. Important:
    • Workdrive on Android - Gallery Photo Backups

      Hello, Is there any way of backing up the photos on my android phone directly to a specific folder on Workdrive? Assuming i have the workdrive app installed on the phone in question. Emma
    • Zoho Books | Product updates | August 2025

      Hello users, We’ve rolled out new features and enhancements in Zoho Books. From the right sidebar where you can manage all your widgets, to integrating Zoho Payments feeds in Zoho Books, explore the updates designed to enhance your bookkeeping experience.
    • Kaizen #136 - Zoho CRM Widgets using ReactJS

      Hey there! Welcome back to yet another insightful post in our Kaizen series! In this post, let's explore how to use ReactJS for Zoho CRM widgets. We will utilize the sample widget from one of our previous posts - Geocoding Leads' Addresses in ZOHO CRM
    • 404 error at checkout

      Our customers are getting a 404 error at checkout. Anyone else with the same problem?
    • Custom Buttons for Mass Actions

      Hello everyone, We’ve just made Custom Buttons in Zoho Recruit even more powerful! You can now create Bulk Action Buttons that let you perform actions on multiple records at once, directly from the List View. What’s new? Until now, custom buttons were
    • FONT Sizing in Notebook

      Hi Kishore - What is the status of adding font sizing to the application? I have several things that I have pasted directly into Notebook and the fonts are HUGE! I would like the ability to highlight them and reduce the font to a legible size. Nothing
    • Can managers Upload documents to their direct rapports?

      Admin employees have the ability to upload documents to employees' files; however, managers do not have add/manage button - is it possible for managers to upload their direct reports' documents, such as absence documents or 121 documents. Is there something
    • Leave balance display for next year

      Is there a way to not have a rollover or not limit the leave balance depending on the date. For example an employee has 10 days leave balance and wants to apply for January leave in December. They cant because the rollover doesnt show the leave balance
    • Auto Capitalize First Letter of Words

      Hi I am completely new to ZOHO and am trying to build a database. How can i make it when a address is entered into a form field like this: main st it automatically changes is to show: Main St Thank You
    • Please add an “Auto-Apply Unused Credits” toggle

      Hello — please add a simple org-level option to automatically apply unused credits (credit notes, excess payments, retainers) to new invoices and/or bills. An ON/OFF toggle with choices “invoices”, “bills”, or “both” would save lots of manual work for
    • Zoho Books not working/loading

      Hi! I haven't been able to access/load Zoho Books for the past hours. I get a time out (and it is not due to my internet connection). Could you please check this asap? Thank you!
    • WhatsApp Channels in Zoho Campaigns

      Now that Meta has opened WhatsApp Channels globally, will you add it to Zoho Campaigns? It's another top channel for marketing communications as email and SMS. Thanks.
    • Introducing Profile Summary: Faster Candidate Insights with Zia

      We’re excited to launch Profile Summary, a powerful new feature in Zoho Recruit that transforms how you review candidate profiles. What used to take minutes of resume scanning can now be assessed in seconds—thanks to Zia. A Quick Example Say you’re hiring
    • Custom Fields with Data Types for Expense and Payments Received in Zoho Books

      Hi all, We are glad to present to you, the option to create Custom Fields for the Expense and Payments received modules in Zoho Books. This also comes with an icing on top of it - Yes, the custom fields can now be created with different data types. Types like Text, Number, Decimal, Amount, Auto Number and Check Box are supported as of now. Rush to the gear icon at the top right corner, select 'More Settings', choose 'Preferences' in the left pane. Click the Expense/Payment preferences where you can
    • Custom Fonts in Zoho CRM Template Builder

      Hi, I am currently creating a new template for our quotes using the Zoho CRM template builder. However, I noticed that there is no option to add custom fonts to the template builder. It would greatly enhance the flexibility and branding capabilities if
    • [Webinar] Automate sales and presales workflows with Writer

      Sales involves sharing a wide range of documents with customers across the presales, sales, and post-sales stages: NDAs, quotes, invoices, sales orders, and delivery paperwork. Generating and managing these documents manually slows down the overall sales
    • Follow-up emails via Workflow Automation not staying in the same thread

      Dear Zoho Support Team, I am currently using Workflow Automation in Zoho Campaigns to send follow-up emails. In my test case, I noticed the following behavior: All emails in the automation have the same subject line. If the follow-up email is sent within
    • Zoho Cliq - Incident alert (Server outage - IN DC) | August 28

      We've received server down alerts and are currently investigating the issue (IN DC) to find the root cause. Our team is actively working to restore normal operations at the earliest. Status: Under investigation Start time: 09:44:21 AM IST Affected location:
    • Claude + MCP Server + Zoho CRM Integration – AI-Powered Sales Automation

      Hello Zoho Community 👋 I’m excited to share a recent integration we’ve worked on at OfficehubTech: ✅ Claude + MCP Server + Zoho CRM This integration connects Zoho CRM with Claude AI through our custom MCP Server, enabling intelligent AI-driven responses
    • How to conditionally embed an own internal widget with parameters in an html snippet?

      Hello everyone, I'm trying to create a dynamic view in a page using an HTML snippet. The goal is to display different content based on a URL parameter (input.step). I have successfully managed to conditionally display different forms using the following
    • Sync more than one Workdrive

      Hello Please I'm facing some difficulties since some days. In my company we have many zoho accounts in different organisations. And I have to find a way to sync all these Workdrives. I spend many hours to search it on zoho Workdrive but no solution. Could someone help me ? Any idea how I can achieve it ? Thanks in advance. Regards
    • How can I see content of system generated mails from zBooks?

      System generated mails for offers or invices appear in the mail tab of the designated customer. How can I view the content? It also doesn't appear in zMail sent folder.
    • Limitations on editing a message in Cliq

      Hi I've checked the documentations and there's no mention of how many times a message can be edited. When trying with code, I get various numbers such as ~1000 edits or so. Please mention if there's a limit on how many times one can change a message via
    • Problem with reports due to "Connected" items change - Yes this IS a problem

      Now that the change has been made to use "connected" items I can no longer run the reporting I need in CRM. I should be able to start with Deals as the parent, connect down to the Account (Account_Name) on the deal as the child, then to any child items
    • CRM x WorkDrive: File storage for new CRM signups is now powered by WorkDrive

      Availability Editions: All DCs: All Release plan: Released for new signups in all DCs. It will be enabled for existing users in a phased manner in the upcoming months. Help documentation: Documents in Zoho CRM Manage folders in Documents tab Manage files
    • Narrative 10: Assignment Rules - Streamlining Ticket Management

      Behind the scenes of a successful ticketing system: BTS Series Narrative 10: Assignment Rules - Streamlining Ticket Management In the complex world of customer support, a flood of incoming tickets can hit the help desk in seconds. Businesses must do more
    • Product details removed during update from other system

      We maintain our product details in an other system. These details are synchronized with Zoho at the end of each day, through an API. This has worked perfectly sofar. But last Monday, all product codes and some other product data have been wiped during
    • Free webinar! Digitize recruitment and onboarding with Zoho Sign and Zoho Recruit

      Hello, Tired of being buried in onboarding paperwork? With the integration between Zoho Sign and Zoho Recruit, a powerful applicant tracking system, you can digitize and streamline the entire recruitment and onboarding process, all from one platform.
    • Custom form - Duplicate Value Present

      I am new to Zoho People. I create a new form on Zoho People quite simple. A date (by default the current date) and a radio button with 3 options (Yes, No, Not applicable) I defined the date as ‘No duplicate’ as only one entry by date is allowed. I added:
    • Next Page