Reputation: 1003
I'm trying to save my bitmaps in a .pdf
file. It doesn't work. I'm not getting an error, but it doesn't open the dialog to save the .pdf
file.
Here is my code:
PdfDocument doc = new PdfDocument();
for (int iCnt = 0; iCnt < nPaginasPDF; iCnt++)
{
doc.Pages.Add(new PdfPage());
XGraphics xgr = XGraphics.FromPdfPage(doc.Pages[iCnt]);
XImage img = XImage.FromFile("C:\\" + (iCnt+1) + ".bmp"); (In this directory have these image files)
xgr.DrawImage(img, panel1.ClientRectangle);
}
using (var Stream = saveFileDialog1.OpenFile())
{
doc.Save(Stream);
}
doc.Close();
Upvotes: 1
Views: 1168
Reputation: 6698
The SaveFileDialog
's OpenFile
method opens the file returned by SaveFileDialog.Filename
property file with read/write permission.
To select a file before saving, you must use the ShowDialog
method first. Have you debugged and checked the value of Stream
with a break point?
Upvotes: 6