[Gambas-user] Sending a landscape PDF to printer
Rolf-Werner Eilert
eilert-sprachen at ...221...
Wed Dec 2 08:40:10 CET 2015
Am 01.12.2015 22:37, schrieb willy at ...3474...:
> On 2015-12-01 15:40, Rolf-Werner Eilert wrote:
>> Without waiting for an answer, I found a workaround for this:
>>
>> pdftk will rotate any landscape documents "1-endwest", so they are
>> printed as usual.
>>
>> If anyone here is interested in the code, you're welcome of course :)
>>
>> Regards
>> Rolf
> Hi Rolf,
>
> I'm curious in the code. I forsee I will be needing it as well in some
> near future situations.
>
> Regards,
>
> gbWilly
>
Okay, here you go ;)
My program produces PDFs which are stored under the client's name to be
able to see who I have printed something for. When it is a landscape
document, a flag is set which can be asked for in the end. This is the
original piece of code:
If Querdruck = True Then
Exec ["pdftk", Replace$(feld[1], "~", User.Home), "cat",
"1-endW", "output", User.Home &/ "karteitmp/quer.pdf"] Wait
Exec ["kprinter", "--nodialog", "-d", drucker.Name, "-#",
AnzahlKopien, User.Home &/ "karteitmp/quer.pdf"] Wait
Else
Exec ["kprinter", "--nodialog", "-d", drucker.Name, "-#",
AnzahlKopien, Replace$(feld[1], "~", User.Home)] Wait
End If
To make things easier, this is a more readable version:
If Landscape = True Then
Exec ["pdftk", <input.pdf>, "cat", "1-endW", "output", <output.pdf>] Wait
Then I use kprinter to print, but lp would do the same.
Strange enough, my landscape PDFs are recognized as landscape by any PDF
viewer, and printed as landscapes from there. But when you send them to
the printing system, landscape is lost (or they are not turned round,
respectively).
1-endW means page 1 thru last page westward. There may be later versions
of pdftk which use "east" and "west" etc. instead of a single letter.
Hope this helps you on...
Regards
Rolf
More information about the User
mailing list