使用Python自动打印PDF

发布于 2025-02-13 00:50:51 字数 217 浏览 0 评论 0原文

我正在建立一个网站,该网站接受用户的PDF和选项,例如以打印,副本,颜色或黑色的页面以及他们想要印刷的商店。

PDF将存储在服务器中,并将转移到商店打印。如何使用应用这些选项自动打印它。我想的一种方法是编辑PDF并发送到商店以使用所应用的选项打印。

如何自动打印PDF并向服务器报告PDF的打印?

选择Python可能具有容易的实施。 顺便说一句,我将使用nodejs构建网站

I am building a website which accepts pdf from users and the options, like pages to print, copies, color or black&white and the shop from which they want to get it printed.

The pdf will be stored in server and will be passed on to the shop to print. How do i get it printed automatically with those options applied. One way i thought was to edit the pdf and sent to the store to print with the options applied.

How do i print the pdf automatically and report back to the server that the pdf was printed?

chose python as it may have easy implementation.
BTW i'll build website using NodeJS

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

还在原地等你 2025-02-20 00:50:51

您可以执行以下操作:

import os

os.startfile("C:/Users/TestFile.txt", "print")

这将以动词为“打印”的默认开瓶机以其默认开启器启动文件,该文件将打印到您的默认打印机上。仅需要标准库随附的OS模块,

这仅在Windows上使用。因此,如果您希望它可以在其他操作系统上使用,则需要一种检测发送到哪个OS的OS。

You can do the following:

import os

os.startfile("C:/Users/TestFile.txt", "print")

This will start the file, in its default opener, with the verb 'print', which will print to your default printer.Only requires the os module which comes with the standard library

This only works on windows. So if you want it to work on other OS's you'll need a way to detect which OS the pdf is being sent to.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文