PDF rotating when drawing on another PDF

Discussions about PDF management.
Post Reply
Dabigoh
Posts: 2
Joined: Fri Mar 04, 2016 11:59 pm

PDF rotating when drawing on another PDF

Post by Dabigoh » Sat Mar 05, 2016 12:24 am

I have an application that loads a PDF and then draws that PDF onto a new PDF. The application then saves the new PDF. (The whole process if for cropping the original PDF, but that's not really important).

The problem that I'm having, is that sometimes the new PDF is upside down. For example, I can take PDF-A and draw it on to PDF-TEMP and it looks perfect when I save it. If I take PDF-B and draw it on to PDF-TEMP, the resulting PDF is upside down. Both PDF-A and PDF-B are right side up.

The original PDF's are provided by our art department, so I'm assuming that there is something different about them, but I have no idea what it would be or how to detect the difference so I know how to handle it.

Code: Select all

GdPicturePDF artPDF = new GdPciturePDF();
GdPicturePDF tempPDF = new GdPicturePDF();
GdPictureStatus status = new GdPictureStatus();

status = artPDF.LoadFromFile(ImageFile.FullName, true);
artPDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitInch);
status = artPDF.SelectPage(1);
status = artPDF.SaveToFile("newFolder\\TEST.PDF");

status = tempPDF.NewPDF();
tempPDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitInch);                
status = tempPDF.NewPage(5.78f, 15.71f);

float left = (5.78 - artPDF.GetPageWidth()) / 2;  // This usually ends up being approximately -.15
status = tempPDF.DrawPage(artPDF, 1, left, 0f, artPDF.GetPageWidth(), artPDF.GetPageHeight());
status = tempPDF.SaveToFile("newFolder\\TEMP.PDF");
As you can see, the code is pretty straight forward. I'm not setting any origin's and not doing any rotation. The saving of the artPDF is only to see if the PDF was loading upside down. Every "TEST.PDF" file is right side up. 90% of the files work perfectly and I wind up with a correct "TEMP.PDF". However, 10% of the files end up with an upside down "TEMP.PDF".

Hopefully, this all makes sense to you. As you can tell, the app is written in C#. We're using .NET 4.5 and GdPicture 11. We've tested GdPicture 10, but got the same results. We haven't tried GdPicture 12 yet, but we're working on it.

Thanks for your help.

delbeke
Posts: 89
Joined: Wed Oct 31, 2012 5:07 pm

Re: PDF rotating when drawing on another PDF

Post by delbeke » Sat Mar 05, 2016 11:35 am

Hi Dabigoh

Can you send us a sample PDF to help us to reproduce the problem ?

I think about a page rotation problem in the starting page, but i can not be sure.

Note that if you aim a cropping, you may use SetPageBox with the fisrt parameter set to PdfPageBox.PdfPageBoxCropBox

https://www.gdpicture.com/guides/gdpicture/web ... geBox.html

Jean-Luc

Dabigoh
Posts: 2
Joined: Fri Mar 04, 2016 11:59 pm

Re: PDF rotating when drawing on another PDF

Post by Dabigoh » Mon Mar 07, 2016 4:23 pm

I was thinking that "a page rotation problem in the starting page" is probably the issue, but I'm not sure how to tell.

Is there someway that I can send the PDF's to you? The documents are proprietary and my legal department would go nuts if I just posted them to a forum. The documents are 10-13 mb in size.

I'm happy to send you the samples so you can investigate, just let me know how/where to send them.

Thanks for your help.

delbeke
Posts: 89
Joined: Wed Oct 31, 2012 5:07 pm

Re: PDF rotating when drawing on another PDF

Post by delbeke » Tue Mar 08, 2016 10:54 am

Hi Dabigoh
You must open a ticket on the support platform.

https://support.orpalis.com/index.php?/Tickets/Submit/

Jean-Luc

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests