Knowledge Base - How to create an image page? (Windows)

Knowledge Base - How to create an image page? (Windows)

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);

       PDFDocImage image = mNewDoc.NewImage(writeableBitmap, true);
       if (image != null)
             PDFPageImage pageImage = page.AddResImage(image);
             if (pageImage != null)
                  PDFPageContent pageContent = new PDFPageContent();

                  PDFMatrix matrix = new PDFMatrix(width, height, 0, 0);
                  page.AddContent(pageContent, true);
Applies To

RadaeePDF SDK for Windows 10

Related Articles

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

Order history

Login to handle your order history.