I need to take the RadScheduler printout for multiple schedules and create a single PDF document with a page for each schedule. I can create the loop to load the appointments for each schedule, and setup the RadPrintDocument. How can I get it from there into a PDF document,in code (vb.net).
Thanks
Art
Thanks
Art
5 Answers, 1 is accepted
0
Hi,
Once you are done with this, you can use our PdfProcessing libraries to create the pdf document. More information on how to utilize this library is available here: http://www.telerik.com/help/winforms/pdfprocessing-editing-fixedcontenteditor.html.
I hope that you find this information useful. Should you have any other questions, do not hesitate to contact us. Regards,
Stefan
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
Thank you for writing.
Here is how you can print out the scheduler in images:
Private
Sub
radButton1_Click(sender
As
Object
, e
As
EventArgs)
Dim
printDoc
As
New
RadPrintDocument()
Dim
dailyStyle
As
New
SchedulerDailyPrintStyle()
dailyStyle.DateStartRange = DateTime.Now
dailyStyle.DateEndRange = DateTime.Now.AddDays(10)
radScheduler1.PrintStyle = dailyStyle
DirectCast
(radScheduler1, IPrintable).BeginPrint(printDoc,
New
PrintEventArgs())
'this is needed in order to set the printStyle source
Dim
bmp
As
New
Bitmap(1000, 1000)
Dim
g
As
Graphics = Graphics.FromImage(bmp)
Dim
pages
As
Integer
= radScheduler1.PrintStyle.GetNumberOfPages(
New
Rectangle(0, 0, 1000, 1000), g)
g.Dispose()
bmp.Dispose()
For
i
As
Integer
= 0
To
pages - 1
bmp =
New
Bitmap(1000, 1000)
g = Graphics.FromImage(bmp)
g.FillRectangle(Brushes.White,
New
Rectangle(0, 0, 1000, 1000))
radScheduler1.PrintStyle.DrawPage(g,
New
Rectangle(0, 0, 1000, 1000), i + 1)
g.Dispose()
bmp.Save(
"Image"
+ i +
".bmp"
)
bmp.Dispose()
Next
End
Sub
Once you are done with this, you can use our PdfProcessing libraries to create the pdf document. More information on how to utilize this library is available here: http://www.telerik.com/help/winforms/pdfprocessing-editing-fixedcontenteditor.html.
I hope that you find this information useful. Should you have any other questions, do not hesitate to contact us. Regards,
Stefan
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
Art
Top achievements
Rank 1
answered on 22 Dec 2014, 08:50 PM
Thank you Stefan, that allowed me to create the bmp file. Now I simply want to open that file and save as a pdf. I've save the bmp file to c:\users\temp\scheduler.bmp and I want to convert/save it to c:\users\acw\myschedule.pdf. I can't seem to find any examples of that process (VB.Net). Do you know of any?
Later
Art
Later
Art
0
Hi Art,
As I mentioned in my previous post, to create the pdf file, you can use our PdfProcessing library: http://www.telerik.com/help/winforms/pdfprocessing-editing-fixedcontenteditor.html. With it, you can create pdf documents and insert the desired images.
I hope this helps.
Regards,
Stefan
Telerik
As I mentioned in my previous post, to create the pdf file, you can use our PdfProcessing library: http://www.telerik.com/help/winforms/pdfprocessing-editing-fixedcontenteditor.html. With it, you can create pdf documents and insert the desired images.
I hope this helps.
Regards,
Stefan
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
Art
Top achievements
Rank 1
answered on 27 Jan 2015, 05:49 PM
Okay, I'm back on this project. You keep telling me to go to the pdfprovider documentation, but now I get the following error
Dim provider As PdfFormatProvider = New PdfFormatProvider()
Argument not specified for parameter 'settings' of 'Public Sub New(stream As System.IO.Stream, settings As Telerik.Windows.Pdf.Documents.Fixed.FormatProviders.FormatProviderSettings)'. J:\Win\AppDev\BASIS2\BASIS2\frmSched2PDF.vb 422 45 BASIS2
Also, it's difficult to piece together your fractured code snippets into a cohesive piece of software that actually accomplishes a minor task. Is there a chance someone could take a few minutes and write a some basic code (VB) to take a bmp file, insert it into a document, and create/save it as a pdf document file?
Thanks for your help so far, I'm getting there.
Dim provider As PdfFormatProvider = New PdfFormatProvider()
Argument not specified for parameter 'settings' of 'Public Sub New(stream As System.IO.Stream, settings As Telerik.Windows.Pdf.Documents.Fixed.FormatProviders.FormatProviderSettings)'. J:\Win\AppDev\BASIS2\BASIS2\frmSched2PDF.vb 422 45 BASIS2
Also, it's difficult to piece together your fractured code snippets into a cohesive piece of software that actually accomplishes a minor task. Is there a chance someone could take a few minutes and write a some basic code (VB) to take a bmp file, insert it into a document, and create/save it as a pdf document file?
Thanks for your help so far, I'm getting there.
0
Hi Art,
Thank you for getting back to me.
The idea of our documentation is to get you acquainted with the different functionality we offer and how to use it. It is structured in functional sections, so in order to start working with a component, it is recommended to have a look at the overview, getting started and the articles of interested (concerning the desired functionality).
Here is for example how to get started with the pdf processing library I was referring: http://www.telerik.com/help/winforms/pdfprocessing-getting-started.html. Once you see how to do that, the only thing left is to get to the article concerning adding images, namely: http://www.telerik.com/help/winforms/pdfprocessing-model-image.html. So, with three small snippets you can achieve the desired functionality. Here is how this looks in code:
I hope that the provided information addresses your question.
Regards,
Stefan
Telerik
Thank you for getting back to me.
The idea of our documentation is to get you acquainted with the different functionality we offer and how to use it. It is structured in functional sections, so in order to start working with a component, it is recommended to have a look at the overview, getting started and the articles of interested (concerning the desired functionality).
Here is for example how to get started with the pdf processing library I was referring: http://www.telerik.com/help/winforms/pdfprocessing-getting-started.html. Once you see how to do that, the only thing left is to get to the article concerning adding images, namely: http://www.telerik.com/help/winforms/pdfprocessing-model-image.html. So, with three small snippets you can achieve the desired functionality. Here is how this looks in code:
Imports
Telerik.WinControls.UI
Public
Class
Form1
Private
Sub
Form1_Load(sender
As
Object
, e
As
EventArgs)
Handles
MyBase
.Load
For
index = 1
To
5
Dim
appointment
As
New
Telerik.WinControls.UI.Appointment(DateTime.Now.AddDays(1), TimeSpan.FromMinutes(30),
"First "
& index,
"Some Description"
)
appointment.StatusId = 2
appointment.BackgroundId = 6
Me
.RadScheduler1.Appointments.Add(appointment)
appointment =
New
Telerik.WinControls.UI.Appointment(DateTime.Now, TimeSpan.FromMinutes(30),
"Second "
& index,
"Some Description"
)
appointment.StatusId = 4
appointment.BackgroundId = 2
Me
.RadScheduler1.Appointments.Add(appointment)
appointment =
New
Telerik.WinControls.UI.Appointment(
Date
.Now.AddDays(2), TimeSpan.FromHours(24),
"Third "
& index,
"Some Description"
)
appointment.StatusId = 1
appointment.BackgroundId = 4
Me
.RadScheduler1.Appointments.Add(appointment)
Next
End
Sub
Private
Sub
RadButton1_Click(sender
As
Object
, e
As
EventArgs)
Handles
RadButton1.Click
Dim
printDoc
As
New
RadPrintDocument()
Dim
dailyStyle
As
New
SchedulerDailyPrintStyle()
dailyStyle.DateStartRange = DateTime.Now
dailyStyle.DateEndRange = DateTime.Now.AddDays(10)
RadScheduler1.PrintStyle = dailyStyle
DirectCast
(RadScheduler1, IPrintable).BeginPrint(printDoc,
New
Printing.PrintEventArgs())
'this is needed in order to set the printStyle source
Dim
bmp
As
New
Bitmap(1000, 1000)
Dim
g
As
Graphics = Graphics.FromImage(bmp)
Dim
pages
As
Integer
= RadScheduler1.PrintStyle.GetNumberOfPages(
New
Rectangle(0, 0, 1000, 1000), g)
g.Dispose()
bmp.Dispose()
Dim
document
As
New
Telerik.Windows.Documents.Fixed.Model.RadFixedDocument()
For
i
As
Integer
= 0
To
pages - 1
bmp =
New
Bitmap(1000, 1000)
g = Graphics.FromImage(bmp)
g.FillRectangle(Brushes.White,
New
Rectangle(0, 0, 1000, 1000))
RadScheduler1.PrintStyle.DrawPage(g,
New
Rectangle(0, 0, 1000, 1000), i + 1)
g.Dispose()
''''''' pdf
Dim
page
As
New
Telerik.Windows.Documents.Fixed.Model.RadFixedPage()
document.Pages.Add(page)
'Read the image
Dim
stream
As
New
IO.MemoryStream
bmp.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp)
bmp.Dispose()
'Set the image as image resource of the added page in the document
Dim
imageSource
As
New
Telerik.Windows.Documents.Fixed.Model.Resources.ImageSource(stream)
page.Content.AddImage(imageSource)
Next
'Create pdf file
Dim
provider
As
New
Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider()
Using output
As
New
IO.FileStream(
"file.pdf"
, IO.FileMode.Create)
provider.Export(document, output)
End
Using
End
Sub
End
Class
I hope that the provided information addresses your question.
Regards,
Stefan
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.