To create a new image page, you can use the following code (premium license is needed):
StorageFolder storageFolder = ApplicationData.Current.LocalFolder;
StorageFile newFile = await storageFolder.CreateFileAsync("new.pdf", CreationCollisionOption.ReplaceExisting);
IRandomAccessStream stream = await newFile.OpenAsync(FileAccessMode.ReadWrite);
PDFDoc mNewDoc = new PDFDoc();
if (mNewDoc.Create(stream) == PDF_ERROR.err_ok)
{
float width = 297f, height = 210f;
mNewDoc.SetCahce(storageFolder.Path + "\\new.dat");
PDFPage page = mNewDoc.NewPage(0, width, height);
StorageFile imageFile = await storageFolder.GetFileAsync("bitmap.jpg");
IRandomAccessStream streamImage = await imageFile.OpenAsync(FileAccessMode.Read);
WriteableBitmap writeableBitmap = new WriteableBitmap(1, 1);
writeableBitmap.SetSource(streamImage);
PDFDocImage image = mNewDoc.NewImage(writeableBitmap, true);
if (image != null)
{
PDFPageImage pageImage = page.AddResImage(image);
if (pageImage != null)
{
PDFPageContent pageContent = new PDFPageContent();
pageContent.GSSave();
PDFMatrix matrix = new PDFMatrix(width, height, 0, 0);
pageContent.GSSetMatrix(matrix);
pageContent.DrawImage(pageImage);
pageContent.GSRestore();
page.AddContent(pageContent, true);
page.Close();
}
}
mNewDoc.Save();
mNewDoc.Close();
}
RadaeePDF SDK for Windows 10
How to add an image to a pdf? (Android)
How to add an image to a pdf? (iOS)
Created : 2017-04-11 12:26:53, Last Modified : 2017-05-09 10:48:09