【问题标题】:Create PCL by hand?手动创建 PCL?
【发布时间】:2020-05-05 14:34:58
【问题描述】:

手工“手工”创建 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

【问题讨论】:

  • NB 从 PostScript 到 PCL 的转换器也可能是一个答案。
  • 我的理解是,与 post 脚本不同,即使 PCL 具有人类可读的“ascii 表示”,这些命令实际上也需要转换为操作码,即 pcl 的二进制表示,以便打印机理解它,而且我认为没有 linux 或开源解决方案可以做到这一点:tek-tips.com/viewthread.cfm?qid=1673860
  • 我可以确认。在我用 ghostscript 创建了一个 x.pcl 文件后,如下所示,我看了一下里面:有一些可读的文本,比如 @PJL SET RESOLUTION=600;该文件的绝大多数内容都是乱码。

标签: pcl6


【解决方案1】:

编辑

你可以用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 的独立产品,安装它的唯一方法是 build it from 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

示例用法

我复制了一个test.ps 文件from wikipedia,在courier 中打印“Hello World”。

ps转pcl,pcl转回pdf

./gs -o ~/test.pcl -sDEVICE=pxlcolor -f ~/test.ps
./gpcl6 -o ~/test.pdf -sDEVICE=pdfwrite ~/test.pcl

一切都按预期进行。

【讨论】:

  • 无需从PCL转回PS;但是 ghostscript 选项可以满足我的所有需求。太好了!
猜你喜欢
  • 2012-05-25
  • 2012-10-07
  • 2014-12-16
  • 1970-01-01
  • 2021-03-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多