Copy and thanks for the feedback. In looking at your example it seems to be client-side based - how would it translate to server-side exporting? Please review the following code, partially derived from one of the examples:
Private Sub ExportToPdf2()
Dim doc As PdfDocument = New PdfDocument()
Dim bitmap As Bitmap = Dps_Scv.ExportBitmap()
' add the image to the PDF page
Dim img As XImage = XImage.FromGdiPlusImage(bitmap)
'these numbers are guesswork but for an 11x17 landscape format get the closest thing to a good output.
Dim captureHeight As Double = 760
Dim captureWidth As Double = 2510
Dim totalHeight As Double = img.PixelHeight / 1.5
Dim totalWidth As Double = img.PixelWidth
Dim page As PdfPage = Nothing
Dim i = 0
Dim saveHeight As Double = 0
While saveHeight < totalHeight
page = New PdfPage()
page.Size = PdfSharp.PageSize.Tabloid
page.Orientation = PdfSharp.PageOrientation.Landscape
doc.Pages.Add(page)
Dim xgr As XGraphics = XGraphics.FromPdfPage(doc.Pages(i))
xgr.DrawImage(img, 0, -i * captureHeight, captureWidth, totalHeight)
saveHeight += captureHeight
i += 1
End While
' save the PDF file to MemoryStream
Dim mem As New MemoryStream()
doc.Save(mem, False)
' send the output stream to the browser
Response.Clear()
Response.ContentType = "application/pdf"
Response.AddHeader("content-disposition", "attachment;filename=staffview.pdf")
mem.WriteTo(Response.OutputStream)
Response.End()
End Sub
In the example (which again is a combo of DayPilot example code and kludges that I found on a PDF Sharp forum for multiple page printing of an exported image), the scheduler is being captured as a bitmap and then various pdf sharp methods are being used to format the output, ultimately being streamed to the browser as a pdf. It works, but not without issues, etc. and I don’t think it will scale well.
Can the “ExportAs” functionality be adapted to a server-side model? If so, are there any examples in the docs? On a whim, I tried using ExportAs in my code-behind but I’m getting a VS error about ExportAs not being a member of DayPilotScheduler (screenshot attached).
So guessing that it can’t be directly leveraged from server-side code – any suggestions?
Thanks again - Ed