-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathProgram.cs
More file actions
34 lines (24 loc) · 921 Bytes
/
Program.cs
File metadata and controls
34 lines (24 loc) · 921 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using Syncfusion.Pdf.Graphics;
using Syncfusion.Pdf;
using Dropbox.Api;
using Dropbox.Api.Files;
using Syncfusion.Drawing;
PdfDocument doc = new PdfDocument();
PdfPage page = doc.Pages.Add();
PdfGraphics graphics = page.Graphics;
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
graphics.DrawString("Hello, World!", font, PdfBrushes.Black, new PointF(10, 10));
// Add more content if needed...
// Save the PDF to a memory stream.
MemoryStream stream = new MemoryStream();
doc.Save(stream);
doc.Close(true);
var accessToken = "YOUR_ACCESS_TOKEN";// Replace with your actual access token
using (var dbx = new DropboxClient(accessToken))
{
var uploadResult = await dbx.Files.UploadAsync(
"/path/to/save/yourfile.pdf",
WriteMode.Overwrite.Instance,
body: new MemoryStream(stream.ToArray()));
Console.WriteLine("Saved to Dropbox as " + uploadResult.PathDisplay);
}