#1 2010-09-14 17:06:21

renato
Member
Registered: 2010-06-21
Posts: 5

How to select printer tray source from pdf file (multiples page types)

Hi guis,

It is possible to make calls from input trays from printer?

im sending the pdf file directly to printer, but i have two types of paper:

1 - for first page of invoice (put green pages on printer tray 1)
2 - for other pages of invoice (put yellow pages on printer tray 2)

I need now make the file PDF call correctly the papers from input trays 1 and 2.

Example File.pdf

Page one: call paper from tray 1
Page two: call paper from tray 2
Page three: call paper from tray 2
Page four: call paper from tray 2
Page five: call paper from tray 1 (new invoice)

It is possible to implement? or in the future versions?

Gratz..

my email/msn: renato.adm@live.com

Offline

#2 2010-09-14 17:46:37

renato
Member
Registered: 2010-06-21
Posts: 5

Re: How to select printer tray source from pdf file (multiples page types)

i found the postscript comands to change the paper:
<</MediaType (capa)   /MediaWeight 90 /MediaColor (white) >> setpagedevice
<</MediaType (corpo)   /MediaWeight 90 /MediaColor (white) >> setpagedevice

Offline

#3 2010-09-15 15:09:41

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,682
Website

Re: How to select printer tray source from pdf file (multiples page types)

I think this is depending on the printer used...

If there is a generic way of adding such commands, we could try to add these commands.

Would you like to have a way of adding some custom postscript content to the pdf page stream?

Offline

#4 2010-09-15 18:04:46

renato
Member
Registered: 2010-06-21
Posts: 5

Re: How to select printer tray source from pdf file (multiples page types)

ab wrote:

I think this is depending on the printer used...

If there is a generic way of adding such commands, we could try to add these commands.

Would you like to have a way of adding some custom postscript content to the pdf page stream?

Yeah,

its a amazing idea to add commands to pdf page stream.

can it possible to implement in future version? i will make a lots of tests with postscript commands..

im going to adobe foruns search for a generic commands to make this possible.

Last edited by renato (2010-09-15 18:05:42)

Offline

#5 2010-09-17 17:08:19

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,682
Website

Re: How to select printer tray source from pdf file (multiples page types)

OK, I'll take a look at that this next days, and post some updates.

It should not be so much difficult to implement.

Honestly, I didn't think that some printer can understand the pdf language...
In which type of printer, and for which kind of software are you working on?
(I'm just curious about that)

Offline

#6 2010-09-18 20:08:33

reddwarf
Member
Registered: 2010-06-28
Posts: 40
Website

Re: How to select printer tray source from pdf file (multiples page types)

this is an interesting post. some time ago I had a similar problem. but I used normal printer begindoc, canvas, endoc etc. I wanted to print the first page of a document as landscape and the second page as portrait and I did not find the way how to do it in a single print job. the only possibility I found was to split the document into 2 print jobs. this solution is, of course, not ideal because e.g. if you select the "adobe pdf" printer you get 2 files and you have to join them manually afterwards.

do you know if/how it is possible to change paper settings during the printer job when using standard printing procedures in delphi? to my mind, it must be possible because for example adobe reader can handle it...

Offline

#7 2010-09-19 08:05:04

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,682
Website

Re: How to select printer tray source from pdf file (multiples page types)

reddwarf wrote:

do you know if/how it is possible to change paper settings during the printer job when using standard printing procedures in delphi? to my mind, it must be possible because for example adobe reader can handle it...

About paper size, there are standard pdf commands for that, which are already available in the PDF engine.
You can change the paper orientation from one page to the next, without any problem: the page width and height are page-specific.
No need to create several pdf contents.

Other printer settings can be modified just before printing, but in the standard Printer Options dialog, or by using the corresponding API.

You can easily add some postscript commands in the current page canvas, at the current stream position, using:

  Document.Canvas.Contents.Writer.Add(....)

See TPdfWrite Add() overloaded methods. These methods are very optimized for speed, and you can call Add() in a nested way, like that:

  with Document.Canvas.Contents.Writer do
    Add('some text').Add(OneInteger).Add('text ').Add(OneDouble).Add('>');

So I think dedicated methods are not needed.

Please give me some feedback about this...

And don't be shy, and you can post code in this forum, or send me some sample code, so that I could add it into the official source code repository!

Thanks for your interest.

Offline

#8 2010-09-24 09:28:48

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,682
Website

Re: How to select printer tray source from pdf file (multiples page types)

@renato: no feedback yet?

Are the TPdfWrite.Add methods sufficient for implementing your feature request?

wink

Offline

Board footer

Powered by FluxBB