我目前正在尝试编写bash脚本,允许用户为他们需要打印的条形码输入文本(输入C128),然后:
这是一个特别的网站:
将TEST1替换为任何文本。
我尝试过使用wget、curl、html2ps、html2ps + ps2pdf,但是我遇到了一个源自URL页面底部的问题:
https://www.barcodesinc.com/generator/image.php
通过CLI可以得到以下信息:
“需要条形码类型的ex. C39”
其目的是在本地打印或保存图像,然后打印出来。
这就是我迄今尝试过的:
#!/bin/bash
echo -ne "Enter the ID you want to print: "
read locid
#html2ps https://www.barcodesinc.com/generator/image.php?code=LOCATION$locid&style=165&type=C128B&width=388&height=150&xres=2&font=5 | lpr
#html2ps https://www.barcodesinc.com/generator/image.php?code=LOCATION$locid&style=165&type=C128B&width=388&height=150&xres=2&font=5 | ps2pdf - /home/byron/locations/LOCATION$locid.pdf
#html2ps https://www.barcodesinc.com/generator/image.php?code=LOCATION$locid&style=165&type=C128B&width=388&height=150&xres=2&font=5 -o /home/byron/locations/LOCATION$locid.html
#ps2pdf /home/byron/locations/LOCATION$locid.html /home/byron/locations/LOCATION$locid.pdf
lpr /home/byron/locations/LOCATION$locid.pdf当使用任何CLI工具时,我似乎得到了一个空文件或stdout输出。此外,打印作业立即被取消,并显示"(stdin)到打印机“。
我像上面一样尝试了https://unix.stackexchange.com/questions/168569/printing-webpage-using-browser-via-cli,但是它没有成功。
发布于 2019-07-16 11:38:13
你为什么要使用LOCATION$locid而不仅仅是$locid
#!/bin/bash
read -p "enter LocationID:" locid
wget -O $locid.gif "https://www.barcodesinc.com/generator/image.php?code=$locid&style=165&type=C128B&width=388&height=150&xres=2&font=5"成功下载了名为test1的映像

发布于 2019-09-20 13:15:10
看起来barcodesinc.com不再支持热链接:只有在自己域中的页面才能使用、打开或创建条形码图像.
我建议使用不同的条形码图像服务器。例如,我刚刚找到了a10.selenode.com
wget"https://a10.selenode.com/code128/TEST1“

https://stackoverflow.com/questions/57056107
复制相似问题