SetOrigin with more than one page, following page is larger then the first

Discussions about PDF management.
Post Reply
EFernkaes
Posts: 36
Joined: Fri Jul 31, 2015 5:27 pm

SetOrigin with more than one page, following page is larger then the first

Post by EFernkaes » Mon Jan 28, 2019 7:49 pm

Hello Orpalis team,

your newer releases show in my opinion a misbehaviour compared to previous releases concerning the use of ".SetOrigin" in the PDF-Class.

We normally set the origin to the upper left corner oGdPicturePdf.SetOrigin(PdfOrigin.PdfOriginTopLeft).

If you create the first page, let us say DIN A4, meaning 21 x 29.7 cm, and set the origin to the upper left corner everything is fine on the first page.
If you now add a page with larger dimensions, let us say 3 cm longer since we want to place some Information above the Picture, meaning e.g. 21 x 22.7
cm, the origin stays at the pont, it was set on the first page.
In this example, this would mean, every following page is starting at position 3 cm.
Setting Text with coordinates (0,0) is then not starting at the upper leftmost corner, it starts at Position (0,3).
Same behaviour if the following page is smaller than the first page. The Content placed at position (0,0) is not visible.

If you want to, I can send you examples.

This is quite a problem for us, since we already produced 10.000 of PDF we shared with our customers, since we updated the letest version.
We will now compare every following page to the first page and if larger, we will use a correction parameter which subtracts the difference.

Gabriela
Posts: 436
Joined: Wed Nov 22, 2017 9:52 am

Re: SetOrigin with more than one page, following page is larger then the first

Post by Gabriela » Mon Jan 28, 2019 8:58 pm

Hello,

Please, could you send us the code snippet, that we can use to reproduce the issue? It really helps us to identify the potential problem much quicker. Thank you.

EFernkaes
Posts: 36
Joined: Fri Jul 31, 2015 5:27 pm

Re: SetOrigin with more than one page, following page is larger then the first

Post by EFernkaes » Wed Jan 30, 2019 2:13 am

Sure.
I've deleted unnecessary code lines and did not paste the declaration of the variables in most cases.


Private oGdPicturePdf As GdPicturePDF
status = oGdPicturePdf.NewPDF()
oGdPicturePdf.SetOrigin(PdfOrigin.PdfOriginTopLeft)
oGdPicturePdf.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter)
status = oGdPicturePdf.NewPage(21, 29.7)
'... place some Image and text on the first page
oGdPicturePdf.ResetGraphicsState()
oGdPicturePdf.SelectPage(1)
oGdPicturePdf.DrawImage(imgResName, 2, 2, 10, 3)
FontResName = oGdPicturePdf.AddTrueTypeFontU("Arial", False, False, False)
oGdPicturePdf.DrawText(FontResName, 2, 5, Txt)
....
' Finally again a Picture on the first page
oGdPicturePdf.ResetGraphicsState()
oGdPicturePdf.SelectPage(1)
oGdPicturePdf.DrawImage(imgInfoscan, 2, 28, 5, 1.5)

_imageInfo = myGDPictureImaging.CreateGdPictureImageFromFile(Bild)
' Now add new page with a 3 cm larger Dimension than the first one
status = oGdPicturePdf.NewPage(21, 32.7)
'... place some Image, Rectangles and text on the second page
oGdPicturePdf.ResetGraphicsState()
oGdPicturePdf.SelectPage(2)
oGdPicturePdf.DrawImage(imgResName, 2, 2, 10, 3)
FontResName = oGdPicturePdf.AddTrueTypeFontU("Arial", False, False, False)
oGdPicturePdf.DrawText(FontResName, 2, 5, Txt)
....
' Finally again a Picture on the first page
oGdPicturePdf.ResetGraphicsState()
oGdPicturePdf.SelectPage(1)
oGdPicturePdf.DrawImage(imgInfoscan, 2, 28, 5, 1.5)

' Close PDF
oGdPicturePdf.SetViewerPageMode(PdfViewerPageMode.PdfViewerPageModeUseOutlines)
oGdPicturePdf.SetViewerNonFullScreenPageMode(PdfViewerNonFullScreenPageMode.PdfViewerNonFullScreenPageModeUseOutlines)


status = oGdPicturePdf.SaveToFile(_PDFFileName, False, _Password, _Password, (_Permissions And pdfSecurityOptions.pdfSNoPrint) = 0, _
(_Permissions And pdfSecurityOptions.pdfSNoCopy) = 0, (_Permissions And pdfSecurityOptions.pdfSNoModify) = 0, _
(_Permissions And pdfSecurityOptions.pdfSNoAnnots) = 0, (_Permissions And pdfSecurityOptions.pdfSNoForms) = 0, _
(_Permissions And pdfSecurityOptions.pdfSNoAccessible) = 0, (_Permissions And pdfSecurityOptions.pdfSNoAssemble) = 0, _
(_Permissions And pdfSecurityOptions.pdfSNoHiResPrint) = 0)
oGdPicturePdf.CloseDocument()

The result is following PDF:
http://alt.infoscan.de/GDPicture/24100001_Falsch.pdf

First page is "normal". Second page has a 3 cm White Frame at top and afterwards the content, though the coordinates schould begin directly on top, meaning the coordinates of the green Frames is Draw.Rectangle(0,0,21,3).
The origin point (0|0) for drawing on pages larger than the first page is still the origin of the first page.
When - like in my example, the first page is 29.7 cm Long and teh second page is 3 cm longer, 32.7, the origin for drawing operations is (0|3).

Hope this helps.

Greetings Reinhard

Gabriela
Posts: 436
Joined: Wed Nov 22, 2017 9:52 am

Re: SetOrigin with more than one page, following page is larger then the first

Post by Gabriela » Wed Jan 30, 2019 9:14 am

Hello,

Unfortunately, I'm not able to reproduce the behaviour you describe using our latest release (https://www.gdpicture.com/products/version-history/). Your code snippet is not compilable, but ok, I can make it work, even if I do not have the image sources you use. You are talking about "green Frames is Draw.Rectangle(0,0,21,3)" and there is no such line in your code. So I can not say if the green rectangle is drawn correctly or not. Your attached PDF document includes two pages and the second one is 211.3mm x 335.2mm large, so I'm not sure it has been created using "oGdPicturePdf.NewPage(21, 32.7)". Anyway, I have run the adapted compilable code, and I can not reproduce the behaviour with the shifted origin using our latest release.
Please, could you confirm you are using the latest release 14.1.3? If yes, please create a ticket on our support platform here: https://www.gdpicture.com/support/getting-support-from-our-team In this ticket you need to attach very simple, but compilable code snippet, that we can run "as is" with all other required materials (image sources). This code should demonstrate your issue. Please respect our support policies here: https://www.gdpicture.com/support/support-policies/
If we can reproduce the issue on our end, we can assist you further. Thank you for your understanding.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest