Hi,
I'm having some issues trying to replace images on a multi-page pdf document. I am using the Aspose.Barcode to generate a different barcode image for each page of a pdf document. I loop through each page of the pdf document, and call the replace function. But, the issue is all pages of the pdf seem to have the same image when each page should have different image file. It appears to be some issue with the image replace.
My code is something like this:
for (int p = 1; p <= pdfdoc.Pages.Count; p++)
{
pg = pdfdoc.Pages[p];
b = new Aspose.BarCode.BarCodeBuilder();
b.SymbologyType = Aspose.BarCode.Symbology.Pdf417;
b.Pdf417ErrorLevel = Aspose.BarCode.Pdf417ErrorLevel.Level5;
b.CodeText = "test|" + p.ToString();
using (imgStream = new MemoryStream())
{
b.Save(imgStream, BarCodeImageFormat.Jpeg);
if (imgStream.Length > 0)
{
pg.Resources.Images.Replace(1, imgStream);
imgStream.Flush();
imgStream.Close();
}
}
}
I'm having some issues trying to replace images on a multi-page pdf document. I am using the Aspose.Barcode to generate a different barcode image for each page of a pdf document. I loop through each page of the pdf document, and call the replace function. But, the issue is all pages of the pdf seem to have the same image when each page should have different image file. It appears to be some issue with the image replace.
My code is something like this:
for (int p = 1; p <= pdfdoc.Pages.Count; p++)
{
pg = pdfdoc.Pages[p];
b = new Aspose.BarCode.BarCodeBuilder();
b.SymbologyType = Aspose.BarCode.Symbology.Pdf417;
b.Pdf417ErrorLevel = Aspose.BarCode.Pdf417ErrorLevel.Level5;
b.CodeText = "test|" + p.ToString();
using (imgStream = new MemoryStream())
{
b.Save(imgStream, BarCodeImageFormat.Jpeg);
if (imgStream.Length > 0)
{
pg.Resources.Images.Replace(1, imgStream);
imgStream.Flush();
imgStream.Close();
}
}
}