pcl6 - 手动创建 PCL?
问题描述
手动“手工”创建 PCL 文件是否可行?我已经为 PostScript 完成了它,发现它并不是特别困难,尽管即使是创建一个简单的绘图也需要花费大量时间和精力。现在我面临着一个连接到 Ubuntu PC 的 OKI C823,它打印正常但不理解 PostScript - 这可能解释了为什么它如此便宜......(对于这么大的打印机)我确实找到了下面的示例“PCL XL 功能参考”,但当我将它送入打印机时,文本只是作为文本打印,而不是绘制预期的线条。
eInch Measure
600 600 UnitsPerMeasure
BeginSession // attribute: basic measure for the session is inches
// attribute: 600 units in both X and Y direction
// operator: begin the imaging session
ePortraitOrientation Orientation
eLetterPaper MediaSize
BeginPage // attribute: page orientation is portrait
// attribute: size of media for page is letter
// operator: begin the page description
1200 800 Point
SetCursor // attribute: point a which to set the current cursor
// operator: set the cursor
2400 800 EndPoint
LinePath // attribute: endpoint of a 2 inch line
// operator: add the line to the current path
PaintPath // operator: paint the current path
EndPage // operator: end the page description
EndSession // operator: end the imaging session
解决方案
编辑
您可以使用 ghostscript 将 ps 转换为 pcl
sudo apt-get install ghostscript
gs -o ~/test.pcl -sDEVICE=pxlcolor -f ~/test.ps
或者
gs -o ~/test.pcl -sDEVICE=pxlmono -f ~/test.ps
如果您出于某种原因需要后退——将 pcl 转换为 ps——请参阅下面更复杂的说明
您可以使用 Ghostscript 中的 GhostPDL 从 pcl6 转换为 ps。它是 Ghostscript 的独立产品,而安装它的唯一方法是从 source 构建它。
建造它
我正在使用 ubuntu 18 LTS。我需要一些先决条件,你的系统可能已经有了它们
sudo apt-get install autoconf
sudo apt-get install g++
sudo apt-get install make
下载源代码,解压缩并构建
wget https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs950/ghostpdl-9.50.tar.gz
tar xvf ghostpdl-9.50.tar.gz
cd ghostpdl-9.50
sh ./autogen.sh
make
二进制文件位于 bin 文件夹中
cd ./bin
示例使用
我从 wikipedia复制了一个test.ps
文件,该文件在 courier 中打印“Hello World”。
将ps转换为pcl,将pcl转换回pdf
./gs -o ~/test.pcl -sDEVICE=pxlcolor -f ~/test.ps
./gpcl6 -o ~/test.pdf -sDEVICE=pdfwrite ~/test.pcl
一切都按预期工作。
推荐阅读
- apache-spark - spark.yarn.executor.memoryOverhead 是否已弃用?
- amazon-web-services - 如何将设备(位于 greengrass 组之外)连接到 greengrass 组?
- ios - 如何在iOS上将内容模式为scaleAspectFill的图像底部像素拉伸到全屏?
- visual-studio-code - 无法从赛普拉斯集成文件夹路径运行 cypress test.spec.js 文件
- powershell - 在脚本中动态设置 Azure DevOps 变量
- python - 使用正则表达式替换python中数据框值中的某些关键字
- amcharts - 创建具有最小高度列的柱形图
- rasa-nlu - 应该使用哪个实体 rxtractor?拉萨
- kotlin - 应用程序在 GooglePlay 商店中崩溃,但在模拟器和物理设备上本地开发时不会崩溃
- angular - 我们可以把禁用属性放到角度选择器上吗