0

I am working on an application in which I need to print labels ranging from 1"x3" up to 8"x10". The text and images that will be printed on the labels is defined in a xml file that contains all needed info including its location on the label as defined by the top-left xy coordinate. I do not want to preview the print job, just send it to the printer on command. My question is, what is the preferred method for doing this?

I have toyed around with 2 different methods.

Method one: Reading the xml and locating the items on a form, creating an image of the form and then printing it. This works but it just seems a bit hokey?? I have to display the form for a second to create the image and I really do not want to do that.

Method two: I have looked into using MigraDoc to create a label document and then sending it to the printer. This approach will create the form and send it to the printer without being displayed however, I do not see how I can locate the items within the document based on xy coordinates?? Maybe I have missed something here but everything seems to be section and paragraph driven.

What would be the best/easiest way to accomplish this?

4

2 に答える 2

0

方法 2 について:
MigraDoc を使用すると、TextFrames を使用して、XY 座標を使用してアイテムを配置できます。テキストフレームはオーバーラップする可能性があり、この方法を使用する場合は、すべてが指定された領域に収まるようにする必要があります。

MigraDoc を使用するより良い方法は、正確な高さまたは間隔で表や段落を使用することです。ただし、スペースは前のアイテムに相対的でなければならないため、座標を含む XML ファイルを使用するアプローチでは、これを簡単に使用することはできません。

PDFsharp を使用して、適切な場所にすべてを描画する PDF ファイルを作成できます。ただし、印刷が問題になる可能性があります。コマンドライン引数を渡して Adob​​e Reader を呼び出して、自動的に印刷することはできますが、高度なプリンター オプションを設定することはできません。少数の印刷ジョブしか作成せず、手作業による介入が問題にならない場合は、これがオプションになる可能性があります (また、PDF ファイルを使用すると、印刷前にドキュメントを視覚的に確認できます)。

于 2013-05-14T08:44:48.443 に答える