I have existing PDF which is Encrypted.
lowerLeftX,lowerLeftY,upperRightX and upperRightY. my image is the whole page image.
Aspose.Pdf.Generator.Pdf and created from Stream and add section containing image?
I have existing PDF which is Encrypted.
Hi there,
string outFile =
“output.pdf”;<o:p></o:p>
string imageFile = "image1.jpg";
Document doc = new Document("output.pdf","password");
Page page = doc.Pages.Add();
FileStream fs = new FileStream(imageFile, FileMode.Open, FileAccess.Read);
// Set margins so image will fit, etc.
page.PageInfo.Margin.Bottom = 0;
page.PageInfo.Margin.Top = 0;
page.PageInfo.Margin.Left = 0;
page.PageInfo.Margin.Right = 0;
page.PageInfo.Height = Aspose.Pdf.PageSize.A4.Height;
page.PageInfo.Width = Aspose.Pdf.PageSize.A4.Width;
//Create an image object
Aspose.Pdf.Image image1 = new Aspose.Pdf.Image();
//Add the image into paragraphs collection of the section
page.Paragraphs.Add(image1);
//Set the ImageStream to a MemoryStream object
image1.ImageStream = fs;
//Save
doc.Save(outFile);
Please feel free to contact us for any further assistance.
Best Regards,