DynaPdf landscape format

With DynaPdf can I create a page in landscape format ?

call pdf.SetOrientation(90)

or

call pdf.SetOrientationEx(90)

Does that help?

If I enter call - pdf. SetOrientation (90) - creates a page landscape but the table is always positioned on the shorter side.
I tried to add call pdf. SetOrientation (90) in Starter Table example.rbp (in the examples attached to sw)

Well maybe you need the Ex function?
Both do something different and you probably checked the manual?

Try

  call pdf.SetPageCoords pdf.kpcTopDown
  call pdf.Append
  call pdf.SetOrientationEx 90
  ' Landscape: 595 x 842 pixel
  call pdf.WriteFTextEx(   20.0, 20, 200, -1, pdf.ktaLeft, "Your Content")

1: WriteFTextEx: No active font!

why I use starter version ?

Because DynaPDF ist is the best PDF Lib for Xojo. We use it several years. Read the docs. Try the examples. It’s a flat learning curve. If you got an error, try to find the problem. So it takes some time to understand the dependencies and the possibilities. I don’t send you an complete example. Only a hint.

Try this:

[code]
dim f as FolderItem = SpecialFolder.UserHome.Child(“test.pdf”)

// pdf.SetLicenseKey(“your key”)

dim lWasOK as boolean = pdf.CreateNewPDF(f)
if not lwasok then
msgbox "Error creating file: " + f.NativePath
return
end if

call pdf.SetPageCoords pdf.kpcTopDown
call pdf.Append
call pdf.SetOrientationEx 90
’ Landscape: 595 x 842 pixel

call pdf.setfont (“Arial”, pdf.kfsNormal, 14, true, pdf.kcpUnicode)
call pdf.WriteFTextEx( 20.0, 20, 200, -1, pdf.ktaLeft, “Your Title”)

call pdf.setfont (“Arial”, pdf.kfsNormal, 9, true, pdf.kcpUnicode)
call pdf.WriteFTextEx( 20.0, 40, 800, -1, pdf.ktaLeft, “Your Subtitle”)

call pdf.EndPage

call pdf.CloseFile

if f.exists then f.Launch[/code]

Thank you for the exemple.
The DynaPdf is complete but a little complicated, but the examples help much
I suggest to increase the number of samples to help you learn

The error tells you that you didn’t set a font. So once you do that, it should work.

Or that the font is missing
Or that the font size is invalid.

a missing font or invalid font size would give error earlier with SetFont.

I found a problem with SetOrientationEX (well documented, but still a problem for me) - that is that the changing of the coordinate doesn’t always work well together with this. And I use ScaleCoords on my PDF classes to be able to position stuff on the page in millimeters; makes it much easier for me to correctly place stuff in forms. But I never got ScaleCoords to work together with SetOrientationEX.

BUT: I found a very nice working work-around by just switching the pagewidth & height when landscape mode is wanted. Code is not complete, just that you can get an idea. Works like a charm :slight_smile:

[code] call me.SetPageFormat Me.kpfDIN_A4

If mTable.landscape = True Then
Dim mW, mH As Double
mW = Me.GetPageHeight
mH = Me.GetPageWidth
call Me.SetPageWidth mW
call Me.SetPageHeight mH
End If[/code]

So enjoy drawing wide pages :slight_smile: