Hello,
I'm using the PDF library to insert seal image in differents pdf files that contain blueprints.
Use the page width and height to set seal position. The page orientation is set on portrait but the viewer show in landscape.
The problem is the width property is less than the height property, it's the opposite and some images aren't inserted.
How can i get the width and height that really show me the viewer?
Attach a sample pdf file
Use the page width and height to set seal position. The page orientation is set on portrait but the viewer show in landscape. | We have checked the reported behavior with the provided details on our end. We suspect that your resultant pdf document is rotated to 270 degrees and this makes the pdf preserve in the portrait orientation. We have created a simple sample and replicated a similar issue with the above scenario. We request you confirm this. |
The problem is the width property is less than the height property, it's the opposite and some images aren't inserted. | Can you please share a simple sample with us? So that we can assist you further in this. |
Hello, sorry for the delay.
I attach an sample, I'm using Wisej, the problem is in first page, the image doesn't insert in the first page because the height, but in the third page is inserting very well.
Take the width and height like all the page are the same but some pages are show as landscape.
On our further analysis, we found that your first page of the PDF document is rotated to 90 degrees. we have attached a workaround to achieve the correct bounds of the pdf to insert the image into the pdf document. Please try this on your end and let us know the result.
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/InsertImageSample-806468491
Code snippet to get corrected bounds:
Private Shared Function GetCorrectedBounds(ByVal page As PdfLoadedPage, ByVal bounds As RectangleF) As RectangleF Dim pagesize As SizeF = page.Size Dim rectangle As RectangleF = New RectangleF(bounds.X, bounds.Y, bounds.Width, bounds.Height) If page.Rotation = PdfPageRotateAngle.RotateAngle90 Then rectangle.X = pagesize.Height - (bounds.Y + bounds.Height) rectangle.Y = bounds.X rectangle.Width = bounds.Height rectangle.Height = bounds.Width ElseIf page.Rotation = PdfPageRotateAngle.RotateAngle270 Then rectangle.X = pagesize.Width - (bounds.X + bounds.Width) rectangle.Y = bounds.Y rectangle.Width = bounds.Height rectangle.Height = bounds.Width ElseIf page.Rotation = PdfPageRotateAngle.RotateAngle180 Then rectangle.X = pagesize.Width - (bounds.X + bounds.Width) rectangle.Y = pagesize.Height - (bounds.Y + bounds.Height) rectangle.Width = bounds.Width rectangle.Height = bounds.Height End If Return rectangle End Function |
We request you to try this on your end and let us know the result