简体   繁体   English

通过浏览器打印成 PDF 需要很多线程吗?

[英]Print to PDF by browser take a lot of threads?

I tried Brave on Mac with the command in the answer by KJ in the following question.我在 Mac 上使用 KJ 在以下问题中回答的命令尝试了 Brave。 But after running many such conversions, I may end up with a message of -bash: fork: retry: Resource temporarily unavailable in a terminal.但是在运行许多这样的转换之后,我可能会收到一条消息-bash: fork: retry: Resource temporarily unavailable in a terminal。 It seems that too many threads are used and not cleaned afterward.似乎使用了太多线程并且之后没有清理。 What is going wrong here?这里出了什么问题?

How to use brave to automate printing html to pdf? 如何使用 brave 自动打印 html 到 pdf?

Ok I guess this may not be normal type of answer as its kind of "works for me"好吧,我想这可能不是正常类型的答案,因为它是一种“对我有用”

In cases such as this where the "programming" is simply one cross platform command, that in its dependencies uses system and application resources, there are times one user has problems and others do not.在这种情况下,“编程”只是一个跨平台命令,其依赖项使用系统和应用程序资源,有时一个用户会遇到问题,而其他用户则不会。 Thus debugging can be highly system dependent.因此调试可能高度依赖于系统。

By way of explanation as to potential issues (and its too long for simple comments) here are my experiences on Windows.通过对潜在问题的解释(对于简单的评论来说太长了),这里是我在 Windows 上的经验。

pre running (why so many windows processes !!)预运行(为什么有这么多 Windows 进程!!)

Fresh boot新开机
Apps=3应用=3
one is system folder explorer一个是系统文件夹资源管理器
one is this notepad一个是这个记事本
one is task manager monitor一个是任务管理器监视器
Background processes=82 Including Edge (inactive=5 !!)后台进程=82,包括边缘(非活动=5 !!)
processes=107 including console = 5 !!进程=107,包括控制台=5!

Start command terminal启动命令终端
Apps =+1 with 3 sub processes? Apps =+1 有 3 个子进程?
Background =+1 command prompt背景 =+1 命令提示符
processes =+1 (console now = 6)进程 =+1(控制台现在 = 6)

Start Brave portable开始勇敢便携
apps =+1 Brave no page requested only welcome but with 8 sub processes?#? apps =+1 Brave no page requested only welcome but with 8 sub processes?#?
background =+1 brave portable背景=+1 勇敢的便携
processes =same (console still = 6)进程=相同(控制台仍然= 6)

Navigate to this page导航到此页面
apps = same Brave with this page requested = 9 then drops back to 8 sub processes ! apps = Brave 与请求的此页面相同 = 9 然后返回到 8 个子进程!
background = same 1 brave portable背景 = 相同的 1 brave portable
processes =same (console still = 6)进程=相同(控制台仍然= 6)

Run 20 similar commands with/without --enable-logging使用/不使用 --enable-logging运行 20 个类似的命令
Mea Culpa (Idiot) 20 fails several times because I did not verify if will run without a running Brave nor test bad cut and paste Mea Culpa(白痴)20 多次失败,因为我没有验证是否会在没有运行 Brave 的情况下运行,也没有测试错误的剪切和粘贴
but looks like no residual change to processes??但看起来流程没有剩余变化??
Try again with brave closed勇敢关闭再试一次

Apps and Background processes returns to before Brave active应用程序和后台进程返回到 Brave 激活之前

for /l %a in (1,1,20) do brave-portable --headless --print-to-pdf="C:\Users\K\Downloads\brave-portable\test2-%a.pdf" --disable-extensions --print-to-pdf-no-header --disable-popup-blocking --run-all-compositor-stages-before-draw --disable-checker-imaging "https://stackoverflow.com/questions/74788259/how-to-use-brave-to-automate-printing-html-to-pdf"

Hmmm without error checking there is some noticed difference to an earlier run call completes in a few seconds thus its much too quick to see tasks listed in manager.嗯,在没有错误检查的情况下,与较早的运行调用在几秒钟内完成有一些明显的区别,因此它太快无法看到管理器中列出的任务。

Background processes ramped up to 194 !!后台进程增加到 194 before drop back to about 78在回落到大约 78 之前

and after about 20 seconds there are 19 same size files (as almost might be expected)大约 20 秒后,有 19 个相同大小的文件(几乎可以预料)

Now what is odd about that is that usually from experience they should all be different sizes as each call should show different in-page adverts over time but then again I had logged in and accepted cookies earlier, so there should be no ads to make a difference in later runs.现在奇怪的是,通常根据经验,它们应该都是不同的大小,因为随着时间的推移,每次调用都应该显示不同的页内广告,但我又一次登录并早些时候接受了 cookie,所以应该没有广告来制作后期运行的区别。

EXCEPT ONE rogue file out of 20 has an advert Arghhhhhhhh!!除了 20 个流氓文件中有一个有广告 Arghhhhhhhh!!
so the inconsistencies saga continues.所以不一致的传奇还在继续。

However there is no residual use of task processes in my Windows portable Brave with that command sequence!然而,在我的 Windows 便携式 Brave 中没有使用该命令序列的任务进程的剩余使用!

On its own Brave is using only a few percent of CPU and Memory before and after with no hint of tying up disk or other resource features. Brave 本身在前后仅使用了百分之几的 CPU 和内存,没有占用磁盘或其他资源功能的迹象。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM