Blank pages when PageWidth>=PageHeight

Hi,

I am setting the page size of the PDF with the following lines:

PDFSection.PageInfo.PageWidth=MyPageWidth

PDFSection.PageInfo.PageHeight=MyPageHeight

However, if the height is less then or equal to the width then I only get blank pages. If I set the Height=Width+1, then it is OK.

Chris

Dear Chris,

I can't reproduce this problem. Can you please attach a complete example that can reproduce this error?

The following code works for an A4 page, but fails for the custom page size:

Dim PDFDocument As New Pdf

PDFDocument.PageSetup.PageWidth = 180

PDFDocument.PageSetup.PageHeight = 108

'Use the following 2 lines instead and it works!!

'PDFDocument.PageSetup.PageHeight = PageSize.A4Height

'PDFDocument.PageSetup.PageWidth = PageSize.A4Width

Dim PDFSection As New Section

PDFSection.PageInfo.PageWidth = PDFDocument.PageSetup.PageWidth

PDFSection.PageInfo.PageHeight = PDFDocument.PageSetup.PageHeight

Dim Graphics As New Graph(PDFSection)

With Graphics

.Margin.Top = 0

.PositioningType = PositioningType.PageRelative

.Left = 0

.Top = 0

.GraphWidth = PDFDocument.PageSetup.PageWidth

.GraphHeight = PDFDocument.PageSetup.PageHeight

End With

PDFSection.Paragraphs.Add(Graphics)

Dim NewRectangle As New Rectangle(Graphics)

With NewRectangle

.Left = 27

.Height = 20

.Bottom = 81

.Width = 152

.GraphInfo.Color = New Aspose.Pdf.Color("Black")

.GraphInfo.LineWidth = 2

End With

Graphics.Shapes.Add(NewRectangle)

PDFDocument.Sections.Add(PDFSection)

PDFDocument.Save("C:\temp.pdf")

Thanks for those above codes.

I have reproduced the error on my machine. We will check this issue out and reply to you soon.

Hi,

I found that the value of PageHeight 108 is smaller than the summation of default values 72 of PageInfo.Margin.Top and PageInfo.Margin.Bottom, which caused the disappearance of graphics.

So please try to set a larger value for PageHeight.

Hi,

Thanks for that. Though I had checked all the Margin properties, but missed this one.

Have now set all margins to 0 and it works fine.

Chris