Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hi, how can I make a file print multiple copies and send it only once instead of sending it to the printer over and over again? #7

Open
fdjkdf opened this issue May 9, 2024 · 16 comments

Comments

@fdjkdf
Copy link

fdjkdf commented May 9, 2024

I have learned by reading the original article that printing N copies of a certain document is written as follows:

PDFtoPrinter filename.pdf copies=N

But it sends the file N times to the printer, greatly increasing time and reducing efficiency. Normally, it should be sent once, and then the printer can print multiple copies after receiving it. How can I modify it?

@emendelson
Copy link
Owner

emendelson commented May 9, 2024

If you can find anything in the PDF-Xchange manual that would do this, I would be glad to implement it. Here's the link:

https://downloads.pdf-xchange.com/PDFVManual.pdf

Let me know if you find anything relevant. The command-line syntax starts on page 18.

@fdjkdf
Copy link
Author

fdjkdf commented May 9, 2024

20240510_044655_386_copy I want to print multiple files with different number of copies, so the loop is triggered, but this software reports this error, how to avoid it?

@fdjkdf
Copy link
Author

fdjkdf commented May 9, 2024

In addition to the site has talked about, you can use powershell to achieve silent printing. That with PDFtoPrinter filename. pdf copies=N, there are other differences such as speed will be faster?

@emendelson
Copy link
Owner

I don't know how to avoid the error that you reported. Please feel free to download the source code and modify it. If you can find a solution, I will gladly add it to the program.

I don't know whether powershell will be faster than my program for silent printing. Could you experiment and report the results?

@fdjkdf
Copy link
Author

fdjkdf commented May 10, 2024

我不知道如何避免您报告的错误。请随意下载源代码并进行修改。如果您能找到解决方案,我很乐意将其添加到程序中。

我不知道 powershell 是否会比我的静默打印程序更快。你能实验并报告结果吗?

I would like to ask if no one has used it before to repeat the cycle of printing, for example when printing multiple files.

Also I found that after the cmd is started once, the file will start transferring to the printer, and pdftoprinter doesn't need to be in the background, just exit. In other words, is it possible to make the software quit after starting cmd once, so that it won't affect the use of it, and it can avoid the error shown on my picture (the reason is that the software must wait for the file it sends to finish transferring at the printer).

@fdjkdf
Copy link
Author

fdjkdf commented May 10, 2024

我不知道如何避免您报告的错误。请随意下载源代码并进行修改。如果您能找到解决方案,我很乐意将其添加到程序中。

我不知道 powershell 是否会比我的静默打印程序更快。你能实验并报告结果吗?

I found another software that also prints from the command line, and it sends a file that enables multiple copies of a certain file to be printed (but only sent once to the printer).
https: //github. com/sumatrapdfreader/sumatrapdf
But it doesn't print as fast as our pdftoprinter. Nah I can't read the code and don't know how to get its length to make up for it.

@emendelson
Copy link
Owner

Sumatra PDF only prints to its default paper size. If that works for you, edit my code to use it instead.

I would like to ask if no one has used it before to repeat the cycle of printing, for example when printing multiple files.

No one else has ever reported this problem.

is it possible to make the software quit after starting cmd once, so that it won't affect the use of it.

No, because it needs to stay open until it has printed all the files on the command line. But the AutoIt language is easy to learn, and you can study the code and modify it to do what you want.

Probably this software will never do what you want it to do. I think you would probably get better results from PowerShell.

@emendelson
Copy link
Owner

emendelson commented May 10, 2024

@fdjkdf - I forgot that you can disable the "PDFPrinter.exe is already running" error by adding the letter "M" or "m" to the name of the executable, as in PDFPrinter-multi.exe or anything else with "m" in it. This may cause problems, so feel free to experiment.

I haven't documented this because it can cause other problems. But you may want to try it.

@kenpeacez
Copy link

I made the powershell script if anyone wants to use it. Please change powershell execution policy to Unrestricted first. Put the powershell script in same folder as PDFtoPrinter.exe. This script will print any detected new PDF files in the folder (raised by the 'Created' events by FileSystemWatcher, essentially making the directory to be 'Hot Folder'. I had also included .dat file for the PDFtoPrinter.exe printing settings to Auto-Fit to Page. The printed PDF file will then moved to 'Printed' folder automatically. Please note this works for small PDF files around 500kB, for bigger size I had not tested. Printed folder is created automatically if it doesn't exists. I also compiled the script to .exe file using ps2exe. Hope this helps.
image

PDFtoPrinter.zip

@fdjkdf
Copy link
Author

fdjkdf commented May 17, 2024

我制作了 powershell 脚本,如果有人想使用它的话。请先将 powershell 执行策略更改为“无限制”。将 powershell 脚本与 PDFtoPrinter.exe 放在相同的文件夹中。该脚本将打印文件夹中任何检测到的新 PDF 文件(由 FileSystemWatcher 的“创建”事件引发,本质上使该目录成为“热文件夹”。我确认 PDFtoPrinter.exe 打印设置为“自动”的 .dat 包含文件发票) -FitPages然后,打印的PDF文件将自动移动到“打印”文件夹,请注意,这适用于500kB左右的小PDF文件,如果打印文件夹不存在,我还没有测试过。我还使用ps2exe将脚本编译为 .exe 文件,希望这有帮助。 图像

PDFtoPrinter.zip

Do you mean you will copy the files to this folder, can't you realize printing PDF with full directory filled directly through cmd. I am through the automation software to realize the automatic transfer of the PDF name I need to the background, automatically fill the cmd and then realize the silent printing. Currently need to solve is it multiple documents can not be duplicated to send!

@kenpeacez
Copy link

Please try this PS script. Here's the example output.
image
PrintPDFCopies.zip
Steps,

  1. Run the .exe or run the PowerShell script
  2. Input your value of seconds to terminate the PDFtoPrinter.exe process
  3. Place your PDF file in the same director of the script
  4. After PDF detected, input your number of copies to print.
  5. Add more PDF files to the directory to print more

@kenpeacez
Copy link

kenpeacez commented May 18, 2024

Also to take note at page 18, https://downloads.pdf-xchange.com/PDFVManual.pdf, this manual did not specify the parameters to specify number of copies in the original printer.exe. So it is not possible to only send one copy to the printer. Regards.

@fdjkdf
Copy link
Author

fdjkdf commented May 18, 2024

另请注意,第 18 页https://downloads.pdf-xchange.com/PDFVManual.pdf中,本手册未指定原始 Printer.exe 中指定份数的参数。因此不可能只将一份副本发送到打印机。问候。

But I found another open source software that can print from the command line, it sends the file only once and prints more than one, do you know why this is.
https://github.com/sumatrapdfreader/sumatrapdf

@emendelson
Copy link
Owner

You can easily rewrite the AutoIt code to use SumatraPDF, but SumatraPDF only prints to one default paper size, so I can't use it. But anyone else is free to rewrite the code.

@fdjkdf
Copy link
Author

fdjkdf commented May 18, 2024

You can easily rewrite the AutoIt code to use SumatraPDF, but SumatraPDF only prints to one default paper size, so I can't use it. But anyone else is free to rewrite the code.

I would like to ask you, why sumatra can realize multiple copies to send only one, the two software can not combine the advantages of each?

@emendelson
Copy link
Owner

You will have to ask the authors of SumatraPDF and PDF-Xchange that question. I have no idea of the answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants