mixed orientation

The Amyuni PDF Converter is our Printer Driver that enables you to convert any documents to PDF format. If you have any questions about installing and using the Amyuni PDF Converter please post them here.
Post Reply
EasilyLost
Posts: 2
Joined: Mon Nov 13 2017

mixed orientation

Post by EasilyLost » Wed Nov 15 2017

I am testing Amyuni's PDF Converter in an existing application with the goal of replacing Adobe Acrobat.

Some multi-page documents have the front side of the page rendered in portrait and the back side rendered in landscape. The PDF Amyuni produces is correct in that the first page is displayed as portrait and the second page displayed in landscape mode. Next front page displayed in Portrait mode followed again by the landscape mode back. Acrobat will do the same thing but we notice difficulty with printers printing the mixed orientation in continuous page sequence when a PDF is created this way.

Acrobat has the option to turn off auto-rotate pages. When we use that option the landscape pages are still rendered landscape but are displayed in portrait mode in the PDF. In other words you have to turn your head sideways to read the landscape pages. This works very well printing mixed orientation PDFs.

I tried to attach two 2 page PDFs (front and back of one sheet from a document). One from Amyuni and one from Acrobat so you can see what I am trying to describe. But it didn't allow attaching PDFs or zip files.

Anyone printing mixed orientation like this? Anyway to emulate Acrobat's ability to not rotate the landscape page?

Jose
Amyuni Team
Posts: 549
Joined: Tue Oct 01 2002
Contact:

Re: mixed orientation

Post by Jose » Fri May 04 2018

Hello,

Update on Post:

After further discussion with our support team, this issue was resolved.

It appears that the Acrobat PDF document is portrait and has no rotation. The text itself is rotated inside the page. So we assume that if you want to replicate the same thing with your code, you need to set rotation on the Device Context and draw the text accordingly (it is pretty complicated.) In GDI this is done by using:

SetGraphicsMode( dc, GM_ADVANCED );
SetWorldTransform( dc, &xform ); // xform is a rotation matrix

The rest is about positioning the text correctly… In GDIPLUS, it is a bit easier.

If you want to print in landscape, then rotate the page (because it is much less work), you can call this code after the call to EndPage of the page they want to rotate: (emphasized because it might look weird to call this after EndPage…):

// initialize the data to send to the printer
struct
{
short len;
char rotate[64];
} rotate;
strcpy(rotate.rotate, "/Rotate 270\r");
rotate.len = strlen(rotate.rotate);

// call our internal custom escape 253
ExtEscape(hDC, 253, sizeof(short) + rotate.len, (LPCSTR)&rotate, 0, 0);

Hope this helps other Amyuni users
Get PDF Suite, the expert .NET developer toolkit for PDF conversion, creation and editing - www.amyuni.com/pdfsuite

EasilyLost
Posts: 2
Joined: Mon Nov 13 2017

Re: mixed orientation

Post by EasilyLost » Thu May 10 2018

Thanks Jose,

We went with the latter using the escape code. Had to rewrite a little of the code. It works like a charm now :)

Thanks for the help!

Post Reply