'Chrome headless print-to-pdf for flattening PDF

I was wondering if I can use chrome's headless print-to-pdf functionality to flatten an existing PDF file.

This one works, webpage to PDF:

chrome --headless --print-to-pdf="D:\\fromPath\\x_flat.pdf" https://google.com

a PDF file named x is generated.

Am looking for something similar like below:(not working however)

chrome --headless --print-to-pdf="D:\\fromPath\\x_flat.pdf" "file:///D:/fromPath/x_UnFlat.pdf"

Is this available in the scope of headless functionality. Instead of passing a webpage, Can I pass an existing PDF file?

PS: other options with Adobe library, itextsharp, PDFSharp cannot be used because of certain security reason. So am forced to do flattening using "Print to PDF" methods such as Microsoft Print to PDF or chrome's.

Microsoft Print to PDF is just giving a blank document.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source