The process of building custom applications and tools that interact with Microsoft SharePoint, including SharePoint Online in Microsoft 365.
Thank you for reaching out to Microsoft Q&A
As far as I know, this behavior typically caused by differences in how the Graph API’s PDF conversion engine interprets document layout, particularly with elements like section breaks, page margins, and font substitutions.
Therefore, to mitigate this behavior, you can follow the below suggestion workarounds:
1/ Review your DOCX files for:
Review your DOCX files for formatting elements that may trigger pagination issues during conversion. Specifically, check for the use of “Odd page” section breaks, which can introduce filler pages to maintain publishing conventions.
Additionally, look for excessive empty paragraphs or trailing line breaks at the end of the document, as well as wide tables or images that may exceed page boundaries these can all contribute to unexpected blank pages in the resulting PDF.
2/ Adjust formatting:
You can replace “Odd page” section breaks with “Next page” breaks where appropriate to prevent automatic blank page insertion. Standardize fonts throughout the document and ensure they are properly embedded to avoid layout shifts.
Finally, define explicit page sizes and margins in the DOCX file to help the Graph API’s rendering engine interpret the layout more consistently during PDF generation.
Link references:
https://learn.microsoft.com/en-gb/answers/questions/5562717/graph-api-docx-to-pdf-conversion
You can try the above workaround method, if the problem still persists, kindly let me know in the comments for further support.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.